Package: lphdisk
Version: 0.9.1-1
Severity: normal
Tags: patch

lphdisk does not build with linux-kernel-headers >= 2.6.18 due to the
_syscall* macros being no longer available. It results in the following
build failure:

> cc -g -Wall -O2   -c -o lphdisk.o lphdisk.c
> lphdisk.c:117: error: expected declaration specifiers or ‘...’ before 
> ‘_llseek’
> lphdisk.c:117: error: expected declaration specifiers or ‘...’ before ‘fd’
> lphdisk.c:117: error: expected declaration specifiers or ‘...’ before 
> ‘offset_high’
<snip/>

Patch attached.

-Ted

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-2-k7
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
diff -ru lphdisk-0.9.1/lphdisk.c lphdisk-0.9.1-new/lphdisk.c
--- lphdisk-0.9.1/lphdisk.c	2006-10-22 04:16:27.000000000 +1000
+++ lphdisk-0.9.1-new/lphdisk.c	2006-10-22 04:15:14.000000000 +1000
@@ -105,18 +105,17 @@
 /* call to do seeks to "long long" offsets under linux (this is needed to    */
 /* seek to sectors beyond 4194303 (2GB)).  This isn't directly supported by  */
 /* glibc, so we need to make our own interface function for it.  We should   */
-/* be able to get the _NR__llseek define from linux/unistd.h.  From this we  */
+/* be able to get the SYS__llseek define from sys/syscall.h.  From this we  */
 /* can construct a wrapper to perform the right system call.                 */
 
-#include <linux/unistd.h>       /* for __NR__llseek */
+#include <sys/syscall.h>       /* for SYS__llseek */
 
 typedef long long lloff_t;
 
-#ifdef __NR__llseek
+#ifdef SYS__llseek
 
-static _syscall5(int,_llseek, unsigned int,fd, unsigned long,offset_high,
-                 unsigned long,offset_low, lloff_t *,result,
-                 unsigned int,origin)
+#define _llseek(fd, offset_high, offset_low, result, origin) \
+	syscall(SYS__llseek, fd, offset_high, offset_low, result, origin)
 
 lloff_t llseek (unsigned int fd, lloff_t offset, unsigned int origin) {
   lloff_t result;
@@ -128,9 +127,9 @@
   return (retval == -1 ? (lloff_t) retval : result);
 }
 
-#else /* __NR__llseek */
+#else /* SYS__llseek */
 
-/* Somehow, __NR__llseek wasn't in linux/unistd.h.  This shouldn't ever      */
+/* Somehow, SYS__llseek wasn't in sys/syscall.h.  This shouldn't ever      */
 /* happen, but better safe than sorry.. The best we can do is emulate it     */
 /* with lseek, and hope we don't get an offset that's too large (throw an    */
 /* error if we do)                                                           */
@@ -148,7 +147,7 @@
   }
 }
 
-#endif /* __NR__llseek */
+#endif /* SYS__llseek */
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 

Reply via email to