浏览代码

core: futexlock include hack for older futex.h

Older non-fixed linux/futex.h version (<2.6.20) cannot be included from
userspace without additional type declarations (which otherwise
are included only if __KERNEL__ is defined).
Note that most distribution fix this problem by distributing a
modified /usr/include/linux/futex.h and not the default kernel
one. However there are other distributions (like CentOS 5) for
which this hack is needed.
Andrei Pelinescu-Onciul 16 年之前
父节点
当前提交
04938dc726
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      futexlock.h

+ 6 - 0
futexlock.h

@@ -49,6 +49,12 @@
                           between linux-libc-dev andlibc headers
                           in recent (6.08.2008) x86_64 debian sid
                           installations */
+/* hack to work with old linux/futex.h versions, that depend on sched.h in
+   __KERNEL__ mode (futex.h < 2.6.20) */
+#include <linux/types.h>
+typedef __u32 u32;
+struct task_struct;
+/* end of the hack */
 #include <linux/futex.h>
 #include <sys/syscall.h>
 #include <unistd.h>