[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#381296: linux-kernel-headers: <linux/futex.h> can't be included



Package: linux-kernel-headers
Version: 2.6.17.6-1
Severity: normal

Hi,

When trying to compile

#include <linux/futex.h>
int main(void) {
}
(for using futex, see futex(2))

I get a LOT of errors from various header files because they hold very
kernel-related definitions. The attached patch fixes that.

Regards,
Samuel

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

-- no debconf information

-- 
Samuel Thibault <samuel.thibault@ens-lyon.org>
 Battery 1: charging, 90%, charging at zero rate - will never fully charge.
 -+- acpi - et pourtant, ca monte -+-
--- futex-orig.h	2006-08-03 15:47:25.000000000 +0200
+++ futex.h	2006-08-03 15:52:20.000000000 +0200
@@ -1,7 +1,11 @@
 #ifndef _LINUX_FUTEX_H
 #define _LINUX_FUTEX_H
 
+#ifdef __KERNEL__
 #include <linux/sched.h>
+#else
+#define __user
+#endif
 
 /* Second argument to futex syscall */
 
@@ -90,6 +94,7 @@
  */
 #define ROBUST_LIST_LIMIT	2048
 
+#ifdef __KERNEL__
 long do_futex(unsigned long uaddr, int op, int val,
 		unsigned long timeout, unsigned long uaddr2, int val2,
 		int val3);
@@ -103,6 +108,7 @@
 {
 }
 #endif
+#endif
 
 #define FUTEX_OP_SET		0	/* *(int *)UADDR2 = OPARG; */
 #define FUTEX_OP_ADD		1	/* *(int *)UADDR2 += OPARG; */

Reply to: