From 0f0f20abd295592740a1e764abb976e0db337d86 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Thu, 11 Dec 2008 14:45:14 +0000 Subject: Move kernel-features.h header from the linuxthread directory to a common one (libc/sysdeps/linux/common/bits) so that any function can access to supported kernel feature (i.e. getdents). Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/common/bits/kernel-features.h | 80 ++++++++++++++++++++++ libc/sysdeps/linux/common/getdents.c | 1 + libpthread/linuxthreads/restart.h | 2 +- .../linuxthreads/sysdeps/i386/i686/pt-machine.h | 2 +- libpthread/linuxthreads/sysdeps/i386/pspinlock.c | 2 +- .../linuxthreads/sysdeps/pthread/getcpuclockid.c | 2 +- .../linuxthreads/sysdeps/pthread/kernel-features.h | 80 ---------------------- .../linuxthreads/sysdeps/pthread/uClibc-glue.h | 2 +- .../sysdeps/unix/sysv/linux/i386/vfork.S | 2 +- .../sysdeps/unix/sysv/linux/m68k/vfork.S | 2 +- .../unix/sysv/linux/powerpc/powerpc32/vfork.S | 2 +- .../unix/sysv/linux/powerpc/powerpc64/vfork.S | 2 +- .../sysdeps/unix/sysv/linux/pt-sigsuspend.c | 2 +- 13 files changed, 91 insertions(+), 90 deletions(-) create mode 100644 libc/sysdeps/linux/common/bits/kernel-features.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/kernel-features.h diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h new file mode 100644 index 000000000..88a71828b --- /dev/null +++ b/libc/sysdeps/linux/common/bits/kernel-features.h @@ -0,0 +1,80 @@ +/* Set flags signalling availability of kernel features based on given + kernel version number. + Copyright (C) 1999-2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file must not contain any C code. At least it must be protected + to allow using the file also in assembler files. */ + +#if defined __mips__ +# include +#endif + +#include +#define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE + +/* Real-time signal became usable in 2.1.70. */ +#if __LINUX_KERNEL_VERSION >= 131398 +# define __ASSUME_REALTIME_SIGNALS 1 +#endif + +/* Beginning with 2.5.63 support for realtime and monotonic clocks and + timers based on them is available. */ +#if __LINUX_KERNEL_VERSION >= 132415 +# define __ASSUME_POSIX_TIMERS 1 +#endif + +/* On x86, the set_thread_area syscall was introduced in 2.5.29, but its + semantics was changed in 2.5.30, and again after 2.5.31. */ +#if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__ +# define __ASSUME_SET_THREAD_AREA_SYSCALL 1 +#endif + +/* We can use the LDTs for threading with Linux 2.3.99 and newer. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_LDT_WORKS 1 +#endif + +/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way + and the vfork syscall made it into the official kernel. */ +#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ +# define __ASSUME_STD_AUXV 1 +# define __ASSUME_VFORK_SYSCALL 1 +#endif + +/* The vfork syscall on x86 and arm was definitely available in 2.4. */ +#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__) +# define __ASSUME_VFORK_SYSCALL 1 +#endif + +/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type + * information as well and in between 2.6.5 and 2.6.8 most compat wrappers + * were fixed too. Except s390{,x} which was fixed in 2.6.11. */ +#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__) +# define __ASSUME_GETDENTS32_D_TYPE 1 +#endif + +/* These features were surely available with 2.4.12. */ +#if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__ +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_FCNTL64 1 +# define __ASSUME_VFORK_SYSCALL 1 +#endif diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 0baf47eb4..e1aa2a51f 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -16,6 +16,7 @@ #include #include #include +#include /* With newer versions of linux, the getdents syscall returns d_type * information after the name field. diff --git a/libpthread/linuxthreads/restart.h b/libpthread/linuxthreads/restart.h index f53642eda..694ec48cf 100644 --- a/libpthread/linuxthreads/restart.h +++ b/libpthread/linuxthreads/restart.h @@ -13,7 +13,7 @@ /* GNU Library General Public License for more details. */ #include -#include +#include /* Primitives for controlling thread execution */ diff --git a/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h b/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h index 222d44a3f..2958c76f0 100644 --- a/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h @@ -25,7 +25,7 @@ #ifndef PT_EI # define PT_EI __extern_always_inline #endif -#include "kernel-features.h" +#include #ifndef __ASSEMBLER__ extern long int testandset (int *spinlock); diff --git a/libpthread/linuxthreads/sysdeps/i386/pspinlock.c b/libpthread/linuxthreads/sysdeps/i386/pspinlock.c index c9c62724b..64b59252a 100644 --- a/libpthread/linuxthreads/sysdeps/i386/pspinlock.c +++ b/libpthread/linuxthreads/sysdeps/i386/pspinlock.c @@ -20,7 +20,7 @@ #include #include #include "internals.h" -#include +#include /* This implementation is similar to the one used in the Linux kernel. diff --git a/libpthread/linuxthreads/sysdeps/pthread/getcpuclockid.c b/libpthread/linuxthreads/sysdeps/pthread/getcpuclockid.c index 1c64e6c2b..cefbd554a 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/getcpuclockid.c +++ b/libpthread/linuxthreads/sysdeps/pthread/getcpuclockid.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include diff --git a/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h b/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h deleted file mode 100644 index 88a71828b..000000000 --- a/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Set flags signalling availability of kernel features based on given - kernel version number. - Copyright (C) 1999-2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This file must not contain any C code. At least it must be protected - to allow using the file also in assembler files. */ - -#if defined __mips__ -# include -#endif - -#include -#define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE - -/* Real-time signal became usable in 2.1.70. */ -#if __LINUX_KERNEL_VERSION >= 131398 -# define __ASSUME_REALTIME_SIGNALS 1 -#endif - -/* Beginning with 2.5.63 support for realtime and monotonic clocks and - timers based on them is available. */ -#if __LINUX_KERNEL_VERSION >= 132415 -# define __ASSUME_POSIX_TIMERS 1 -#endif - -/* On x86, the set_thread_area syscall was introduced in 2.5.29, but its - semantics was changed in 2.5.30, and again after 2.5.31. */ -#if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__ -# define __ASSUME_SET_THREAD_AREA_SYSCALL 1 -#endif - -/* We can use the LDTs for threading with Linux 2.3.99 and newer. */ -#if __LINUX_KERNEL_VERSION >= 131939 -# define __ASSUME_LDT_WORKS 1 -#endif - -/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way - and the vfork syscall made it into the official kernel. */ -#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ -# define __ASSUME_STD_AUXV 1 -# define __ASSUME_VFORK_SYSCALL 1 -#endif - -/* The vfork syscall on x86 and arm was definitely available in 2.4. */ -#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__) -# define __ASSUME_VFORK_SYSCALL 1 -#endif - -/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type - * information as well and in between 2.6.5 and 2.6.8 most compat wrappers - * were fixed too. Except s390{,x} which was fixed in 2.6.11. */ -#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \ - || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__) -# define __ASSUME_GETDENTS32_D_TYPE 1 -#endif - -/* These features were surely available with 2.4.12. */ -#if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__ -# define __ASSUME_MMAP2_SYSCALL 1 -# define __ASSUME_TRUNCATE64_SYSCALL 1 -# define __ASSUME_STAT64_SYSCALL 1 -# define __ASSUME_FCNTL64 1 -# define __ASSUME_VFORK_SYSCALL 1 -#endif diff --git a/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h b/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h index e5c577ffb..b957dedc9 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h +++ b/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h @@ -6,7 +6,7 @@ #include #ifdef IS_IN_libpthread -#include "kernel-features.h" +#include #ifndef __GLIBC_HAVE_LONG_LONG # define __GLIBC_HAVE_LONG_LONG diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S index c7a120d23..78eeabf53 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S @@ -20,7 +20,7 @@ #include #define _ERRNO_H 1 #include -#include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S index 49b8a3c0a..9f304abbe 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S @@ -20,7 +20,7 @@ #include #define _ERRNO_H 1 #include -#include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S index 724d4cc54..353c7d07f 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S @@ -19,7 +19,7 @@ #include #define _ERRNO_H 1 #include -#include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S index b408e31b7..7a3cb82c1 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S @@ -19,7 +19,7 @@ #include #define _ERRNO_H 1 #include -#include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c index 7c9fe36e2..613980593 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c @@ -24,7 +24,7 @@ #include #include -#include +#include void __pthread_sigsuspend (const sigset_t *set) -- cgit v1.2.3