diff options
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
98 files changed, 2645 insertions, 1247 deletions
diff --git a/libc/sysdeps/linux/common/bits/atomic.h b/libc/sysdeps/linux/common/bits/atomic.h index 6245130a9..fa35a2461 100644 --- a/libc/sysdeps/linux/common/bits/atomic.h +++ b/libc/sysdeps/linux/common/bits/atomic.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _BITS_ATOMIC_H #define _BITS_ATOMIC_H 1 diff --git a/libc/sysdeps/linux/common/bits/byteswap-common.h b/libc/sysdeps/linux/common/bits/byteswap-common.h new file mode 100644 index 000000000..4941d4768 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/byteswap-common.h @@ -0,0 +1,107 @@ +/* Macros to swap the order of bytes in integer values. + Copyright (C) 1997,1998,2000,2001,2002,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, see + <http://www.gnu.org/licenses/>. */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." +#endif + +#ifndef _BITS_BYTESWAP_H +#define _BITS_BYTESWAP_H 1 + +/* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + +#ifndef __bswap_non_constant_16 +# define __bswap_non_constant_16(x) __bswap_constant_16(x) +#endif +#ifdef __GNUC__ +# define __bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __bsv, __bsx = (x); \ + if (__builtin_constant_p (__bsx)) \ + __bsv = __bswap_constant_16 (__bsx); \ + else \ + __bsv = __bswap_non_constant_16 (__bsx); \ + __bsv; })) +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} +#endif + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) + +#ifndef __bswap_non_constant_32 +# define __bswap_non_constant_32(x) __bswap_constant_32(x) +#endif +#ifdef __GNUC__ +# define __bswap_32(x) \ + (__extension__ \ + ({ unsigned int __bsv, __bsx = (x); \ + if (__builtin_constant_p (__bsx)) \ + __bsv = __bswap_constant_32 (__bsx); \ + else \ + __bsv = __bswap_non_constant_32 (__bsx); \ + __bsv; })) +#else +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} +#endif + +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +# ifndef __bswap_non_constant_64 +# define __bswap_non_constant_64(x) \ + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned int __l[2]; } __w, __r; \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_non_constant_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_non_constant_32 (__w.__l[0]); \ + __r.__ll; })) +# endif +# define __bswap_64(x) \ + (__extension__ \ + ({ __extension__ unsigned long long int __ll; \ + if (__builtin_constant_p (x)) \ + __ll = __bswap_constant_64 (x); \ + else \ + __ll = __bswap_non_constant_64 (x); \ + __ll; })) +#endif + +#endif /* _BITS_BYTESWAP_H */ diff --git a/libc/sysdeps/linux/common/bits/byteswap.h b/libc/sysdeps/linux/common/bits/byteswap.h index 949ed0bc9..3f02506b6 100644 --- a/libc/sysdeps/linux/common/bits/byteswap.h +++ b/libc/sysdeps/linux/common/bits/byteswap.h @@ -1,87 +1 @@ -/* Macros to swap the order of bytes in integer values. - Copyright (C) 1997,1998,2000,2001,2002,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. */ - -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H -# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." -#endif - -#ifndef _BITS_BYTESWAP_H -#define _BITS_BYTESWAP_H 1 - -/* Swap bytes in 16 bit value. */ -#define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) - -#ifdef __GNUC__ -# define __bswap_16(x) \ - (__extension__ \ - ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); })) -#else -static __inline unsigned short int -__bswap_16 (unsigned short int __bsx) -{ - return __bswap_constant_16 (__bsx); -} -#endif - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ - (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) - -#ifdef __GNUC__ -# define __bswap_32(x) \ - (__extension__ \ - ({ register unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) -#else -static __inline unsigned int -__bswap_32 (unsigned int __bsx) -{ - return __bswap_constant_32 (__bsx); -} -#endif - -#if defined __GNUC__ && __GNUC__ >= 2 -/* Swap bytes in 64 bit value. */ -# define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) - -# define __bswap_64(x) \ - (__extension__ \ - ({ union { __extension__ unsigned long long int __ll; \ - unsigned int __l[2]; } __w, __r; \ - if (__builtin_constant_p (x)) \ - __r.__ll = __bswap_constant_64 (x); \ - else \ - { \ - __w.__ll = (x); \ - __r.__l[0] = __bswap_32 (__w.__l[1]); \ - __r.__l[1] = __bswap_32 (__w.__l[0]); \ - } \ - __r.__ll; })) -#endif - -#endif /* _BITS_BYTESWAP_H */ +#include <bits/byteswap-common.h> diff --git a/libc/sysdeps/linux/common/bits/cmathcalls.h b/libc/sysdeps/linux/common/bits/cmathcalls.h index 35237b35d..b56064bcd 100644 --- a/libc/sysdeps/linux/common/bits/cmathcalls.h +++ b/libc/sysdeps/linux/common/bits/cmathcalls.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <complex.h>, this file must NOT be protected from multiple inclusion as header files @@ -52,81 +51,104 @@ /* Arc cosine of Z. */ __MATHCALL (cacos, (_Mdouble_complex_ __z)); +libm_hidden_proto(cacos) /* Arc sine of Z. */ __MATHCALL (casin, (_Mdouble_complex_ __z)); +libm_hidden_proto(casin) /* Arc tangent of Z. */ __MATHCALL (catan, (_Mdouble_complex_ __z)); +libm_hidden_proto(catan) /* Cosine of Z. */ __MATHCALL (ccos, (_Mdouble_complex_ __z)); +libm_hidden_proto(ccos) /* Sine of Z. */ __MATHCALL (csin, (_Mdouble_complex_ __z)); +libm_hidden_proto(csin) /* Tangent of Z. */ __MATHCALL (ctan, (_Mdouble_complex_ __z)); +libm_hidden_proto(ctan) /* Hyperbolic functions. */ /* Hyperbolic arc cosine of Z. */ __MATHCALL (cacosh, (_Mdouble_complex_ __z)); +libm_hidden_proto(cacosh) /* Hyperbolic arc sine of Z. */ __MATHCALL (casinh, (_Mdouble_complex_ __z)); +libm_hidden_proto(casinh) /* Hyperbolic arc tangent of Z. */ __MATHCALL (catanh, (_Mdouble_complex_ __z)); +libm_hidden_proto(catanh) /* Hyperbolic cosine of Z. */ __MATHCALL (ccosh, (_Mdouble_complex_ __z)); +libm_hidden_proto(ccosh) /* Hyperbolic sine of Z. */ __MATHCALL (csinh, (_Mdouble_complex_ __z)); +libm_hidden_proto(ccosh) /* Hyperbolic tangent of Z. */ __MATHCALL (ctanh, (_Mdouble_complex_ __z)); +libm_hidden_proto(ctanh) /* Exponential and logarithmic functions. */ /* Exponential function of Z. */ __MATHCALL (cexp, (_Mdouble_complex_ __z)); +libm_hidden_proto(cexp) /* Natural logarithm of Z. */ __MATHCALL (clog, (_Mdouble_complex_ __z)); +libm_hidden_proto(clog) #ifdef __USE_GNU /* The base 10 logarithm is not defined by the standard but to implement the standard C++ library it is handy. */ __MATHCALL (clog10, (_Mdouble_complex_ __z)); +libm_hidden_proto(clog10) #endif /* Power functions. */ /* Return X to the Y power. */ __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); +libm_hidden_proto(cpow) /* Return the square root of Z. */ __MATHCALL (csqrt, (_Mdouble_complex_ __z)); +libm_hidden_proto(csqrt) /* Absolute value, conjugates, and projection. */ /* Absolute value of Z. */ __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); +libm_hidden_proto(cabs) /* Argument value of Z. */ __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); +libm_hidden_proto(carg) /* Complex conjugate of Z. */ __MATHCALL (conj, (_Mdouble_complex_ __z)); +libm_hidden_proto(conj) /* Projection of Z onto the Riemann sphere. */ __MATHCALL (cproj, (_Mdouble_complex_ __z)); +libm_hidden_proto(cproj) /* Decomposing complex values. */ /* Imaginary part of Z. */ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); +libm_hidden_proto(cimag) /* Real part of Z. */ __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); +libm_hidden_proto(creal) /* Now some optimized versions. GCC has handy notations for these diff --git a/libc/sysdeps/linux/common/bits/confname.h b/libc/sysdeps/linux/common/bits/confname.h index ab7fdee9d..7cfd285a4 100644 --- a/libc/sysdeps/linux/common/bits/confname.h +++ b/libc/sysdeps/linux/common/bits/confname.h @@ -1,5 +1,5 @@ /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993,1995-1998,2000,2001,2003,2004 + Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never use <bits/confname.h> directly; include <unistd.h> instead." @@ -498,13 +497,39 @@ enum _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, #define _SC_IPV6 _SC_IPV6 - _SC_RAW_SOCKETS + _SC_RAW_SOCKETS, #define _SC_RAW_SOCKETS _SC_RAW_SOCKETS + + _SC_V7_ILP32_OFF32, +#define _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFF32 + _SC_V7_ILP32_OFFBIG, +#define _SC_V7_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG + _SC_V7_LP64_OFF64, +#define _SC_V7_LP64_OFF64 _SC_V7_LP64_OFF64 + _SC_V7_LPBIG_OFFBIG, +#define _SC_V7_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG + + _SC_SS_REPL_MAX, +#define _SC_SS_REPL_MAX _SC_SS_REPL_MAX + + _SC_TRACE_EVENT_NAME_MAX, +#define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX + _SC_TRACE_NAME_MAX, +#define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX + _SC_TRACE_SYS_MAX, +#define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX + _SC_TRACE_USER_EVENT_MAX, +#define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX + + _SC_XOPEN_STREAMS, +#define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS + + _SC_THREAD_ROBUST_PRIO_INHERIT, +#define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT + _SC_THREAD_ROBUST_PRIO_PROTECT +#define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT }; -#if (defined __USE_POSIX2 || defined __USE_UNIX98 \ - || defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ - || defined __USE_LARGEFILE) /* Values for the NAME argument to `confstr'. */ enum { @@ -512,7 +537,21 @@ enum #define _CS_PATH _CS_PATH _CS_V6_WIDTH_RESTRICTED_ENVS, -# define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS +#define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS + + _CS_GNU_LIBC_VERSION, +#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION + _CS_GNU_LIBPTHREAD_VERSION, +#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION + + _CS_V5_WIDTH_RESTRICTED_ENVS, +#define _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS +#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS + + _CS_V7_WIDTH_RESTRICTED_ENVS, +#define _CS_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS +#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS # if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ || defined __USE_LARGEFILE) @@ -568,6 +607,7 @@ enum _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS # endif + # ifdef __USE_XOPEN2K _CS_POSIX_V6_ILP32_OFF32_CFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS @@ -599,8 +639,42 @@ enum #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS - _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS # endif + +# ifdef __USE_XOPEN2K8 + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, +#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, +#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS + _CS_POSIX_V7_ILP32_OFF32_LIBS, +#define _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, +#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, +#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, +#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, +#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, +#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS + _CS_POSIX_V7_LP64_OFF64_CFLAGS, +#define _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, +#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS + _CS_POSIX_V7_LP64_OFF64_LIBS, +#define _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, +#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, +#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, +#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, +#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS +#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS +# endif }; -#endif diff --git a/libc/sysdeps/linux/common/bits/dirent.h b/libc/sysdeps/linux/common/bits/dirent.h index 76794b08d..5728618f2 100644 --- a/libc/sysdeps/linux/common/bits/dirent.h +++ b/libc/sysdeps/linux/common/bits/dirent.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _DIRENT_H # error "Never use <bits/dirent.h> directly; include <dirent.h> instead." diff --git a/libc/sysdeps/linux/common/bits/dlfcn.h b/libc/sysdeps/linux/common/bits/dlfcn.h index 4bfbbff04..546748cc6 100644 --- a/libc/sysdeps/linux/common/bits/dlfcn.h +++ b/libc/sysdeps/linux/common/bits/dlfcn.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _DLFCN_H # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead." @@ -24,9 +23,9 @@ /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x00001 /* Lazy function call binding. */ #define RTLD_NOW 0x00002 /* Immediate function call binding. */ -#if 0 /* uClibc doesnt support these */ -#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ +#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00004 /* Do not load the object. */ +#if 0 /* uClibc doesnt support these */ #define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ #endif diff --git a/libc/sysdeps/linux/common/bits/environments.h b/libc/sysdeps/linux/common/bits/environments.h index 4617dc45f..eff32b3fe 100644 --- a/libc/sysdeps/linux/common/bits/environments.h +++ b/libc/sysdeps/linux/common/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2004, 2009 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 @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never include this file directly. Use <unistd.h> instead" @@ -27,30 +26,36 @@ `-1' means it is never supported. Undefined means it cannot be statically decided. - _POSIX_V6_ILP32_OFF32 32bit int, long, pointers, and off_t type - _POSIX_V6_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type - _POSIX_V6_LP64_OFF32 64bit long and pointers and 32bit off_t type - _POSIX_V6_LPBIG_OFFBIG 64bit long and pointers and large off_t type + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type - The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and - _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard - and are available only for compatibility. + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. */ #if __WORDSIZE == 64 /* We can never provide environments with 32-bit wide pointers. */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V7_ILP32_OFFBIG -1 # define _POSIX_V6_ILP32_OFF32 -1 # define _POSIX_V6_ILP32_OFFBIG -1 # define _XBS5_ILP32_OFF32 -1 # define _XBS5_ILP32_OFFBIG -1 /* We also have no use (for now) for an environment with bigger pointers and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 # define _POSIX_V6_LPBIG_OFFBIG -1 # define _XBS5_LPBIG_OFFBIG -1 /* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 # define _POSIX_V6_LP64_OFF64 1 # define _XBS5_LP64_OFF64 1 @@ -58,15 +63,19 @@ /* By default we have 32-bit wide `int', `long int', pointers and `off_t' and all platforms support LFS. */ +# define _POSIX_V7_ILP32_OFF32 1 +# define _POSIX_V7_ILP32_OFFBIG 1 # define _POSIX_V6_ILP32_OFF32 1 # define _POSIX_V6_ILP32_OFFBIG 1 # define _XBS5_ILP32_OFF32 1 # define _XBS5_ILP32_OFFBIG 1 /* We optionally provide an environment with the above size but an 64-bit - side `off_t'. Therefore we don't define _XBS5_ILP32_OFFBIG. */ + side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ /* We can never provide environments with 64-bit wide pointers. */ +# define _POSIX_V7_LP64_OFF64 -1 +# define _POSIX_V7_LPBIG_OFFBIG -1 # define _POSIX_V6_LP64_OFF64 -1 # define _POSIX_V6_LPBIG_OFFBIG -1 # define _XBS5_LP64_OFF64 -1 diff --git a/libc/sysdeps/linux/common/bits/epoll.h b/libc/sysdeps/linux/common/bits/epoll.h new file mode 100644 index 000000000..0a49b979f --- /dev/null +++ b/libc/sysdeps/linux/common/bits/epoll.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2002-2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_EPOLL_H +# error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead." +#endif + +/* Flags to be passed to epoll_create1. */ +enum + { + EPOLL_CLOEXEC = 02000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 00004000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h index a5ac1a47f..7c0aeb179 100644 --- a/libc/sysdeps/linux/common/bits/errno.h +++ b/libc/sysdeps/linux/common/bits/errno.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifdef _ERRNO_H @@ -25,7 +24,9 @@ # include <linux/errno.h> /* Linux has no ENOTSUP error code. */ -# define ENOTSUP EOPNOTSUPP +# ifndef ENOTSUP +# define ENOTSUP EOPNOTSUPP +# endif /* Older Linux versions also had no ECANCELED error code. */ # ifndef ECANCELED diff --git a/libc/sysdeps/linux/common/bits/eventfd.h b/libc/sysdeps/linux/common/bits/eventfd.h new file mode 100644 index 000000000..ef49c617e --- /dev/null +++ b/libc/sysdeps/linux/common/bits/eventfd.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2007-2013 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_EVENTFD_H +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead." +#endif + +/* Flags for eventfd. */ +enum + { + EFD_SEMAPHORE = 00000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE + EFD_CLOEXEC = 02000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 00004000 +#define EFD_NONBLOCK EFD_NONBLOCK + }; diff --git a/libc/sysdeps/linux/common/bits/fenv.h b/libc/sysdeps/linux/common/bits/fenv.h index a9cb53b40..0248ae110 100644 --- a/libc/sysdeps/linux/common/bits/fenv.h +++ b/libc/sysdeps/linux/common/bits/fenv.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _FENV_H # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." @@ -53,4 +52,4 @@ typedef struct fenv_t; /* If the default argument is used we use this value. */ -#define FE_DFL_ENV ((__const fenv_t *) -1l) +#define FE_DFL_ENV ((const fenv_t *) -1l) diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h index a28d0a40b..dababe07d 100644 --- a/libc/sysdeps/linux/common/bits/getopt.h +++ b/libc/sysdeps/linux/common/bits/getopt.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_H @@ -26,31 +25,7 @@ # define _GETOPT_H 1 #endif -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include <features.h>, but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include <ctype.h>, which will pull in <features.h> for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include <ctype.h> -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_DECLS /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, @@ -92,7 +67,7 @@ extern int optopt; The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -147,17 +122,11 @@ struct option arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ -#if defined __GNU_LIBRARY__ || defined __UCLIBC__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* __GNU_LIBRARY__ */ +libc_hidden_proto(getopt) -#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ +#if defined __UCLIBC_HAS_GETOPT_LONG__ #ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, @@ -171,9 +140,7 @@ extern int getopt_long_only (int ___argc, char *const *___argv, #endif #endif -#ifdef __cplusplus -} -#endif +__END_DECLS /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt diff --git a/libc/sysdeps/linux/common/bits/getopt_int.h b/libc/sysdeps/linux/common/bits/getopt_int.h new file mode 100644 index 000000000..291edfe24 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/getopt_int.h @@ -0,0 +1,136 @@ +/* Internal declarations for getopt. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + 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. */ + +#ifndef _GETOPT_INT_H +#define _GETOPT_INT_H 1 + +extern int _getopt_internal (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only) attribute_hidden; + + +/* Reentrant versions which can handle parsing multiple argument + vectors at the same time. */ + +/* For __ordering member */ +enum { + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +}; + +/* Data type for reentrant functions. */ + +struct _getopt_data +{ + /* These have exactly the same meaning as the corresponding global + variables, except that they are used for the reentrant + versions of getopt. */ + int optind; + int opterr; + char *optarg; + smalluint optopt; /* we store characters here, a byte is enough */ + + /* Internal members. */ + + /* True if the internal members have been initialized. */ + smallint __initialized; + + /* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we + scan, so that eventually all the non-options are at the end. + This allows options to be given in any order, even with programs + that were not written to expect this. + + RETURN_IN_ORDER is an option available to programs that were + written to expect options and other ARGV-elements in any order + and that care about the ordering of the two. We describe each + non-option ARGV-element as if it were the argument of an option + with character code 1. Using `-' as the first character of the + list of option characters selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + smallint __ordering; + + /* If the POSIXLY_CORRECT environment variable is set. */ + smallint __posixly_correct; + + /* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + char *__nextchar; + + + /* Handle permutation of arguments. */ + + /* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first + of them; `last_nonopt' is the index after the last of them. */ + + int __first_nonopt; + int __last_nonopt; + +#if defined _LIBC && defined USE_NONOPTION_FLAGS + int __nonoption_flags_max_len; + int __nonoption_flags_len; +# endif +}; + +/* The initializer is necessary to set OPTIND and OPTERR to their + default values and to clear the initialization flag. */ +#define _GETOPT_DATA_INITIALIZER { 1, 1 } + +#if 0 /* first is static on uClibc, the others not used */ +extern int _getopt_internal_r (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only, struct _getopt_data *__data); +#endif +#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ +#ifndef __need_getopt +extern int _getopt_long_r (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + struct _getopt_data *__data); + +extern int _getopt_long_only_r (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, + int *__longind, + struct _getopt_data *__data); +#endif +#endif +#endif /* getopt_int.h */ diff --git a/libc/sysdeps/linux/common/bits/huge_val.h b/libc/sysdeps/linux/common/bits/huge_val.h index 11ca11f18..c4ff6e2d8 100644 --- a/libc/sysdeps/linux/common/bits/huge_val.h +++ b/libc/sysdeps/linux/common/bits/huge_val.h @@ -15,9 +15,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_val.h> directly; include <math.h> instead." diff --git a/libc/sysdeps/linux/common/bits/huge_valf.h b/libc/sysdeps/linux/common/bits/huge_valf.h index 1785342cd..a553d110d 100644 --- a/libc/sysdeps/linux/common/bits/huge_valf.h +++ b/libc/sysdeps/linux/common/bits/huge_valf.h @@ -15,9 +15,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_valf.h> directly; include <math.h> instead." diff --git a/libc/sysdeps/linux/common/bits/huge_vall.h b/libc/sysdeps/linux/common/bits/huge_vall.h index d5e8e2237..2953165ab 100644 --- a/libc/sysdeps/linux/common/bits/huge_vall.h +++ b/libc/sysdeps/linux/common/bits/huge_vall.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_vall.h> directly; include <math.h> instead." diff --git a/libc/sysdeps/linux/common/bits/in.h b/libc/sysdeps/linux/common/bits/in.h index 6880a2e63..c67fbf852 100644 --- a/libc/sysdeps/linux/common/bits/in.h +++ b/libc/sysdeps/linux/common/bits/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991-2013 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 @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Linux version. */ @@ -43,31 +42,49 @@ #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ #define IP_MSFILTER 41 -#define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ -#define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ -#define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ -#define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ -#define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ -#define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ -#define MCAST_MSFILTER 48 - -#define MCAST_EXCLUDE 0 -#define MCAST_INCLUDE 1 - -#define IP_ROUTER_ALERT 5 /* bool */ -#define IP_PKTINFO 8 /* bool */ -#define IP_PKTOPTIONS 9 -#define IP_PMTUDISC 10 /* obsolete name? */ -#define IP_MTU_DISCOVER 10 /* int; see below */ -#define IP_RECVERR 11 /* bool */ -#define IP_RECVTTL 12 /* bool */ -#define IP_RECVTOS 13 /* bool */ +#if defined __USE_MISC || defined __USE_GNU +# define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ +# define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ +# define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ +# define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ +# define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ +# define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ +# define MCAST_MSFILTER 48 +# define IP_MULTICAST_ALL 49 +# define IP_UNICAST_IF 50 + +# define MCAST_EXCLUDE 0 +# define MCAST_INCLUDE 1 +#endif + +#define IP_ROUTER_ALERT 5 /* bool */ +#define IP_PKTINFO 8 /* bool */ +#define IP_PKTOPTIONS 9 +#define IP_PMTUDISC 10 /* obsolete name? */ +#define IP_MTU_DISCOVER 10 /* int; see below */ +#define IP_RECVERR 11 /* bool */ +#define IP_RECVTTL 12 /* bool */ +#define IP_RECVTOS 13 /* bool */ +#define IP_MTU 14 /* int */ +#define IP_FREEBIND 15 +#define IP_IPSEC_POLICY 16 +#define IP_XFRM_POLICY 17 +#define IP_PASSSEC 18 +#define IP_TRANSPARENT 19 +#define IP_MULTICAST_ALL 49 /* bool */ + +/* TProxy original addresses */ +#define IP_ORIGDSTADDR 20 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR + +#define IP_MINTTL 21 /* IP_MTU_DISCOVER arguments. */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IP_PMTUDISC_WANT 1 /* Use per route hints. */ #define IP_PMTUDISC_DO 2 /* Always DF. */ +#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ /* To select the IP level. */ #define SOL_IP 0 @@ -76,6 +93,7 @@ #define IP_DEFAULT_MULTICAST_LOOP 1 #define IP_MAX_MEMBERSHIPS 20 +#if defined __USE_MISC || defined __USE_GNU /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. The `ip_dst' field is used for the first-hop gateway when using a source route (this gets put into the header proper). */ @@ -100,7 +118,9 @@ struct in_pktinfo struct in_addr ipi_spec_dst; /* Routing destination address */ struct in_addr ipi_addr; /* Header destination address */ }; +#endif +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ @@ -158,6 +178,7 @@ struct in_pktinfo #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ #define IPV6_PMTUDISC_DO 2 /* Always DF. */ +#define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ /* Socket level values for IPv6. */ #define SOL_IPV6 41 @@ -168,3 +189,4 @@ struct in_pktinfo #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ +#endif /* __UCLIBC_HAS_IPV6__ */ diff --git a/libc/sysdeps/linux/common/bits/inf.h b/libc/sysdeps/linux/common/bits/inf.h index 1619f756e..5d0412849 100644 --- a/libc/sysdeps/linux/common/bits/inf.h +++ b/libc/sysdeps/linux/common/bits/inf.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/inf.h> directly; include <math.h> instead." diff --git a/libc/sysdeps/linux/common/bits/initspin.h b/libc/sysdeps/linux/common/bits/initspin.h index a19ec077e..b9e4acf30 100644 --- a/libc/sysdeps/linux/common/bits/initspin.h +++ b/libc/sysdeps/linux/common/bits/initspin.h @@ -13,9 +13,8 @@ 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ /* Initial value of a spinlock. Most platforms should use zero, unless they only implement a "test and clear" operation instead of diff --git a/libc/sysdeps/linux/common/bits/inotify.h b/libc/sysdeps/linux/common/bits/inotify.h new file mode 100644 index 000000000..291f00862 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/inotify.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2005-2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_INOTIFY_H +# error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead." +#endif + +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 02000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 00004000 +#define IN_NONBLOCK IN_NONBLOCK + }; diff --git a/libc/sysdeps/linux/common/bits/ioctl-types.h b/libc/sysdeps/linux/common/bits/ioctl-types.h index e856a04b4..45a106349 100644 --- a/libc/sysdeps/linux/common/bits/ioctl-types.h +++ b/libc/sysdeps/linux/common/bits/ioctl-types.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." diff --git a/libc/sysdeps/linux/common/bits/ioctls.h b/libc/sysdeps/linux/common/bits/ioctls.h index 11bb4c485..3664071cf 100644 --- a/libc/sysdeps/linux/common/bits/ioctls.h +++ b/libc/sysdeps/linux/common/bits/ioctls.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." @@ -49,7 +48,7 @@ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ #define SIOCSIFNAME 0x8923 /* set interface name */ -#define SIOCSIFHWADDR 0x8924 /* set hardware address */ +#define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ @@ -66,10 +65,10 @@ #define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ -#define SIOCSIFBR 0x8941 /* Set bridging options */ +#define SIOCSIFBR 0x8941 /* Set bridging options */ #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ -#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ +#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ /* ARP cache control calls. */ @@ -100,7 +99,7 @@ names as their own. Because these are device dependent it is a good idea _NOT_ to issue them to random objects and hope. */ -#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ +#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ /* * These 16 ioctl calls are protocol private diff --git a/libc/sysdeps/linux/common/bits/ipc.h b/libc/sysdeps/linux/common/bits/ipc.h index f1a043fe5..3bd5f1b6f 100644 --- a/libc/sysdeps/linux/common/bits/ipc.h +++ b/libc/sysdeps/linux/common/bits/ipc.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." 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..708bb4906 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/kernel-features.h @@ -0,0 +1,514 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +/* 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 <sgidefs.h> +#endif + +#include <linux/version.h> +#define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE + +/* We assume for __LINUX_KERNEL_VERSION the same encoding used in + linux/version.h. I.e., the major, minor, and subminor all get a + byte with the major number being in the highest byte. This means + we can do numeric comparisons. + + In the following we will define certain symbols depending on + whether the describes kernel feature is available in the kernel + version given by __LINUX_KERNEL_VERSION. We are not always exactly + recording the correct versions in which the features were + introduced. If somebody cares these values can afterwards be + corrected. Most of the numbers here are set corresponding to + 2.2.0. */ + +/* `getcwd' system call. */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_GETCWD_SYSCALL 1 +#endif + +/* When was `poll' introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_POLL_SYSCALL 1 +#endif + +/* Real-time signal became usable in 2.1.70. */ +#if __LINUX_KERNEL_VERSION >= 131398 +# define __ASSUME_REALTIME_SIGNALS 1 +#endif + +/* When were the `pread'/`pwrite' syscalls introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_PREAD_SYSCALL 1 +# define __ASSUME_PWRITE_SYSCALL 1 +#endif + +/* When was `poll' introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_POLL_SYSCALL 1 +#endif + +/* The `lchown' syscall was introduced in 2.1.80. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_LCHOWN_SYSCALL 1 +#endif + +/* When did the `setresuid' sysall became available? */ +#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +#endif + +/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_SIOCGIFNAME 1 +#endif + +/* MSG_NOSIGNAL was at least available with Linux 2.2.0. */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_MSG_NOSIGNAL 1 +#endif + +/* On x86 another `getrlimit' syscall was added in 2.3.25. */ +#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +#endif + +/* On x86 the mmap2 syscall was introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ +#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__ +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64 + syscalls were introduced in 2.3.35. */ +#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__) +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* I know for sure that getrlimit are in 2.3.35 on powerpc. */ +#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not + support separate 64-bit syscalls, already 64-bit */ +#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ \ + && !defined __powerpc64__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* Linux 2.3.39 introduced 32bit UID/GIDs. Some platforms had 32 + bit type all along. */ +#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__ +# define __ASSUME_32BITUIDS 1 +#endif + +/* Linux 2.3.39 sparc added setresuid. */ +#if __LINUX_KERNEL_VERSION >= 131879 && defined __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +#endif + +#if __LINUX_KERNEL_VERSION >= 131879 +# define __ASSUME_SETRESGID_SYSCALL 1 +#endif + +/* Linux 2.3.39 introduced IPC64. Except for powerpc. */ +#if __LINUX_KERNEL_VERSION >= 131879 && !defined __powerpc__ +# define __ASSUME_IPC64 1 +#endif + +/* MIPS platforms had IPC64 all along. */ +#if defined __mips__ +# define __ASSUME_IPC64 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 + +/* Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not + support a separate 64-bit sys call, already 64-bit */ +#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ \ + && !defined __powerpc64__ +# define __ASSUME_IPC64 1 +#endif + +/* SH kernels got stat64, mmap2, and truncate64 during 2.4.0-test. */ +#if __LINUX_KERNEL_VERSION >= 132096 && defined __sh__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* The changed st_ino field appeared in 2.4.0-test6. But we cannot + distinguish this version from other 2.4.0 releases. Therefore play + save and assume it available is for 2.4.1 and up. However, SH is lame, + and still does not have a 64-bit inode field. */ +#if __LINUX_KERNEL_VERSION >= 132097 && !defined __alpha__ && !defined __sh__ +# define __ASSUME_ST_INO_64_BIT 1 +#endif + +/* To support locking of large files a new fcntl() syscall was introduced + in 2.4.0-test7. We test for 2.4.1 for the earliest version we know + the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__) +# define __ASSUME_FCNTL64 1 +#endif + +/* The AT_CLKTCK auxiliary vector entry was introduction in the 2.4.0 + series. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_AT_CLKTCK 1 +#endif + +/* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I + don't know when it got introduced). But PowerPC64 does not support + separate FCNTL64 call, FCNTL is already 64-bit */ +#if __LINUX_KERNEL_VERSION >= 132100 \ + && (defined __arm__ || defined __powerpc__ || defined __sh__) \ + && !defined __powerpc64__ +# define __ASSUME_FCNTL64 1 +#endif + +/* The getdents64 syscall was introduced in 2.4.0-test7. We test for + 2.4.1 for the earliest version we know the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif + +/* When did O_DIRECTORY became available? Early in 2.3 but when? + Be safe, use 2.3.99. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_O_DIRECTORY 1 +#endif + +/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes + up the page size information. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_AT_PAGESIZE 1 +#endif + +/* Starting with at least 2.4.0 the kernel passes the uid/gid unconditionally + up to the child. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_AT_XID 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 + +/* Starting with 2.4.5 kernels the mmap2 syscall made it into the official + kernel. But PowerPC64 does not support a separate MMAP2 call. */ +#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ \ + && !defined __powerpc64__ +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* Starting with 2.4.21 PowerPC implements the new prctl syscall. + This allows applications to get/set the Floating Point Exception Mode. */ +#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__ +# define __ASSUME_NEW_PRCTL_SYSCALL 1 +#endif + +/* Starting with 2.4.21 the PowerPC32 clone syscall works as expected. */ +#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__ \ + && !defined __powerpc64__ +# define __ASSUME_FIXED_CLONE_SYSCALL 1 +#endif + +/* Starting with 2.4.21 PowerPC64 implements the new rt_sigreturn syscall. + The new rt_sigreturn takes an ucontext pointer allowing rt_sigreturn + to be used in the set/swapcontext implementation. */ +#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__ +# define __ASSUME_NEW_RT_SIGRETURN_SYSCALL 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 + +/* 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 + +/* There are an infinite number of PA-RISC kernel versions numbered + 2.4.0. But they've not really been released as such. We require + and expect the final version here. */ +#ifdef __hppa__ +# define __ASSUME_32BITUIDS 1 +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_IPC64 1 +# define __ASSUME_ST_INO_64_BIT 1 +# define __ASSUME_FCNTL64 1 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif + +/* Alpha switched to a 64-bit timeval sometime before 2.2.0. */ +#if __LINUX_KERNEL_VERSION >= 131584 && defined __alpha__ +# define __ASSUME_TIMEVAL64 1 +#endif + +#if defined __mips__ && _MIPS_SIM == _ABIN32 +# define __ASSUME_FCNTL64 1 +#endif + +/* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize + their availability with one define. The changes were made first + for i386 and the have to be done separately for the other archs. + For i386 we pick 2.5.50 as the first version with support. */ +#if __LINUX_KERNEL_VERSION >= 132402 && defined __i386__ +# define __ASSUME_CLONE_THREAD_FLAGS 1 +#endif + +/* Support for various CLOEXEC and NONBLOCK flags was added for x86, + x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */ +#if __LINUX_KERNEL_VERSION >= 0x020617 \ + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __ia64__ || defined __sparc__ || defined __s390__) +# define __ASSUME_O_CLOEXEC 1 +#endif + +/* Support for various CLOEXEC and NONBLOCK flags was added for x86, + * x86-64, PPC, IA-64, and SPARC in 2.6.27. */ +#if (__LINUX_KERNEL_VERSION >= 0x02061b \ + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __ia64__ || defined __sparc__ || defined __s390__) \ + ) || (__LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__) \ + || defined __aarch64__ || defined __tile__ +/* # define __ASSUME_SOCK_CLOEXEC 1 */ +/* # define __ASSUME_IN_NONBLOCK 1 */ +# define __ASSUME_PIPE2 1 +/* # define __ASSUME_EVENTFD2 1 */ +/* # define __ASSUME_SIGNALFD4 1 */ +/* # define __ASSUME_DUP3 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 + +/* 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 + +/* Beginning with 2.6.12 the clock and timer supports CPU clocks. */ +#if __LINUX_KERNEL_VERSION >= 0x2060c +# define __ASSUME_POSIX_CPU_TIMERS 1 +#endif + +/* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize + their availability with one define. The changes were made first + for i386 and the have to be done separately for the other archs. + For ia64, s390*, PPC, x86-64 we pick 2.5.64 as the first version + with support. */ +#if __LINUX_KERNEL_VERSION >= 132416 \ + && (defined __ia64__ || defined __s390__ || defined __powerpc__ \ + || defined __x86_64__ || defined __sh__) +# define __ASSUME_CLONE_THREAD_FLAGS 1 +#endif + +/* With kernel 2.4.17 we always have netlink support. */ +#if __LINUX_KERNEL_VERSION >= (132096+17) +# define __ASSUME_NETLINK_SUPPORT 1 +#endif + +/* The requeue futex functionality was introduced in 2.5.70. */ +#if __LINUX_KERNEL_VERSION >= 132422 +# define __ASSUME_FUTEX_REQUEUE 1 +#endif + +/* The statfs64 syscalls are available in 2.5.74. */ +#if __LINUX_KERNEL_VERSION >= 132426 +# define __ASSUME_STATFS64 1 +#endif + +/* Starting with at least 2.5.74 the kernel passes the setuid-like exec + flag unconditionally up to the child. */ +#if __LINUX_KERNEL_VERSION >= 132426 +# define __ASSUME_AT_SECURE 1 +#endif + +/* Starting with the 2.5.75 kernel the kernel fills in the correct value + in the si_pid field passed as part of the siginfo_t struct to signal + handlers. */ +#if __LINUX_KERNEL_VERSION >= 132427 +# define __ASSUME_CORRECT_SI_PID 1 +#endif + +/* The tgkill syscall was instroduced for i386 in 2.5.75. For Alpha + it was introduced in 2.6.0-test1 which unfortunately cannot be + distinguished from 2.6.0. On x86-64, ppc, and ppc64 it was + introduced in 2.6.0-test3. */ +#if (__LINUX_KERNEL_VERSION >= 132427 && defined __i386__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __alpha__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __x86_64__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__) +# define __ASSUME_TGKILL 1 +#endif + +/* The utimes syscall has been available for some architectures + forever. For x86 it was introduced after 2.5.75, for x86-64, + ppc, and ppc64 it was introduced in 2.6.0-test3. */ +#if defined __alpha__ || defined __ia64__ || defined __hppa__ \ + || defined __sparc__ \ + || (__LINUX_KERNEL_VERSION > 132427 && defined __i386__) \ + || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \ + || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__) +# define __ASSUME_UTIMES 1 +#endif + +// XXX Disabled for now since the semantics we want is not achieved. +#if 0 +/* The CLONE_STOPPED flag was introduced in the 2.6.0-test1 series. */ +#if __LINUX_KERNEL_VERSION >= 132609 +# define __ASSUME_CLONE_STOPPED 1 +#endif +#endif + +/* The fixed version of the posix_fadvise64 syscall appeared in + 2.6.0-test3. At least for x86. Powerpc support appeared in + 2.6.2, but for 32-bit userspace only. */ +#if (__LINUX_KERNEL_VERSION >= 132609 && defined __i386__) \ + || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \ + && !defined __powerpc64__) +# define __ASSUME_FADVISE64_64_SYSCALL 1 +#endif + +/* The PROT_GROWSDOWN/PROT_GROWSUP flags were introduced in the 2.6.0-test + series. */ +#if __LINUX_KERNEL_VERSION >= 132609 +# define __ASSUME_PROT_GROWSUPDOWN 1 +#endif + +/* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector + SIMD (AKA Altivec, VMX) instructions and register state. This changes + the overall size of the sigcontext and adds the swapcontext syscall. */ +#if __LINUX_KERNEL_VERSION >= 132608 && defined __powerpc__ +# define __ASSUME_SWAPCONTEXT_SYSCALL 1 +#endif + +/* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is + implied. */ +#if __LINUX_KERNEL_VERSION >= 132610 +# define __ASSUME_NO_CLONE_DETACHED 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 + +/* Starting with version 2.5.3, the initial location returned by `brk' + after exec is always rounded up to the next page. */ +#if __LINUX_KERNEL_VERSION >= 132355 +# define __ASSUME_BRK_PAGE_ROUNDED 1 +#endif + +/* Starting with version 2.6.9, the waitid system call is available. + Except for powerpc and powerpc64, where it is available in 2.6.12. */ +#if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__) +# define __ASSUME_WAITID_SYSCALL 1 +#endif + +/* Starting with version 2.6.9, SSI_IEEE_RAISE_EXCEPTION exists. */ +#if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__ +#define __ASSUME_IEEE_RAISE_EXCEPTION 1 +#endif + +/* Support for the accept4 syscall was added in 2.6.28. */ +#if __LINUX_KERNEL_VERSION >= 0x02061c \ + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __sparc__ || defined __s390__) +# define __ASSUME_ACCEPT4 1 +#endif + +/* Support for the accept4 syscall for alpha was added after 2.6.33-rc1. */ +#if __LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__ +# define __ASSUME_ACCEPT4 1 +#endif + +/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */ +#if __LINUX_KERNEL_VERSION >= 0x02061d +# define __ASSUME_FUTEX_CLOCK_REALTIME 1 +#endif + +/* Support for PI futexes was added in 2.6.18. */ +#if __LINUX_KERNEL_VERSION >= 0x020612 +# define __ASSUME_FUTEX_LOCK_PI 1 +#endif + +/* Support for private futexes was added in 2.6.22. */ +#if __LINUX_KERNEL_VERSION >= 0x020616 +# define __ASSUME_PRIVATE_FUTEX 1 +#endif + +/* Support for fallocate was added in 2.6.23, + on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */ +#if __LINUX_KERNEL_VERSION >= 0x020617 \ + && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \ + && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621) +# define __ASSUME_FALLOCATE 1 +#endif + +/* getcpu is a syscall for x86-64 since 3.1. */ +#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100 +# define __ASSUME_GETCPU_SYSCALL 1 +#endif + +/* getrandom syscall (widely) appeared around 4.0.0 */ +#if __LINUX_KERNEL_VERSION >= 0x040000 +# define __ASSUME_GETRANDOM_SYSCALL 1 +#endif diff --git a/libc/sysdeps/linux/common/bits/kernel_sigaction.h b/libc/sysdeps/linux/common/bits/kernel_sigaction.h index 99148e608..5c8726058 100644 --- a/libc/sysdeps/linux/common/bits/kernel_sigaction.h +++ b/libc/sysdeps/linux/common/bits/kernel_sigaction.h @@ -4,65 +4,21 @@ /* This file provides whatever this particular arch's kernel thinks * the sigaction struct should look like... */ -#undef NO_OLD_SIGACTION -#if defined(__mips__) -#undef HAVE_SA_RESTORER -/* This is the sigaction structure from the Linux 2.1.24 kernel. */ -#include <sgidefs.h> -struct old_kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned int sa_flags; - unsigned long sa_mask; -}; -#define _KERNEL_NSIG 128 -#define _KERNEL_NSIG_BPW 32 -#define _KERNEL_NSIG_WORDS (_KERNEL_NSIG / _KERNEL_NSIG_BPW) - -typedef struct { - unsigned long sig[_KERNEL_NSIG_WORDS]; -} kernel_sigset_t; +#if defined(__ia64__) -/* This is the sigaction structure from the Linux 2.1.68 kernel. */ -struct kernel_sigaction { - unsigned int sa_flags; - __sighandler_t k_sa_handler; - kernel_sigset_t sa_mask; - void (*sa_restorer)(void); - int s_resv[1]; /* reserved */ -}; -#elif defined(__ia64__) -#define NO_OLD_SIGACTION #undef HAVE_SA_RESTORER -struct kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned long sa_flags; - sigset_t sa_mask; -}; + #else + #define HAVE_SA_RESTORER /* This is the sigaction structure from the Linux 2.1.20 kernel. */ struct old_kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned long sa_mask; - unsigned long sa_flags; - void (*sa_restorer) (void); -}; -/* This is the sigaction structure from the Linux 2.1.68 kernel. */ -struct kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned long sa_flags; - void (*sa_restorer) (void); - sigset_t sa_mask; + __sighandler_t k_sa_handler; + unsigned long sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); }; #endif -#ifndef NO_OLD_SIGACTION -extern int __syscall_sigaction (int, const struct old_kernel_sigaction *__unbounded, - struct old_kernel_sigaction *__unbounded) attribute_hidden; -#endif - -extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded, - struct kernel_sigaction *__unbounded, size_t) attribute_hidden; - #endif /* _BITS_SIGACTION_STRUCT_H */ diff --git a/libc/sysdeps/linux/common/bits/local_lim.h b/libc/sysdeps/linux/common/bits/local_lim.h index 023ebf3d0..710de1d98 100644 --- a/libc/sysdeps/linux/common/bits/local_lim.h +++ b/libc/sysdeps/linux/common/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-1998,2000,2002,2003,2004 Free Software Foundation, Inc. + Copyright (C) 1993-1998,2000,2002-2004,2008 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 @@ -13,9 +13,8 @@ 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ /* The kernel header pollutes the namespace with the NR_OPEN symbol and defines LINK_MAX although filesystems have different maxima. A @@ -31,6 +30,9 @@ #ifndef OPEN_MAX # define __undef_OPEN_MAX #endif +#ifndef ARG_MAX +# define __undef_ARG_MAX +#endif /* The kernel sources contain a file with all the needed information. */ #include <linux/limits.h> @@ -50,6 +52,11 @@ # undef OPEN_MAX # undef __undef_OPEN_MAX #endif +/* Have to remove ARG_MAX? */ +#ifdef __undef_ARG_MAX +# undef ARG_MAX +# undef __undef_ARG_MAX +#endif /* The number of data keys per process. */ #define _POSIX_THREAD_KEYS_MAX 128 @@ -63,6 +70,8 @@ /* The number of threads per process. */ #define _POSIX_THREAD_THREADS_MAX 64 +/* We have no predefined limit on the number of threads. */ +#undef PTHREAD_THREADS_MAX /* Maximum amount by which a process can descrease its asynchronous I/O priority level. */ @@ -85,3 +94,6 @@ /* Maximum message queue priority level. */ #define MQ_PRIO_MAX 32768 + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX (2147483647) diff --git a/libc/sysdeps/linux/common/bits/locale.h b/libc/sysdeps/linux/common/bits/locale.h index 5d5178361..aa6949f4e 100644 --- a/libc/sysdeps/linux/common/bits/locale.h +++ b/libc/sysdeps/linux/common/bits/locale.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _LOCALE_H && !defined _LANGINFO_H # error "Never use <bits/locale.h> directly; include <locale.h> instead." @@ -33,14 +32,12 @@ enum __LC_MONETARY = 4, __LC_MESSAGES = 5, __LC_ALL = 6, -#if 0 __LC_PAPER = 7, __LC_NAME = 8, __LC_ADDRESS = 9, __LC_TELEPHONE = 10, __LC_MEASUREMENT = 11, __LC_IDENTIFICATION = 12 -#endif }; #endif /* bits/locale.h */ diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h index c02007284..8ab807578 100644 --- a/libc/sysdeps/linux/common/bits/mathcalls.h +++ b/libc/sysdeps/linux/common/bits/mathcalls.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files @@ -24,7 +23,7 @@ This file provides prototype declarations for the math functions. Most functions are declared using the macro: - __MATHCALL (NAME,[_r], (ARGS...)); + __MATHCALL (NAME,[_r], (ARGS...)) This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the @@ -34,7 +33,7 @@ Functions returning other types like `int' are declared using the macro: - __MATHDECL (TYPE, NAME,[_r], (ARGS...)); + __MATHDECL (TYPE, NAME,[_r], (ARGS...)) This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still @@ -48,49 +47,76 @@ #endif +/* __MATHCALLX(type,function,[suffix],args,attrib) and + * __MATHCALLI(type,function,[suffix],args) include libm_hidden_proto + * (for "double" versions only, xxxf and xxxl do not get this treatment). + * + * __MATHDECL(type,function,[suffix],args) does not. + * __MATHCALL(function,[suffix],args) also does not + * (it is just a shortcut to __MATHDECL(_Mdouble_,function,[suffix],args)). + * + * __MATHDECL_PRIV(type,function,[suffix],args,attrib) + * includes libm_hidden_proto (always) and declares __foo, not foo. + */ + + /* Trigonometric functions. */ _Mdouble_BEGIN_NAMESPACE /* Arc cosine of X. */ -__MATHCALL (acos,, (_Mdouble_ __x)); +__MATHCALLI (acos,, (_Mdouble_ __x)) /* Arc sine of X. */ -__MATHCALL (asin,, (_Mdouble_ __x)); +__MATHCALLI (asin,, (_Mdouble_ __x)) /* Arc tangent of X. */ -__MATHCALL (atan,, (_Mdouble_ __x)); +__MATHCALLI (atan,, (_Mdouble_ __x)) /* Arc tangent of Y/X. */ -__MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); +__MATHCALLI (atan2,, (_Mdouble_ __y, _Mdouble_ __x)) /* Cosine of X. */ -__MATHCALL (cos,, (_Mdouble_ __x)); +__MATHCALLI (cos,, (_Mdouble_ __x)) +# if defined _LIBC && defined _Mlong_double_ +libm_hidden_proto(cosl) +# endif +# if defined _LIBC && defined _Mfloat_ +libm_hidden_proto(cosf) +# endif + /* Sine of X. */ -__MATHCALL (sin,, (_Mdouble_ __x)); +__MATHCALLI (sin,, (_Mdouble_ __x)) +# if defined _LIBC && defined _Mlong_double_ +libm_hidden_proto(sinl) +# endif +# if defined _LIBC && defined _Mfloat_ +libm_hidden_proto(sinf) +# endif + /* Tangent of X. */ -__MATHCALL (tan,, (_Mdouble_ __x)); +__MATHCALLI (tan,, (_Mdouble_ __x)) /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ -__MATHCALL (cosh,, (_Mdouble_ __x)); +__MATHCALLI (cosh,, (_Mdouble_ __x)) /* Hyperbolic sine of X. */ -__MATHCALL (sinh,, (_Mdouble_ __x)); +__MATHCALLI (sinh,, (_Mdouble_ __x)) /* Hyperbolic tangent of X. */ -__MATHCALL (tanh,, (_Mdouble_ __x)); +__MATHCALLI (tanh,, (_Mdouble_ __x)) _Mdouble_END_NAMESPACE -#if 0 /*def __USE_GNU*/ +#if defined __USE_GNU /* Cosine and sine of X. */ __MATHDECL (void,sincos,, - (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); + (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)) #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Hyperbolic arc cosine of X. */ -__MATHCALL (acosh,, (_Mdouble_ __x)); +__MATHCALLI (acosh,, (_Mdouble_ __x)) /* Hyperbolic arc sine of X. */ -__MATHCALL (asinh,, (_Mdouble_ __x)); +__MATHCALLI (asinh,, (_Mdouble_ __x)) /* Hyperbolic arc tangent of X. */ -__MATHCALL (atanh,, (_Mdouble_ __x)); +__MATHCALLI (atanh,, (_Mdouble_ __x)) __END_NAMESPACE_C99 #endif @@ -98,51 +124,54 @@ __END_NAMESPACE_C99 _Mdouble_BEGIN_NAMESPACE /* Exponential function of X. */ -__MATHCALL (exp,, (_Mdouble_ __x)); +__MATHCALLI (exp,, (_Mdouble_ __x)) +# if defined _LIBC && defined _Mlong_double_ +libm_hidden_proto(expl) +# endif /* Break VALUE into a normalized fraction and an integral power of 2. */ -__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); +__MATHCALLI (frexp,, (_Mdouble_ __x, int *__exponent)) /* X times (two to the EXP power). */ -__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); +__MATHCALLI (ldexp,, (_Mdouble_ __x, int __exponent)) /* Natural logarithm of X. */ -__MATHCALL (log,, (_Mdouble_ __x)); +__MATHCALLI (log,, (_Mdouble_ __x)) /* Base-ten logarithm of X. */ -__MATHCALL (log10,, (_Mdouble_ __x)); +__MATHCALLI (log10,, (_Mdouble_ __x)) /* Break VALUE into integral and fractional parts. */ -__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)); +__MATHCALLI (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) _Mdouble_END_NAMESPACE -#if 0 /*def __USE_GNU*/ +#if defined __USE_GNU /* A function missing in all standards: compute exponent to base ten. */ -__MATHCALL (exp10,, (_Mdouble_ __x)); +__MATHCALLI (exp10,, (_Mdouble_ __x)) /* Another name occasionally used. */ -__MATHCALL (pow10,, (_Mdouble_ __x)); +__MATHCALLI (pow10,, (_Mdouble_ __x)) #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return exp(X) - 1. */ -__MATHCALL (expm1,, (_Mdouble_ __x)); +__MATHCALLI (expm1,, (_Mdouble_ __x)) /* Return log(1 + X). */ -__MATHCALL (log1p,, (_Mdouble_ __x)); +__MATHCALLI (log1p,, (_Mdouble_ __x)) /* Return the base 2 signed integral exponent of X. */ -__MATHCALL (logb,, (_Mdouble_ __x)); +__MATHCALLI (logb,, (_Mdouble_ __x)) __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Compute base-2 exponential of X. */ -__MATHCALL (exp2,, (_Mdouble_ __x)); +__MATHCALLI (exp2,, (_Mdouble_ __x)) /* Compute base-2 logarithm of X. */ -__MATHCALL (log2,, (_Mdouble_ __x)); +__MATHCALLI (log2,, (_Mdouble_ __x)) __END_NAMESPACE_C99 #endif @@ -151,23 +180,26 @@ __END_NAMESPACE_C99 _Mdouble_BEGIN_NAMESPACE /* Return X to the Y power. */ -__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (pow,, (_Mdouble_ __x, _Mdouble_ __y)) /* Return the square root of X. */ -__MATHCALL (sqrt,, (_Mdouble_ __x)); +__MATHCALLI (sqrt,, (_Mdouble_ __x)) _Mdouble_END_NAMESPACE #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return `sqrt(X*X + Y*Y)'. */ -__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (hypot,, (_Mdouble_ __x, _Mdouble_ __y)) +# if defined _LIBC && defined _Mlong_double_ +libm_hidden_proto(hypotl) +# endif __END_NAMESPACE_C99 #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return the cube root of X. */ -__MATHCALL (cbrt,, (_Mdouble_ __x)); +__MATHCALLI (cbrt,, (_Mdouble_ __x)) __END_NAMESPACE_C99 #endif @@ -176,100 +208,105 @@ __END_NAMESPACE_C99 _Mdouble_BEGIN_NAMESPACE /* Smallest integral value not less than X. */ -__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); +__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)) /* Absolute value of X. */ -__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); +__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)) /* Largest integer not greater than X. */ -__MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); +__MATHCALLX (floor,, (_Mdouble_ __x), (__const__)) /* Floating-point modulo remainder of X/Y. */ -__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (fmod,, (_Mdouble_ __x, _Mdouble_ __y)) /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ -__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); +__MATHDECL_PRIV (int,isinf,, (_Mdouble_ __value), (__const__)) /* Return nonzero if VALUE is finite and not NaN. */ -__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); +__MATHDECL_PRIV (int,finite,, (_Mdouble_ __value), (__const__)) _Mdouble_END_NAMESPACE #ifdef __USE_MISC +#if 0 /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ -__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); +__MATHDECL_PRIV (int,isinf,, (_Mdouble_ __value), (__const__)) /* Return nonzero if VALUE is finite and not NaN. */ -__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); - +__MATHDECL_PRIV (int,finite,, (_Mdouble_ __value), (__const__)) +#endif /* Return the remainder of X/Y. */ -__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)) /* Return the fractional part of X after dividing out `ilogb (X)'. */ -__MATHCALL (significand,, (_Mdouble_ __x)); +__MATHCALLI (significand,, (_Mdouble_ __x)) #endif /* Use misc. */ #if defined __USE_MISC || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return X with its signed changed to Y's. */ -__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); +__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)) __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return representation of NaN for double type. */ -__MATHCALLX (nan,, (__const char *__tagb), (__const__)); +__MATHCALLX (nan,, (const char *__tagb), (__const__)) __END_NAMESPACE_C99 #endif - +#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 /* Return nonzero if VALUE is not a number. */ -__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); +__BEGIN_NAMESPACE_C99 +__MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__)) +__END_NAMESPACE_C99 +#endif #if defined __USE_MISC || defined __USE_XOPEN -/* Return nonzero if VALUE is not a number. */ -__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); - +# ifdef __DO_XSI_MATH__ /* Bessel functions. */ -__MATHCALL (j0,, (_Mdouble_)); -__MATHCALL (j1,, (_Mdouble_)); -__MATHCALL (jn,, (int, _Mdouble_)); -__MATHCALL (y0,, (_Mdouble_)); -__MATHCALL (y1,, (_Mdouble_)); -__MATHCALL (yn,, (int, _Mdouble_)); +__MATHCALL (j0,, (_Mdouble_)) +__MATHCALL (j1,, (_Mdouble_)) +__MATHCALL (jn,, (int, _Mdouble_)) +__MATHCALL (y0,, (_Mdouble_)) +__MATHCALL (y1,, (_Mdouble_)) +__MATHCALL (yn,, (int, _Mdouble_)) +# endif #endif #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Error and gamma functions. */ -__MATHCALL (erf,, (_Mdouble_)); -__MATHCALL (erfc,, (_Mdouble_)); -__MATHCALL (lgamma,, (_Mdouble_)); +__MATHCALLI (erf,, (_Mdouble_)) +__MATHCALLI (erfc,, (_Mdouble_)) +__MATHCALLI (lgamma,, (_Mdouble_)) __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* True gamma function. */ -__MATHCALL (tgamma,, (_Mdouble_)); +__MATHCALLI (tgamma,, (_Mdouble_)) __END_NAMESPACE_C99 #endif #if defined __USE_MISC || defined __USE_XOPEN /* Obsolete alias for `lgamma'. */ -__MATHCALL (gamma,, (_Mdouble_)); +__MATHCALLI (gamma,, (_Mdouble_)) #endif #ifdef __USE_MISC /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ -__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); +__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)) +/* __MATHCALLI does not work here, probably due to ,_r, */ +libm_hidden_proto(lgamma_r) #endif @@ -277,89 +314,91 @@ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); __BEGIN_NAMESPACE_C99 /* Return the integer nearest X in the direction of the prevailing rounding mode. */ -__MATHCALL (rint,, (_Mdouble_ __x)); +__MATHCALLI (rint,, (_Mdouble_ __x)) /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ -__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); +__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)) +# if defined _LIBC && defined _Mlong_double_ +libm_hidden_proto(nextafterl) +# endif # if defined __USE_ISOC99 && !defined __LDBL_COMPAT -__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); +__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)) # endif /* Return the remainder of integer divison X / Y with infinite precision. */ -__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (remainder,, (_Mdouble_ __x, _Mdouble_ __y)) # if defined __USE_MISC || defined __USE_ISOC99 /* Return X times (2 to the Nth power). */ -__MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); +__MATHCALLI (scalbn,, (_Mdouble_ __x, int __n)) # endif /* Return the binary exponent of X, which must be nonzero. */ -__MATHDECL (int,ilogb,, (_Mdouble_ __x)); +__MATHDECLI (int,ilogb,, (_Mdouble_ __x)) #endif #ifdef __USE_ISOC99 /* Return X times (2 to the Nth power). */ -__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); +__MATHCALLI (scalbln,, (_Mdouble_ __x, long int __n)) /* Round X to integral value in floating-point format using current rounding direction, but do not raise inexact exception. */ -__MATHCALL (nearbyint,, (_Mdouble_ __x)); +__MATHCALLI (nearbyint,, (_Mdouble_ __x)) /* Round X to nearest integral value, rounding halfway cases away from zero. */ -__MATHCALLX (round,, (_Mdouble_ __x), (__const__)); +__MATHCALLX (round,, (_Mdouble_ __x), (__const__)) /* Round X to the integral value in floating-point format nearest but not larger in magnitude. */ -__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); +__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)) /* Compute remainder of X and Y and put in *QUO a value with sign of x/y and magnitude congruent `mod 2^n' to the magnitude of the integral quotient x/y, with n >= 3. */ -__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); +__MATHCALLI (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)) /* Conversion functions. */ /* Round X to nearest integral value according to current rounding direction. */ -__MATHDECL (long int,lrint,, (_Mdouble_ __x)); -__MATHDECL (long long int,llrint,, (_Mdouble_ __x)); +__MATHDECLI (long int,lrint,, (_Mdouble_ __x)) +__MATHDECLI (long long int,llrint,, (_Mdouble_ __x)) /* Round X to nearest integral value, rounding halfway cases away from zero. */ -__MATHDECL (long int,lround,, (_Mdouble_ __x)); -__MATHDECL (long long int,llround,, (_Mdouble_ __x)); +__MATHDECLI (long int,lround,, (_Mdouble_ __x)) +__MATHDECLI (long long int,llround,, (_Mdouble_ __x)) /* Return positive difference between X and Y. */ -__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (fdim,, (_Mdouble_ __x, _Mdouble_ __y)) /* Return maximum numeric value from X and Y. */ -__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (fmax,, (_Mdouble_ __x, _Mdouble_ __y)) /* Return minimum numeric value from X and Y. */ -__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y)); +__MATHCALLI (fmin,, (_Mdouble_ __x, _Mdouble_ __y)) /* Classify given number. */ -__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) - __attribute__ ((__const__)); +__MATHDECL_PRIV (int, fpclassify,, (_Mdouble_ __value), (__const__)) /* Test for negative number. */ -__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) - __attribute__ ((__const__)); +__MATHDECL_PRIV (int, signbit,, (_Mdouble_ __value), (__const__)) /* Multiply-add function computed as a ternary operation. */ -__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); +__MATHCALLI (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)) #endif /* Use ISO C99. */ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __END_NAMESPACE_C99 #endif -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \ + && defined __UCLIBC_SUSV3_LEGACY__ /* Return X times (2 to the Nth power). */ -__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); +__MATHCALLI (scalb,, (_Mdouble_ __x, _Mdouble_ __n)) #endif diff --git a/libc/sysdeps/linux/common/bits/mathdef.h b/libc/sysdeps/linux/common/bits/mathdef.h index 00c67241a..ddcf6d40b 100644 --- a/libc/sysdeps/linux/common/bits/mathdef.h +++ b/libc/sysdeps/linux/common/bits/mathdef.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _MATH_H && !defined _COMPLEX_H # error "Never use <bits/mathdef.h> directly; include <math.h> instead" diff --git a/libc/sysdeps/linux/common/bits/mathinline.h b/libc/sysdeps/linux/common/bits/mathinline.h index 5498af6b6..02ec21b43 100644 --- a/libc/sysdeps/linux/common/bits/mathinline.h +++ b/libc/sysdeps/linux/common/bits/mathinline.h @@ -1,6 +1,6 @@ /* This file should provide inline versions of math functions. - Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'. + Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. This file should define __MATH_INLINES if functions are actually defined as inlines. */ diff --git a/libc/sysdeps/linux/common/bits/mman-common.h b/libc/sysdeps/linux/common/bits/mman-common.h new file mode 100644 index 000000000..6cde5daa3 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/mman-common.h @@ -0,0 +1,108 @@ +/* Definitions for POSIX memory map interface. Linux/generic version. + Copyright (C) 1997,2000,2003,2005,2006,2009 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could + be uninitialized. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ +# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HWPOISON 100 /* Poison a page for testing. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/libc/sysdeps/linux/common/bits/mman.h b/libc/sysdeps/linux/common/bits/mman.h index 0c1590270..11b8e2a8b 100644 --- a/libc/sysdeps/linux/common/bits/mman.h +++ b/libc/sysdeps/linux/common/bits/mman.h @@ -1,97 +1 @@ -/* Definitions for BSD-style memory management. - Copyright (C) 1994-1998,2000,01,02,05 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. */ - -/* These are the bits used by 4.4 BSD and its derivatives. On systems - (such as GNU) where these facilities are not system services but can be - emulated in the C library, these are the definitions we emulate. */ - -#ifndef _SYS_MMAN_H -# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." -#endif - -/* Protections are chosen from these bits, OR'd together. The - implementation does not necessarily support PROT_EXEC or PROT_WRITE - without PROT_READ. The only guarantees are that no writing will be - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ - -#define PROT_NONE 0x00 /* No access. */ -#define PROT_READ 0x04 /* Pages can be read. */ -#define PROT_WRITE 0x02 /* Pages can be written. */ -#define PROT_EXEC 0x01 /* Pages can be executed. */ - -/* Flags contain mapping type, sharing type and options. */ - -/* Mapping type (must choose one and only one of these). */ -#ifdef __USE_BSD -# define MAP_FILE 0x0001 /* Mapped from a file or device. */ -# define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */ -# define MAP_TYPE 0x000f /* Mask for type field. */ -# ifdef __USE_MISC -# define MAP_ANONYMOUS MAP_ANON /* Linux name. */ -# endif -#endif - -/* Sharing types (must choose one and only one of these). */ -#ifdef __USE_BSD -# define MAP_COPY 0x0020 /* Virtual copy of region at mapping time. */ -#endif -#define MAP_SHARED 0x0010 /* Share changes. */ -#define MAP_PRIVATE 0x0000 /* Changes private; copy pages on write. */ - -/* Other flags. */ -#define MAP_FIXED 0x0100 /* Map address must be exactly as requested. */ -#ifdef __USE_BSD -# define MAP_NOEXTEND 0x0200 /* For MAP_FILE, don't change file size. */ -# define MAP_HASSEMPHORE 0x0400 /* Region may contain semaphores. */ -# define MAP_INHERIT 0x0800 /* Region is retained after exec. */ -#endif - -/* Advice to `madvise'. */ -#ifdef __USE_BSD -# define MADV_NORMAL 0 /* No further special treatment. */ -# define MADV_RANDOM 1 /* Expect random page references. */ -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define MADV_WILLNEED 3 /* Will need these pages. */ -# define MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - -/* The POSIX people had to invent similar names for the same things. */ -#ifdef __USE_XOPEN2K -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - -/* Flags to `msync'. */ -#define MS_ASYNC 1 /* Sync memory asynchronously. */ -#define MS_SYNC 0 /* Synchronous memory sync. */ -#define MS_INVALIDATE 2 /* Invalidate the caches. */ - -/* Flags for `mremap'. */ -#ifdef __USE_GNU -# define MREMAP_MAYMOVE 1 /* Mapping address may change. */ -# define MREMAP_FIXED 2 /* Fifth argument sets new address. */ -#endif - -/* Flags for `mlockall' (can be OR'd together). */ -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ -#define MCL_FUTURE 2 /* Lock all additions to address - space. */ +#include <bits/mman-common.h> diff --git a/libc/sysdeps/linux/common/bits/mqueue.h b/libc/sysdeps/linux/common/bits/mqueue.h index df528f876..e755f8722 100644 --- a/libc/sysdeps/linux/common/bits/mqueue.h +++ b/libc/sysdeps/linux/common/bits/mqueue.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MQUEUE_H # error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead." diff --git a/libc/sysdeps/linux/common/bits/msq.h b/libc/sysdeps/linux/common/bits/msq.h index 32a49b592..a1c3ea43d 100644 --- a/libc/sysdeps/linux/common/bits/msq.h +++ b/libc/sysdeps/linux/common/bits/msq.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MSG_H # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." diff --git a/libc/sysdeps/linux/common/bits/nan.h b/libc/sysdeps/linux/common/bits/nan.h index bae97f216..00cb405f1 100644 --- a/libc/sysdeps/linux/common/bits/nan.h +++ b/libc/sysdeps/linux/common/bits/nan.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/nan.h> directly; include <math.h> instead." diff --git a/libc/sysdeps/linux/common/bits/netdb.h b/libc/sysdeps/linux/common/bits/netdb.h index 41dc73193..0205056b8 100644 --- a/libc/sysdeps/linux/common/bits/netdb.h +++ b/libc/sysdeps/linux/common/bits/netdb.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _NETDB_H # error "Never include <bits/netdb.h> directly; use <netdb.h> instead." diff --git a/libc/sysdeps/linux/common/bits/poll.h b/libc/sysdeps/linux/common/bits/poll.h index d7996b46c..21d6cf28a 100644 --- a/libc/sysdeps/linux/common/bits/poll.h +++ b/libc/sysdeps/linux/common/bits/poll.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." diff --git a/libc/sysdeps/linux/common/bits/posix1_lim.h b/libc/sysdeps/linux/common/bits/posix1_lim.h index 3c86dcec1..0186d1311 100644 --- a/libc/sysdeps/linux/common/bits/posix1_lim.h +++ b/libc/sysdeps/linux/common/bits/posix1_lim.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.9.2 Minimum Values Added to <limits.h> diff --git a/libc/sysdeps/linux/common/bits/posix2_lim.h b/libc/sysdeps/linux/common/bits/posix2_lim.h index 24483a09d..cd3718826 100644 --- a/libc/sysdeps/linux/common/bits/posix2_lim.h +++ b/libc/sysdeps/linux/common/bits/posix2_lim.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; include <limits.h> instead. diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h index dfe259b7c..e3d32a0bc 100644 --- a/libc/sysdeps/linux/common/bits/posix_opt.h +++ b/libc/sysdeps/linux/common/bits/posix_opt.h @@ -1,5 +1,5 @@ /* Define POSIX options for Linux. - Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2006, 2008, 2009 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 @@ -13,12 +13,11 @@ 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ -#ifndef _POSIX_OPT_H -#define _POSIX_OPT_H 1 +#ifndef _BITS_POSIX_OPT_H +#define _BITS_POSIX_OPT_H 1 /* Job control is supported. */ #define _POSIX_JOB_CONTROL 1 @@ -27,28 +26,28 @@ #define _POSIX_SAVED_IDS 1 /* Priority scheduling is supported. */ -#define _POSIX_PRIORITY_SCHEDULING 200112L +#define _POSIX_PRIORITY_SCHEDULING 200809L /* Synchronizing file data is supported. */ -#define _POSIX_SYNCHRONIZED_IO 200112L +#define _POSIX_SYNCHRONIZED_IO 200809L /* The fsync function is present. */ -#define _POSIX_FSYNC 200112L +#define _POSIX_FSYNC 200809L /* Mapping of files to memory is supported. */ -#define _POSIX_MAPPED_FILES 200112L +#define _POSIX_MAPPED_FILES 200809L /* Locking of all memory is supported. */ -#define _POSIX_MEMLOCK 200112L +#define _POSIX_MEMLOCK 200809L /* Locking of ranges of memory is supported. */ -#define _POSIX_MEMLOCK_RANGE 200112L +#define _POSIX_MEMLOCK_RANGE 200809L /* Setting of memory protections is supported. */ -#define _POSIX_MEMORY_PROTECTION 200112L +#define _POSIX_MEMORY_PROTECTION 200809L -/* Only root can change owner of file. */ -#define _POSIX_CHOWN_RESTRICTED 1 +/* Some filesystems allow all users to change file ownership. */ +#define _POSIX_CHOWN_RESTRICTED 0 /* `c_cc' member of 'struct termios' structure can be disabled by using the value _POSIX_VDISABLE. */ @@ -60,51 +59,67 @@ /* X/Open realtime support is available. */ #define _XOPEN_REALTIME 1 +/* X/Open thread realtime support is available. */ +#define _XOPEN_REALTIME_THREADS 1 + /* XPG4.2 shared memory is supported. */ #define _XOPEN_SHM 1 /* Tell we have POSIX threads. */ -#define _POSIX_THREADS 200112L +#define _POSIX_THREADS 200809L /* We have the reentrant functions described in POSIX. */ #define _POSIX_REENTRANT_FUNCTIONS 1 -#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L +#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L /* We provide priority scheduling for threads. */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L /* We support user-defined stack sizes. */ -#define _POSIX_THREAD_ATTR_STACKSIZE 200112L +#define _POSIX_THREAD_ATTR_STACKSIZE 200809L /* We support user-defined stacks. */ -#define _POSIX_THREAD_ATTR_STACKADDR 200112L +#define _POSIX_THREAD_ATTR_STACKADDR 200809L + +/* We support priority inheritence. */ +#define _POSIX_THREAD_PRIO_INHERIT 200809L + +/* We support priority protection, though only for non-robust + mutexes. */ +#define _POSIX_THREAD_PRIO_PROTECT 200809L + +#ifdef __USE_XOPEN2K8 +/* We support priority inheritence for robust mutexes. */ +# define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L + +/* We do not support priority protection for robust mutexes. */ +# define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1 +#endif /* We support POSIX.1b semaphores. */ -#define _POSIX_SEMAPHORES 200112L +#define _POSIX_SEMAPHORES 200809L /* Real-time signals are supported. */ -#define _POSIX_REALTIME_SIGNALS 200112L +#define _POSIX_REALTIME_SIGNALS 200809L /* We support asynchronous I/O. */ -#define _POSIX_ASYNCHRONOUS_IO 200112L +#define _POSIX_ASYNCHRONOUS_IO 200809L #define _POSIX_ASYNC_IO 1 /* Alternative name for Unix98. */ #define _LFS_ASYNCHRONOUS_IO 1 /* Support for prioritization is also available. */ -#define _POSIX_PRIORITIZED_IO 200112L +#define _POSIX_PRIORITIZED_IO 200809L /* The LFS support in asynchronous I/O is also available. */ #define _LFS64_ASYNCHRONOUS_IO 1 -#ifdef __UCLIBC_HAS_LFS__ /* The rest of the LFS is also available. */ #define _LFS_LARGEFILE 1 #define _LFS64_LARGEFILE 1 #define _LFS64_STDIO 1 -#endif /* POSIX shared memory objects are implemented. */ -#define _POSIX_SHARED_MEMORY_OBJECTS 200112L +#define _POSIX_SHARED_MEMORY_OBJECTS 200809L /* CPU-time clocks support needs to be checked at runtime. */ #define _POSIX_CPUTIME 0 @@ -116,49 +131,49 @@ #define _POSIX_REGEXP 1 /* Reader/Writer locks are available. */ -#define _POSIX_READER_WRITER_LOCKS 200112L +#define _POSIX_READER_WRITER_LOCKS 200809L /* We have a POSIX shell. */ #define _POSIX_SHELL 1 /* We support the Timeouts option. */ -#define _POSIX_TIMEOUTS 200112L +#define _POSIX_TIMEOUTS 200809L /* We support spinlocks. */ -#define _POSIX_SPIN_LOCKS 200112L +#define _POSIX_SPIN_LOCKS 200809L /* The `spawn' function family is supported. */ -#define _POSIX_SPAWN 200112L +#define _POSIX_SPAWN 200809L /* We have POSIX timers. */ -#define _POSIX_TIMERS 200112L +#define _POSIX_TIMERS 200809L /* The barrier functions are available. */ -#define _POSIX_BARRIERS 200112L +#define _POSIX_BARRIERS 200809L /* POSIX message queues are available. */ -#define _POSIX_MESSAGE_PASSING 200112L +#define _POSIX_MESSAGE_PASSING 200809L /* Thread process-shared synchronization is supported. */ -#define _POSIX_THREAD_PROCESS_SHARED 200112L +#define _POSIX_THREAD_PROCESS_SHARED 200809L /* The monotonic clock might be available. */ #define _POSIX_MONOTONIC_CLOCK 0 /* The clock selection interfaces are available. */ -#define _POSIX_CLOCK_SELECTION 200112L +#define _POSIX_CLOCK_SELECTION 200809L /* Advisory information interfaces are available. */ -#define _POSIX_ADVISORY_INFO 200112L +#define _POSIX_ADVISORY_INFO 200809L /* IPv6 support is available. */ -#define _POSIX_IPV6 200112L +#define _POSIX_IPV6 200809L /* Raw socket support is available. */ -#define _POSIX_RAW_SOCKETS 200112L +#define _POSIX_RAW_SOCKETS 200809L /* We have at least one terminal. */ -#define _POSIX2_CHAR_TERM 200112L +#define _POSIX2_CHAR_TERM 200809L /* Neither process nor thread sporadic server interfaces is available. */ #define _POSIX_SPORADIC_SERVER -1 @@ -173,8 +188,4 @@ /* Typed memory objects are not available. */ #define _POSIX_TYPED_MEMORY_OBJECTS -1 -/* No support for priority inheritance or protection so far. */ -#define _POSIX_THREAD_PRIO_INHERIT -1 -#define _POSIX_THREAD_PRIO_PROTECT -1 - -#endif /* posix_opt.h */ +#endif /* bits/posix_opt.h */ diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h index 526cdaf53..df0ba56d9 100644 --- a/libc/sysdeps/linux/common/bits/resource.h +++ b/libc/sysdeps/linux/common/bits/resource.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RESOURCE_H # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." diff --git a/libc/sysdeps/linux/common/bits/sched.h b/libc/sysdeps/linux/common/bits/sched.h index b48a0c874..9d05314f5 100644 --- a/libc/sysdeps/linux/common/bits/sched.h +++ b/libc/sysdeps/linux/common/bits/sched.h @@ -1,6 +1,6 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996-1999,2001-2003,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1996-2015 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 @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef __need_schedparam @@ -26,14 +25,17 @@ /* Scheduling algorithms. */ -#define SCHED_OTHER 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 #ifdef __USE_GNU -# define SCHED_BATCH 3 +# define SCHED_BATCH 3 +# define SCHED_IDLE 5 + +# define SCHED_RESET_ON_FORK 0x40000000 #endif -#ifdef __USE_MISC +#ifdef __USE_GNU /* Cloning flags. */ # define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ # define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ @@ -58,7 +60,12 @@ force CLONE_PTRACE on this clone. */ # define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in the child. */ -# define CLONE_STOPPED 0x02000000 /* Start in stopped state. */ +# define CLONE_NEWUTS 0x04000000 /* New utsname group. */ +# define CLONE_NEWIPC 0x08000000 /* New ipcs. */ +# define CLONE_NEWUSER 0x10000000 /* New user namespace. */ +# define CLONE_NEWPID 0x20000000 /* New pid namespace. */ +# define CLONE_NEWNET 0x40000000 /* New network namespace. */ +# define CLONE_IO 0x80000000 /* Clone I/O context. */ #endif /* The official definition. */ @@ -69,16 +76,21 @@ struct sched_param __BEGIN_DECLS -#ifdef __USE_MISC +#ifdef __USE_GNU /* Clone current process. */ extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) __THROW; -#if 0 /* Unshare the specified resources. */ extern int unshare (int __flags) __THROW; + +/* Get index of currently used CPU. */ +extern int sched_getcpu (void) __THROW; + +/* Switch process to namespace of type NSTYPE indicated by FD. */ +extern int setns (int __fd, int __nstype) __THROW; #endif -#endif + __END_DECLS @@ -101,8 +113,9 @@ struct __sched_param /* Size definition for CPU sets. */ # define __CPU_SETSIZE 1024 # define __NCPUBITS (8 * sizeof (__cpu_mask)) +# include <stdlib.h> -/* Type for array elements in 'cpu_set'. */ +/* Type for array elements in 'cpu_set_t'. */ typedef unsigned long int __cpu_mask; /* Basic access functions. */ @@ -116,17 +129,87 @@ typedef struct } cpu_set_t; /* Access functions for CPU masks. */ -# define __CPU_ZERO(cpusetp) \ +# if __GNUC_PREREQ (2, 91) +# define __CPU_ZERO_S(setsize, cpusetp) \ + do __builtin_memset (cpusetp, '\0', setsize); while (0) +# else +# define __CPU_ZERO_S(setsize, cpusetp) \ do { \ - unsigned int __i; \ - cpu_set_t *__arr = (cpusetp); \ - for (__i = 0; __i < sizeof (cpu_set_t) / sizeof (__cpu_mask); ++__i) \ - __arr->__bits[__i] = 0; \ + size_t __i; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + __cpu_mask *__bits = (cpusetp)->__bits; \ + for (__i = 0; __i < __imax; ++__i) \ + __bits[__i] = 0; \ } while (0) -# define __CPU_SET(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu)) -# define __CPU_CLR(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) -# define __CPU_ISSET(cpu, cpusetp) \ - (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) +# endif +# define __CPU_SET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + |= __CPUMASK (__cpu)) \ + : 0; })) +# define __CPU_CLR_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + &= ~__CPUMASK (__cpu)) \ + : 0; })) +# define __CPU_ISSET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + & __CPUMASK (__cpu))) != 0 \ + : 0; })) + +# define __CPU_COUNT_S(setsize, cpusetp) \ + __sched_cpucount (setsize, cpusetp) + +# if __GNUC_PREREQ (2, 91) +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) +# else +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__extension__ \ + ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ + const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + if (__arr1[__i] != __arr2[__i]) \ + break; \ + __i == __imax; })) +# endif + +# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ + (__extension__ \ + ({ cpu_set_t *__dest = (destset); \ + const __cpu_mask *__arr1 = (srcset1)->__bits; \ + const __cpu_mask *__arr2 = (srcset2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ + __dest; })) + +# define __CPU_ALLOC_SIZE(count) \ + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) +# define __CPU_ALLOC(count) __sched_cpualloc (count) +# define __CPU_FREE(cpuset) __sched_cpufree (cpuset) + +__BEGIN_DECLS + +extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) + __THROW; +#if 0 /* in uClibc we use macros */ +extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; +extern void __sched_cpufree (cpu_set_t *__set) __THROW; +#else +# define __sched_cpualloc(cnt) ((cpu_set_t *)malloc(__CPU_ALLOC_SIZE(cnt))) +# define __sched_cpufree(__set) free(__set) +#endif +__END_DECLS + #endif diff --git a/libc/sysdeps/linux/common/bits/select.h b/libc/sysdeps/linux/common/bits/select.h index 47e7dedc3..6a6188353 100644 --- a/libc/sysdeps/linux/common/bits/select.h +++ b/libc/sysdeps/linux/common/bits/select.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SELECT_H # error "Never use <bits/select.h> directly; include <sys/select.h> instead." diff --git a/libc/sysdeps/linux/common/bits/sem.h b/libc/sysdeps/linux/common/bits/sem.h index 6193501e2..501e0803b 100644 --- a/libc/sysdeps/linux/common/bits/sem.h +++ b/libc/sysdeps/linux/common/bits/sem.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SEM_H # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." diff --git a/libc/sysdeps/linux/common/bits/shm.h b/libc/sysdeps/linux/common/bits/shm.h index 318d601ae..88bf7a8aa 100644 --- a/libc/sysdeps/linux/common/bits/shm.h +++ b/libc/sysdeps/linux/common/bits/shm.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." @@ -66,8 +65,8 @@ struct shmid_ds #ifdef __USE_MISC /* ipcs ctl commands */ -# define SHM_STAT 13 -# define SHM_INFO 14 +# define SHM_STAT 13 +# define SHM_INFO 14 /* shm_mode upper byte flags */ # define SHM_DEST 01000 /* segment will be destroyed on last detach */ diff --git a/libc/sysdeps/linux/common/bits/sigaction.h b/libc/sysdeps/linux/common/bits/sigaction.h index 48cc5312f..08510223f 100644 --- a/libc/sysdeps/linux/common/bits/sigaction.h +++ b/libc/sysdeps/linux/common/bits/sigaction.h @@ -13,42 +13,33 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SIGNAL_H # error "Never include <bits/sigaction.h> directly; use <signal.h> instead." #endif -/* Structure describing the action to be taken when a signal arrives. */ -struct sigaction - { - /* Signal handler. */ +/* Structure describing the action to be taken when a signal arrives. + * In uclibc, it is identical to "new" struct kernel_sigaction + * (one from the Linux 2.1.68 kernel). + * This minimizes amount of translation in sigaction(). + */ +struct sigaction { #ifdef __USE_POSIX199309 - union - { - /* Used if SA_SIGINFO is not set. */ - __sighandler_t sa_handler; - /* Used if SA_SIGINFO is set. */ - void (*sa_sigaction) (int, siginfo_t *, void *); - } - __sigaction_handler; -# define sa_handler __sigaction_handler.sa_handler -# define sa_sigaction __sigaction_handler.sa_sigaction + union { + __sighandler_t sa_handler; + void (*sa_sigaction)(int, siginfo_t *, void *); + } __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction #else - __sighandler_t sa_handler; + __sighandler_t sa_handler; #endif - - /* Additional set of signals to be blocked. */ - __sigset_t sa_mask; - - /* Special flags. */ - int sa_flags; - - /* Restore handler. */ - void (*sa_restorer) (void); - }; + unsigned long sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; +}; /* Bits in `sa_flags'. */ #define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */ diff --git a/libc/sysdeps/linux/common/bits/sigcontext.h b/libc/sysdeps/linux/common/bits/sigcontext.h index 67dcf9498..8d4fd578f 100644 --- a/libc/sysdeps/linux/common/bits/sigcontext.h +++ b/libc/sysdeps/linux/common/bits/sigcontext.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." @@ -25,5 +24,8 @@ we need sigcontext. */ # define sigcontext_struct sigcontext +# ifndef __user +# define __user +# endif # include <asm/sigcontext.h> #endif diff --git a/libc/sysdeps/linux/common/bits/sigcontextinfo.h b/libc/sysdeps/linux/common/bits/sigcontextinfo.h index 40305b488..40df940b2 100644 --- a/libc/sysdeps/linux/common/bits/sigcontextinfo.h +++ b/libc/sysdeps/linux/common/bits/sigcontextinfo.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* In general we cannot provide any information. */ #define SIGCONTEXT struct sigcontext * diff --git a/libc/sysdeps/linux/common/bits/siginfo.h b/libc/sysdeps/linux/common/bits/siginfo.h index 4ce319dc9..724f756cd 100644 --- a/libc/sysdeps/linux/common/bits/siginfo.h +++ b/libc/sysdeps/linux/common/bits/siginfo.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _SIGNAL_H && !defined __need_siginfo_t \ && !defined __need_sigevent_t @@ -104,6 +103,14 @@ typedef struct siginfo long int si_band; /* Band event for SIGPOLL. */ int si_fd; } _sigpoll; + + /* SIGSYS. */ + struct + { + void *_call_addr; /* Calling user insn. */ + int _syscall; /* Triggering system call number. */ + unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ + } _sigsys; } _sifields; } siginfo_t; @@ -122,6 +129,9 @@ typedef struct siginfo # define si_addr _sifields._sigfault.si_addr # define si_band _sifields._sigpoll.si_band # define si_fd _sifields._sigpoll.si_fd +# define si_call_addr _sifields._sigsys._call_addr +# define si_syscall _sifields._sigsys._syscall +# define si_arch _sifields._sigsys._arch /* Values for `si_code'. Positive values are reserved for kernel-generated diff --git a/libc/sysdeps/linux/common/bits/signalfd.h b/libc/sysdeps/linux/common/bits/signalfd.h new file mode 100644 index 000000000..f2c0dde2f --- /dev/null +++ b/libc/sysdeps/linux/common/bits/signalfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2007-2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_SIGNALFD_H +# error "Never use <bits/signalfd.h> directly; include <sys/signalfd.h> instead." +#endif + +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 02000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 00004000 +#define SFD_NONBLOCK SFD_NONBLOCK + }; diff --git a/libc/sysdeps/linux/common/bits/signum.h b/libc/sysdeps/linux/common/bits/signum.h index a18ac113a..8a0f3d075 100644 --- a/libc/sysdeps/linux/common/bits/signum.h +++ b/libc/sysdeps/linux/common/bits/signum.h @@ -13,23 +13,11 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifdef _SIGNAL_H -/* Fake signal functions. */ -#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ -#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ -#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ - -#ifdef __USE_UNIX98 -# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ -#endif - - -/* Signals. */ #define SIGHUP 1 /* Hangup (POSIX). */ #define SIGINT 2 /* Interrupt (ANSI). */ #define SIGQUIT 3 /* Quit (POSIX). */ @@ -66,15 +54,4 @@ #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 -#define _NSIG 65 /* Biggest signal number + 1 - (including real-time signals). */ - -#define SIGRTMIN (__libc_current_sigrtmin ()) -#define SIGRTMAX (__libc_current_sigrtmax ()) - -/* These are the hard limits of the kernel. These values should not be - used directly at user level. */ -#define __SIGRTMIN 32 -#define __SIGRTMAX (_NSIG - 1) - #endif /* <signal.h> included. */ diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h index 7ccadda45..f220e8171 100644 --- a/libc/sysdeps/linux/common/bits/sigset.h +++ b/libc/sysdeps/linux/common/bits/sigset.h @@ -13,22 +13,32 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SIGSET_H_types # define _SIGSET_H_types 1 typedef int __sig_atomic_t; -/* A `sigset_t' has a bit for each signal. */ - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; +/* A 'sigset_t' has a bit for each signal. + * glibc has space for 1024 signals (!), but most arches supported + * by Linux have 64 signals, and only MIPS has 128. + * There seems to be some historical baggage in sparc[64] + * where they might have (or had in the past) 32 signals only, + * I hope it's irrelevant now. + * Signal 0 does not exist, so we have signals 1..64, not 0..63. + * In uclibc, kernel and userspace sigset_t is always the same. + * BTW, struct sigaction is also the same on kernel and userspace side. + */ +#if defined(__mips__) +# define _SIGSET_NWORDS (128 / (8 * sizeof (unsigned long))) +#else +# define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long))) +#endif +typedef struct { + unsigned long __val[_SIGSET_NWORDS]; +} __sigset_t; #endif @@ -42,84 +52,172 @@ typedef struct #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1 -# ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline -# endif - /* Return a mask that includes the bit for SIG only. */ +/* Unsigned cast ensures shift/mask insns are used. */ # define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) + (((unsigned long) 1) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long)))) /* Return the word index for SIG. */ -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) +# define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long))) + +/* gcc 4.3.1 is not clever enough to optimize for _SIGSET_NWORDS == 1 and 2, + * which are about the only values which can be there */ # if defined __GNUC__ && __GNUC__ >= 2 # define __sigemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = 0; \ - 0; })) +(__extension__ ({ \ + sigset_t *__set = (set); \ + if (_SIGSET_NWORDS <= 2) { \ + __set->__val[0] = 0; \ + if (_SIGSET_NWORDS == 2) \ + __set->__val[1] = 0; \ + } else { \ + int __cnt = _SIGSET_NWORDS; \ + while (--__cnt >= 0) __set->__val[__cnt] = 0; \ + } \ + 0; \ +})) # define __sigfillset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ - 0; })) +(__extension__ ({ \ + sigset_t *__set = (set); \ + if (_SIGSET_NWORDS <= 2) { \ + __set->__val[0] = ~0UL; \ + if (_SIGSET_NWORDS == 2) \ + __set->__val[1] = ~0UL; \ + } else { \ + int __cnt = _SIGSET_NWORDS; \ + while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ + } \ + 0; \ +})) # ifdef __USE_GNU /* The POSIX does not specify for handling the whole signal set in one command. This is often wanted and so we define three more functions here. */ # define __sigisemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - const sigset_t *__set = (set); \ - int __ret = __set->__val[--__cnt]; \ - while (!__ret && --__cnt >= 0) \ - __ret = __set->__val[__cnt]; \ - __ret == 0; })) +(__extension__ ({ \ + long __ret; \ + const sigset_t *__set = (set); \ + if (_SIGSET_NWORDS == 1) { \ + __ret = __set->__val[0]; \ + } else if (_SIGSET_NWORDS == 2) { \ + __ret = __set->__val[0] | __set->__val[1]; \ + } else { \ + int __cnt = _SIGSET_NWORDS; \ + __ret = __set->__val[--__cnt]; \ + while (!__ret && --__cnt >= 0) \ + __ret = __set->__val[__cnt]; \ + } \ + __ret == 0; \ +})) # define __sigandset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - & __right->__val[__cnt]); \ - 0; })) +(__extension__ ({ \ + sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + if (_SIGSET_NWORDS <= 2) { \ + __dest->__val[0] = __left->__val[0] & __right->__val[0];\ + if (_SIGSET_NWORDS == 2) \ + __dest->__val[1] = __left->__val[1] & __right->__val[1];\ + } else { \ + int __cnt = _SIGSET_NWORDS; \ + while (--__cnt >= 0) \ + __dest->__val[__cnt] = (__left->__val[__cnt] \ + & __right->__val[__cnt]); \ + } \ + 0; \ +})) # define __sigorset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - | __right->__val[__cnt]); \ - 0; })) +(__extension__ ({ \ + sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + if (_SIGSET_NWORDS <= 2) { \ + __dest->__val[0] = __left->__val[0] | __right->__val[0];\ + if (_SIGSET_NWORDS == 2) \ + __dest->__val[1] = __left->__val[1] | __right->__val[1];\ + } else { \ + int __cnt = _SIGSET_NWORDS; \ + while (--__cnt >= 0) \ + __dest->__val[__cnt] = (__left->__val[__cnt] \ + | __right->__val[__cnt]); \ + } \ + 0; \ +})) # endif # endif /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ -extern int __sigismember (__const __sigset_t *, int); -extern int __sigaddset (__sigset_t *, int); -extern int __sigdelset (__sigset_t *, int); +# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN +extern int __sigismember (const __sigset_t *, int); +libc_hidden_proto(__sigismember) +extern void __sigaddset (__sigset_t *, int); +libc_hidden_proto(__sigaddset) +extern void __sigdelset (__sigset_t *, int); +libc_hidden_proto(__sigdelset) +# endif # ifdef __USE_EXTERN_INLINES -# define __SIGSETFN(NAME, BODY, CONST) \ - _EXTERN_INLINE int \ - NAME (CONST __sigset_t *__set, int __sig) \ - { \ - unsigned long int __mask = __sigmask (__sig); \ - unsigned long int __word = __sigword (__sig); \ - return BODY; \ - } - -__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) -__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) -__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) +# undef _EXTERN_INLINE +# ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN +# define _EXTERN_INLINE +# else /* normal case */ + /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES + * will have its own copy of out-of line function emitted. */ +# define _EXTERN_INLINE /*extern*/ __always_inline +# endif +# define __SIGSETFN(RET_TYPE, NAME, BODY, CONST) \ +_EXTERN_INLINE RET_TYPE \ +NAME (CONST __sigset_t *__set, int __sig) \ +{ \ + unsigned long __mask = __sigmask (__sig); \ + unsigned __word = __sigword (__sig); \ + BODY; \ +} + +__SIGSETFN (int, __sigismember, return (__set->__val[__word] & __mask) ? 1 : 0, + const) +__SIGSETFN (void, __sigaddset, (__set->__val[__word] |= __mask), ) +__SIGSETFN (void, __sigdelset, (__set->__val[__word] &= ~__mask), ) # undef __SIGSETFN # endif +# ifdef _LIBC +/* It's far too much PITA to __USE_EXTERN_INLINES from within libc. + * Especially since we want to inline only calls with const sig, + * but __USE_EXTERN_INLINES will inline all calls! + */ +static __always_inline unsigned long +const_sigismember(const __sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + return (set->__val[word] & mask); +} +# define __sigismember(set, sig) \ + (__builtin_constant_p(sig) ? (const_sigismember(set, sig) != 0) : __sigismember(set, sig)) +static __always_inline void +const_sigaddset(__sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + set->__val[word] |= mask; +} +# define __sigaddset(set, sig) \ + (__builtin_constant_p(sig) ? const_sigaddset(set, sig) : __sigaddset(set, sig)) +static __always_inline void +const_sigdelset(__sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + set->__val[word] &= ~mask; +} +# define __sigdelset(set, sig) \ + (__builtin_constant_p(sig) ? const_sigdelset(set, sig) : __sigdelset(set, sig)) +# endif #endif /* ! _SIGSET_H_fns. */ diff --git a/libc/sysdeps/linux/common/bits/sigstack.h b/libc/sysdeps/linux/common/bits/sigstack.h index 7f260367b..ee25a6b32 100644 --- a/libc/sysdeps/linux/common/bits/sigstack.h +++ b/libc/sysdeps/linux/common/bits/sigstack.h @@ -13,21 +13,22 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SIGNAL_H # error "Never include this file directly. Use <signal.h> instead" #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h index 960bde18a..643618aa4 100644 --- a/libc/sysdeps/linux/common/bits/sigthread.h +++ b/libc/sysdeps/linux/common/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2009 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 @@ -13,9 +13,8 @@ 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGTHREAD_H #define _BITS_SIGTHREAD_H 1 @@ -29,10 +28,16 @@ /* Modify the signal mask for the calling thread. The arguments have the same meaning as for sigprocmask(2). */ extern int pthread_sigmask (int __how, - __const __sigset_t *__restrict __newmask, + const __sigset_t *__restrict __newmask, __sigset_t *__restrict __oldmask)__THROW; /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; +#if defined __USE_GNU && defined __UCLIBC_HAS_THREADS_NATIVE__ +/* Queue signal and data to a thread. */ +extern int pthread_sigqueue (pthread_t __threadid, int __signo, + const union sigval __value) __THROW; +#endif + #endif /* bits/sigthread.h */ diff --git a/libc/sysdeps/linux/common/bits/sockaddr.h b/libc/sysdeps/linux/common/bits/sockaddr.h index 3e1d1312d..066c3e935 100644 --- a/libc/sysdeps/linux/common/bits/sockaddr.h +++ b/libc/sysdeps/linux/common/bits/sockaddr.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/socket.h> instead. diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h index 2f3dc797b..4ea13111a 100644 --- a/libc/sysdeps/linux/common/bits/socket.h +++ b/libc/sysdeps/linux/common/bits/socket.h @@ -1,5 +1,6 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1994-2001,2004,2006-2012 + 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 @@ -13,19 +14,17 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef __BITS_SOCKET_H #define __BITS_SOCKET_H -#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H +#ifndef _SYS_SOCKET_H # error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." #endif #define __need_size_t -#define __need_NULL #include <stddef.h> #include <limits.h> @@ -37,27 +36,8 @@ typedef __socklen_t socklen_t; # define __socklen_t_defined #endif -/* Types of sockets. */ -enum __socket_type -{ - SOCK_STREAM = 1, /* Sequenced, reliable, connection-based - byte streams. */ -#define SOCK_STREAM SOCK_STREAM - SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams - of fixed maximum length. */ -#define SOCK_DGRAM SOCK_DGRAM - SOCK_RAW = 3, /* Raw protocol interface. */ -#define SOCK_RAW SOCK_RAW - SOCK_RDM = 4, /* Reliably-delivered messages. */ -#define SOCK_RDM SOCK_RDM - SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, - datagrams of fixed maximum length. */ -#define SOCK_SEQPACKET SOCK_SEQPACKET - SOCK_PACKET = 10 /* Linux specific way of getting packets - at the dev level. For writing rarp and - other similar things on the user level. */ -#define SOCK_PACKET SOCK_PACKET -}; +/* Get the architecture-dependent definition of enum __socket_type. */ +#include <bits/socket_type.h> /* Protocol families. */ #define PF_UNSPEC 0 /* Unspecified. */ @@ -84,12 +64,24 @@ enum __socket_type #define PF_ASH 18 /* Ash. */ #define PF_ECONET 19 /* Acorn Econet. */ #define PF_ATMSVC 20 /* ATM SVCs. */ +#define PF_RDS 21 /* RDS sockets. */ #define PF_SNA 22 /* Linux SNA Project */ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_NFC 39 /* NFC sockets. */ +#define PF_MAX 40 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -116,11 +108,23 @@ enum __socket_type #define AF_ASH PF_ASH #define AF_ECONET PF_ECONET #define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS #define AF_SNA PF_SNA #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. @@ -205,8 +209,14 @@ enum #define MSG_ERRQUEUE MSG_ERRQUEUE MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ #define MSG_NOSIGNAL MSG_NOSIGNAL - MSG_MORE = 0x8000 /* Sender will send more. */ + MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE + MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ +#define MSG_WAITFORONE MSG_WAITFORONE + MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file + descriptor received through + SCM_RIGHTS. */ +#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; @@ -260,7 +270,7 @@ struct cmsghdr #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ - ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) #define CMSG_SPACE(len) (CMSG_ALIGN (len) \ @@ -269,16 +279,17 @@ struct cmsghdr extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW; +libc_hidden_proto(__cmsg_nxthdr) #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ - return 0; + return (struct cmsghdr *) 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); @@ -287,10 +298,10 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ - return 0; + return (struct cmsghdr *) 0; return __cmsg; } -#endif /* Use `extern inline'. */ +#endif /* Use `__extern_inline'. */ /* Socket level message types. This must match the definitions in <linux/socket.h>. */ @@ -298,23 +309,30 @@ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS -#ifdef __USE_BSD +#ifdef __USE_GNU , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif }; +#ifdef __USE_GNU /* User visible structure for SCM_CREDENTIALS message */ - struct ucred { pid_t pid; /* PID of sending process. */ uid_t uid; /* UID of sending process. */ gid_t gid; /* GID of sending process. */ }; +#endif /* Get socket manipulation related informations from kernel headers. */ +#ifndef __GLIBC__ +#define __GLIBC__ 2 +#include <asm/socket.h> +#undef __GLIBC__ +#else #include <asm/socket.h> +#endif /* Structure used to manipulate the SO_LINGER option. */ diff --git a/libc/sysdeps/linux/common/bits/socket_type.h b/libc/sysdeps/linux/common/bits/socket_type.h new file mode 100644 index 000000000..65436b087 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/socket_type.h @@ -0,0 +1,54 @@ +/* Define enum __socket_type for generic Linux. + Copyright (C) 1991-2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_SOCKET_H +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead." +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ +#define SOCK_DCCP SOCK_DCCP + SOCK_PACKET = 10, /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair. */ + + SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 00004000 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK +}; diff --git a/libc/sysdeps/linux/common/bits/stab.def b/libc/sysdeps/linux/common/bits/stab.def index 3d54774cf..8a2b8f39d 100644 --- a/libc/sysdeps/linux/common/bits/stab.def +++ b/libc/sysdeps/linux/common/bits/stab.def @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* This contains contribution from Cygnus Support. */ diff --git a/libc/sysdeps/linux/common/bits/stackinfo.h b/libc/sysdeps/linux/common/bits/stackinfo.h index 1ed7b9503..1f996bea8 100644 --- a/libc/sysdeps/linux/common/bits/stackinfo.h +++ b/libc/sysdeps/linux/common/bits/stackinfo.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* This file contains a bit of information about the stack allocation of the processor. Since there is no general truth we can't say diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h index bd5aae267..19e2f4e13 100644 --- a/libc/sysdeps/linux/common/bits/stat.h +++ b/libc/sysdeps/linux/common/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2001, 2002, 2009 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 @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STAT_H # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." @@ -62,7 +61,7 @@ struct stat #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif -#if 0 /*def __USE_MISC*/ +#ifdef __USE_MISC /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -108,7 +107,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#if 0 /*def __USE_MISC*/ +#ifdef __USE_MISC /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -163,3 +162,8 @@ struct stat64 #define __S_IREAD 0400 /* Read by owner. */ #define __S_IWRITE 0200 /* Write by owner. */ #define __S_IEXEC 0100 /* Execute by owner. */ + +#ifdef __USE_ATFILE +# define UTIME_NOW ((1l << 30) - 1l) +# define UTIME_OMIT ((1l << 30) - 2l) +#endif diff --git a/libc/sysdeps/linux/common/bits/statfs.h b/libc/sysdeps/linux/common/bits/statfs.h index 0e27865e8..bb780a81e 100644 --- a/libc/sysdeps/linux/common/bits/statfs.h +++ b/libc/sysdeps/linux/common/bits/statfs.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATFS_H # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." diff --git a/libc/sysdeps/linux/common/bits/statvfs.h b/libc/sysdeps/linux/common/bits/statvfs.h index cca0871ac..4b3fc5733 100644 --- a/libc/sysdeps/linux/common/bits/statvfs.h +++ b/libc/sysdeps/linux/common/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2001,2002,2006 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 @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATVFS_H # error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead." @@ -101,7 +100,9 @@ enum # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME - ST_NODIRATIME = 2048 /* Do not update directory access times. */ + ST_NODIRATIME = 2048, /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME + ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ +# define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; diff --git a/libc/sysdeps/linux/common/bits/stdio.h b/libc/sysdeps/linux/common/bits/stdio.h index d0ba46308..9485857e8 100644 --- a/libc/sysdeps/linux/common/bits/stdio.h +++ b/libc/sysdeps/linux/common/bits/stdio.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/stdio.h> directly; use <stdio.h> instead." diff --git a/libc/sysdeps/linux/common/bits/stdio_lim.h b/libc/sysdeps/linux/common/bits/stdio_lim.h index c35ee601b..20b68a258 100644 --- a/libc/sysdeps/linux/common/bits/stdio_lim.h +++ b/libc/sysdeps/linux/common/bits/stdio_lim.h @@ -12,16 +12,17 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." #endif #ifdef _STDIO_H -# define L_tmpnam 20 +# ifdef __UCLIBC_SUSV4_LEGACY__ +# define L_tmpnam 20 +# endif # define TMP_MAX 238328 # define FILENAME_MAX 4095 diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h new file mode 100644 index 000000000..86fe26c50 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/syscalls-common.h @@ -0,0 +1,119 @@ +/* + * Common syscall type defines + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef _SYSCALLS_COMMON_H +#define _SYSCALLS_COMMON_H 1 + +#ifndef _SYSCALL_H +# error "Never use <bits/syscalls-common.h> directly; include <sys/syscall.h> instead." +#endif + +#ifndef SYS_ify +# define SYS_ify(syscall_name) (__NR_##syscall_name) +#endif + +#ifndef __ASSEMBLER__ + +#include <errno.h> + +#ifndef INTERNAL_SYSCALL_DECL +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +#endif +#ifndef INTERNAL_SYSCALL_ERROR_P +# define INTERNAL_SYSCALL_ERROR_P(val, err) ((unsigned long)val >= (unsigned long)(-4095)) +#endif +#ifndef INTERNAL_SYSCALL_ERRNO +# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#endif + +/* Define a macro which expands into the inline wrapper code for a system call */ +#ifndef INLINE_SYSCALL +# define INLINE_SYSCALL(name, nr, args...) INLINE_SYSCALL_NCS(__NR_##name, nr, args) +#endif +#ifndef INLINE_SYSCALL_NOERR +# define INLINE_SYSCALL_NOERR(name, nr, args...) INLINE_SYSCALL_NOERR_NCS(__NR_##name, nr, args) +#endif + +/* Just like INLINE_SYSCALL(), but take a non-constant syscall (NCS) argument */ +#ifndef INLINE_SYSCALL_NCS +# define INLINE_SYSCALL_NCS(num, nr, args...) \ +(__extension__ \ + ({ \ + INTERNAL_SYSCALL_DECL(__err); \ + (__extension__ \ + ({ \ + long __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \ + if (unlikely(INTERNAL_SYSCALL_ERROR_P(__res, __err))) { \ + __set_errno(INTERNAL_SYSCALL_ERRNO(__res, __err)); \ + __res = -1L; \ + } \ + __res; \ + }) \ + ); \ + }) \ +) +#endif +#ifndef INLINE_SYSCALL_NOERR_NCS +# define INLINE_SYSCALL_NOERR_NCS(num, nr, args...) \ +({ \ + INTERNAL_SYSCALL_DECL(__err); \ + long __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \ + __res; \ +}) +#endif + +/* No point in forcing people to implement both when they only need one */ +#ifndef INTERNAL_SYSCALL +# define INTERNAL_SYSCALL(name, err, nr, args...) INTERNAL_SYSCALL_NCS(__NR_##name, err, nr, args) +#endif + +#ifndef INTERNAL_SYSCALL_NCS +# error your port needs to define INTERNAL_SYSCALL_NCS in bits/syscalls.h +#endif + +#ifndef _syscall0 + +#define C_DECL_ARGS_0() void +#define C_DECL_ARGS_1(t, v) t v +#define C_DECL_ARGS_2(t, v, args...) t v, C_DECL_ARGS_1(args) +#define C_DECL_ARGS_3(t, v, args...) t v, C_DECL_ARGS_2(args) +#define C_DECL_ARGS_4(t, v, args...) t v, C_DECL_ARGS_3(args) +#define C_DECL_ARGS_5(t, v, args...) t v, C_DECL_ARGS_4(args) +#define C_DECL_ARGS_6(t, v, args...) t v, C_DECL_ARGS_5(args) + +#define C_ARGS_0() +#define C_ARGS_1(t, v) v +#define C_ARGS_2(t, v, args...) v, C_ARGS_1(args) +#define C_ARGS_3(t, v, args...) v, C_ARGS_2(args) +#define C_ARGS_4(t, v, args...) v, C_ARGS_3(args) +#define C_ARGS_5(t, v, args...) v, C_ARGS_4(args) +#define C_ARGS_6(t, v, args...) v, C_ARGS_5(args) + +#define SYSCALL_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define _syscall0(args...) SYSCALL_FUNC(0, args) +#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args) +#define _syscall1(args...) SYSCALL_FUNC(1, args) +#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) +#define _syscall2(args...) SYSCALL_FUNC(2, args) +#define _syscall3(args...) SYSCALL_FUNC(3, args) +#define _syscall4(args...) SYSCALL_FUNC(4, args) +#define _syscall5(args...) SYSCALL_FUNC(5, args) +#define _syscall6(args...) SYSCALL_FUNC(6, args) + +#endif /* _syscall0 */ + +#endif /* __ASSEMBLER__ */ + +#endif diff --git a/libc/sysdeps/linux/common/bits/syscalls.h b/libc/sysdeps/linux/common/bits/syscalls.h index ceba568e5..03d08d1d3 100644 --- a/libc/sysdeps/linux/common/bits/syscalls.h +++ b/libc/sysdeps/linux/common/bits/syscalls.h @@ -5,4 +5,5 @@ * forbidden. Don't do it. It is bad for you. */ -#error You have not provided architecture specific _syscall[0-6] macros +#error You have not provided architecture specific bits/syscalls.h +#error You should need to define only INTERNAL_SYSCALL_NCS diff --git a/libc/sysdeps/linux/common/bits/termios.h b/libc/sysdeps/linux/common/bits/termios.h index b648d8000..10f089949 100644 --- a/libc/sysdeps/linux/common/bits/termios.h +++ b/libc/sysdeps/linux/common/bits/termios.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _TERMIOS_H # error "Never include <bits/termios.h> directly; use <termios.h> instead." diff --git a/libc/sysdeps/linux/common/bits/time.h b/libc/sysdeps/linux/common/bits/time.h index 7ed54bfa7..c4269ae47 100644 --- a/libc/sysdeps/linux/common/bits/time.h +++ b/libc/sysdeps/linux/common/bits/time.h @@ -1,5 +1,5 @@ -/* System-dependent timing definitions. Generic version. - Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc. +/* System-dependent timing definitions. Linux version. + Copyright (C) 1996-2014 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 @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <time.h> instead. @@ -54,6 +53,18 @@ # define CLOCK_PROCESS_CPUTIME_ID 2 /* Thread-specific CPU-time clock. */ # define CLOCK_THREAD_CPUTIME_ID 3 +/* Monotonic system-wide clock, not adjusted for frequency scaling. */ +# define CLOCK_MONOTONIC_RAW 4 +/* Identifier for system-wide realtime clock, updated only on ticks. */ +# define CLOCK_REALTIME_COARSE 5 +/* Monotonic system-wide clock, updated only on ticks. */ +# define CLOCK_MONOTONIC_COARSE 6 +/* Monotonic system-wide clock that includes time spent in suspension. */ +# define CLOCK_BOOTTIME 7 +/* Like CLOCK_REALTIME but also wakes suspended system. */ +# define CLOCK_REALTIME_ALARM 8 +/* Like CLOCK_BOOTTIME but also wakes suspended system. */ +# define CLOCK_BOOTTIME_ALARM 9 /* Flag to indicate time is absolute. */ # define TIMER_ABSTIME 1 diff --git a/libc/sysdeps/linux/common/bits/timerfd.h b/libc/sysdeps/linux/common/bits/timerfd.h new file mode 100644 index 000000000..93e8c76fb --- /dev/null +++ b/libc/sysdeps/linux/common/bits/timerfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2008-2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_TIMERFD_H +# error "Never use <bits/timerfd.h> directly; include <sys/timerfd.h> instead." +#endif + +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 02000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 00004000 +#define TFD_NONBLOCK TFD_NONBLOCK + }; diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index 755af2ec9..9d72d45e3 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -1,5 +1,5 @@ /* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007 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 @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/types.h> instead. @@ -27,9 +26,9 @@ #include <features.h> #include <bits/wordsize.h> -#define __need_size_t -#include <stddef.h> +#ifdef _LIBC #include <bits/kernel_types.h> +#endif /* Convenience types. */ typedef unsigned char __u_char; @@ -47,7 +46,7 @@ typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif @@ -56,7 +55,7 @@ __extension__ typedef unsigned long long int __uint64_t; #if __WORDSIZE == 64 typedef long int __quad_t; typedef unsigned long int __u_quad_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #else @@ -130,7 +129,7 @@ typedef struct /* No need to mark the typedef with __extension__. */ # define __STD_TYPE typedef #else -# error +# error your machine is neither 32 bit or 64 bit ... it must be magical #endif #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */ @@ -189,6 +188,10 @@ typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ typedef __quad_t *__qaddr_t; typedef char *__caddr_t; +/* Used in XTI. */ +typedef long int __t_scalar_t; +typedef unsigned long int __t_uscalar_t; + /* Duplicates info from stdint.h but this is used in unistd.h. */ __STD_TYPE __SWORD_TYPE __intptr_t; @@ -198,12 +201,4 @@ __STD_TYPE __U32_TYPE __socklen_t; #undef __STD_TYPE -/* Used in `struct shmid_ds'. */ -typedef __kernel_ipc_pid_t __ipc_pid_t; - -/* Now add the thread types. */ -#if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98) -# include <bits/pthreadtypes.h> -#endif - #endif /* bits/types.h */ diff --git a/libc/sysdeps/linux/common/bits/typesizes.h b/libc/sysdeps/linux/common/bits/typesizes.h index e9226c417..e1c5a27bb 100644 --- a/libc/sysdeps/linux/common/bits/typesizes.h +++ b/libc/sysdeps/linux/common/bits/typesizes.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES_H # error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." diff --git a/libc/sysdeps/linux/common/bits/uClibc_alloc.h b/libc/sysdeps/linux/common/bits/uClibc_alloc.h new file mode 100644 index 000000000..6a70d27b7 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/uClibc_alloc.h @@ -0,0 +1,26 @@ +/* + * Macros to transparently switch between the stack and heap for large + * allocations. The former is useful on MMU systems as it results in + * smaller code, but the latter is required on NoMMU systems. This is + * due to small stacks that cannot grow and so doing large allocs will + * cause a stack overflow. + * + * Copyright (C) 2010 Mike Frysinger <vapier@gentoo.org> + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef _UCLIBC_ALLOC_H +#define _UCLIBC_ALLOC_H + +#include <alloca.h> +#include <stdlib.h> + +#ifdef __ARCH_USE_MMU__ +# define stack_heap_alloc(x) alloca(x) +# define stack_heap_free(x) do { if (0) free(x); } while (0) +#else +# define stack_heap_alloc(x) malloc(x) +# define stack_heap_free(x) free(x) +#endif + +#endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h index 66186edbb..37c7ceb60 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h @@ -14,8 +14,8 @@ /* can your target use syscall6() for mmap ? */ #undef __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use syscall4() for truncate64 ? (32bit arches only) */ -#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ +/* does your target align 64bit values in register pairs ? (32bit arches only) */ +#undef __UCLIBC_SYSCALL_ALIGN_64BIT__ /* does your target have a broken create_module() ? */ #undef __UCLIBC_BROKEN_CREATE_MODULE__ @@ -26,19 +26,19 @@ /* does your target have an asm .set ? */ #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ -/* define if target doesn't like .global */ -#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ - /* define if target supports .weak */ #define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ /* define if target supports .weakext */ #undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ -/* needed probably only for ppc64 */ -#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ +/* define if target supports CFI pseudo ops */ +#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ /* define if target supports IEEE signed zero floats */ #define __UCLIBC_HAVE_SIGNED_ZERO__ +/* only weird assemblers generally need this */ +#undef __UCLIBC_ASM_LINE_SEP__ + #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_charclass.h b/libc/sysdeps/linux/common/bits/uClibc_charclass.h new file mode 100644 index 000000000..50df539b9 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/uClibc_charclass.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com> + * + * This 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. + */ + +#ifndef _BITS_UCLIBC_CHARCLASS_H +#define _BITS_UCLIBC_CHARCLASS_H + +/* Taking advantage of the C99 mutual-exclusion guarantees for the various + * (w)ctype classes, including the descriptions of printing and control + * (w)chars, we can place each in one of the following mutually-exlusive + * subsets. Since there are less than 16, we can store the data for + * each (w)chars in a nibble. In contrast, glibc uses an unsigned int + * per (w)char, with one bit flag for each is* type. While this allows + * a simple '&' operation to determine the type vs. a range test and a + * little special handling for the "blank" and "xdigit" types in my + * approach, it also uses 8 times the space for the tables on the typical + * 32-bit archs we supported.*/ +enum { + __CTYPE_unclassified = 0, + __CTYPE_alpha_nonupper_nonlower, + __CTYPE_alpha_lower, + __CTYPE_alpha_upper_lower, + __CTYPE_alpha_upper, + __CTYPE_digit, + __CTYPE_punct, + __CTYPE_graph, + __CTYPE_print_space_nonblank, + __CTYPE_print_space_blank, + __CTYPE_space_nonblank_noncntrl, + __CTYPE_space_blank_noncntrl, + __CTYPE_cntrl_space_nonblank, + __CTYPE_cntrl_space_blank, + __CTYPE_cntrl_nonspace +}; + +#endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 0b02c5dbf..03110e001 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! @@ -31,57 +30,15 @@ #error Always include <{w}ctype.h> rather than <bits/uClibc_ctype.h> #endif -#ifndef _BITS_CTYPE_H -#define _BITS_CTYPE_H +#ifndef _BITS_UCLIBC_CTYPE_H +#define _BITS_UCLIBC_CTYPE_H #ifdef __UCLIBC_GEN_LOCALE +/* We are in extra/locale/gen_XXX tools build */ -/* Taking advantage of the C99 mutual-exclusion guarantees for the various - * (w)ctype classes, including the descriptions of printing and control - * (w)chars, we can place each in one of the following mutually-exlusive - * subsets. Since there are less than 16, we can store the data for - * each (w)chars in a nibble. In contrast, glibc uses an unsigned int - * per (w)char, with one bit flag for each is* type. While this allows - * a simple '&' operation to determine the type vs. a range test and a - * little special handling for the "blank" and "xdigit" types in my - * approach, it also uses 8 times the space for the tables on the typical - * 32-bit archs we supported.*/ -enum { - __CTYPE_unclassified = 0, - __CTYPE_alpha_nonupper_nonlower, - __CTYPE_alpha_lower, - __CTYPE_alpha_upper_lower, - __CTYPE_alpha_upper, - __CTYPE_digit, - __CTYPE_punct, - __CTYPE_graph, - __CTYPE_print_space_nonblank, - __CTYPE_print_space_blank, - __CTYPE_space_nonblank_noncntrl, - __CTYPE_space_blank_noncntrl, - __CTYPE_cntrl_space_nonblank, - __CTYPE_cntrl_space_blank, - __CTYPE_cntrl_nonspace -}; +#include "uClibc_charclass.h" -/* Some macros that test for various (w)ctype classes when passed one of the - * designator values enumerated above. */ -#define __CTYPE_isalnum(D) ((unsigned int)(D-1) <= (__CTYPE_digit-1)) -#define __CTYPE_isalpha(D) ((unsigned int)(D-1) <= (__CTYPE_alpha_upper-1)) -#define __CTYPE_isblank(D) \ - ((((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) && (D & 1)) -#define __CTYPE_iscntrl(D) (((unsigned int)(D - __CTYPE_cntrl_space_nonblank)) <= 2) -#define __CTYPE_isdigit(D) (D == __CTYPE_digit) -#define __CTYPE_isgraph(D) ((unsigned int)(D-1) <= (__CTYPE_graph-1)) -#define __CTYPE_islower(D) (((unsigned int)(D - __CTYPE_alpha_lower)) <= 1) -#define __CTYPE_isprint(D) ((unsigned int)(D-1) <= (__CTYPE_print_space_blank-1)) -#define __CTYPE_ispunct(D) (D == __CTYPE_punct) -#define __CTYPE_isspace(D) (((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) -#define __CTYPE_isupper(D) (((unsigned int)(D - __CTYPE_alpha_upper_lower)) <= 1) -/* #define __CTYPE_isxdigit(D) -- isxdigit is untestable this way. - * But that's ok as isxdigit() (and isdigit() too) are locale-invariant. */ - -#else /* __UCLIBC_GEN_LOCALE *****************************************/ +#else /* Define some ctype macros valid for the C/POSIX locale. */ @@ -128,7 +85,7 @@ enum { : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21)))) #define __C_isgraph(c) \ ((sizeof(c) == sizeof(char)) \ - ? (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21)) \ + ? (((unsigned char)((c) - 0x21)) <= (0x7e - 0x21)) \ : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21))) #define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c)) @@ -137,143 +94,105 @@ enum { /**********************************************************************/ __BEGIN_DECLS -extern int isalnum(int c) __THROW; -extern int isalpha(int c) __THROW; -#ifdef __USE_ISOC99 -extern int isblank(int c) __THROW; -#endif -extern int iscntrl(int c) __THROW; -extern int isdigit(int c) __THROW; -extern int isgraph(int c) __THROW; -extern int islower(int c) __THROW; -extern int isprint(int c) __THROW; -extern int ispunct(int c) __THROW; -extern int isspace(int c) __THROW; -extern int isupper(int c) __THROW; -extern int isxdigit(int c) __THROW; - -extern int tolower(int c) __THROW; -extern int toupper(int c) __THROW; - -#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN -extern int isascii(int c) __THROW; -extern int toascii(int c) __THROW; +#ifdef _LIBC +/* These are uClibc-specific. */ +# define __isdigit_char(c) ((unsigned char)((c) - '0') <= 9) +# define __isdigit_int(c) ((unsigned int)((c) - '0') <= 9) #endif -#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc) -/* isdigit() is really locale-invariant, so provide some small fast macros. - * These are uClibc-specific. */ -#define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9) -#define __isdigit_int(C) (((unsigned int)((C) - '0')) <= 9) -#endif - -/* Next, some ctype macros which are valid for all supported locales. */ -/* WARNING: isspace and isblank need to be reverified if more 8-bit codesets - * are added!!! But isdigit and isxdigit are always valid. */ - -/* #define __isspace(c) __C_isspace(c) */ -/* #define __isblank(c) __C_isblank(c) */ - -/* #define __isdigit(c) __C_isdigit(c) */ -/* #define __isxdigit(c) __C_isxdigit(c) */ - /* Now some non-ansi/iso c99 macros. */ +#ifdef __UCLIBC_SUSV4_LEGACY__ #define __isascii(c) (((c) & ~0x7f) == 0) #define __toascii(c) ((c) & 0x7f) +/* Works correctly *only* on lowercase letters! */ #define _toupper(c) ((c) ^ 0x20) +/* Works correctly *only* on letters (of any case) and numbers */ #define _tolower(c) ((c) | 0x20) +#endif __END_DECLS /**********************************************************************/ #ifdef __GNUC__ -#define __isbody_C_macro(f,args) __C_ ## f args - -#define __isbody(f,c) \ - (__extension__ ({ \ - int __res; \ - if (sizeof(c) > sizeof(char)) { \ - int __c = (c); \ - __res = __isbody_C_macro(f,(__c)); \ - } else { \ - unsigned char __c = (c); \ - __res = __isbody_C_macro(f,(__c)); \ - } \ - __res; \ - })) - -#define __body_C_macro(f,args) __C_ ## f args - -#define __body(f,c) \ - (__extension__ ({ \ - int __res; \ - if (sizeof(c) > sizeof(char)) { \ - int __c = (c); \ - __res = __body_C_macro(f,(__c)); \ - } else { \ - unsigned char __c = (c); \ - __res = __body_C_macro(f,(__c)); \ - } \ - __res; \ - })) - -#define __isspace(c) __body(isspace,c) -#define __isblank(c) __body(isblank,c) -#define __isdigit(c) __body(isdigit,c) -#define __isxdigit(c) __body(isxdigit,c) -#define __iscntrl(c) __body(iscntrl,c) -#define __isalpha(c) __body(isalpha,c) -#define __isalnum(c) __body(isalnum,c) -#define __isprint(c) __body(isprint,c) -#define __islower(c) __body(islower,c) -#define __isupper(c) __body(isupper,c) -#define __ispunct(c) __body(ispunct,c) -#define __isgraph(c) __body(isgraph,c) - -#define __tolower(c) __body(tolower,c) -#define __toupper(c) __body(toupper,c) - -#if !defined __NO_CTYPE && !defined __cplusplus - -#define isspace(c) __isspace(c) -#define isblank(c) __isblank(c) -#define isdigit(c) __isdigit(c) -#define isxdigit(c) __isxdigit(c) -#define iscntrl(c) __iscntrl(c) -#define isalpha(c) __isalpha(c) -#define isalnum(c) __isalnum(c) -#define isprint(c) __isprint(c) -#define islower(c) __islower(c) -#define isupper(c) __isupper(c) -#define ispunct(c) __ispunct(c) -#define isgraph(c) __isgraph(c) - -#define tolower(c) __tolower(c) -#define toupper(c) __toupper(c) - - -#endif - -#else /* _GNUC__ ***************************************************/ - -#if !defined __NO_CTYPE && !defined __cplusplus - -/* These macros should be safe from side effects. */ - -#define isdigit(c) __C_isdigit(c) -#define isalpha(c) __C_isalpha(c) -#define isprint(c) __C_isprint(c) -#define islower(c) __C_islower(c) -#define isupper(c) __C_isupper(c) -#define isgraph(c) __C_isgraph(c) +# define __body_C_macro(f,args) __C_ ## f args + +# define __body(f,c) \ +(__extension__ ({ \ + int __res; \ + if (sizeof(c) > sizeof(char)) { \ + int __c = (c); \ + __res = __body_C_macro(f,(__c)); \ + } else { \ + unsigned char __c = (c); \ + __res = __body_C_macro(f,(__c)); \ + } \ + __res; \ +})) + +# define __isspace(c) __body(isspace,c) +# define __isblank(c) __body(isblank,c) +# define __isdigit(c) __body(isdigit,c) +# define __isxdigit(c) __body(isxdigit,c) +# define __iscntrl(c) __body(iscntrl,c) +# define __isalpha(c) __body(isalpha,c) +# define __isalnum(c) __body(isalnum,c) +# define __isprint(c) __body(isprint,c) +# define __islower(c) __body(islower,c) +# define __isupper(c) __body(isupper,c) +# define __ispunct(c) __body(ispunct,c) +# define __isgraph(c) __body(isgraph,c) + +/*locale-aware ctype.h has no __tolower, why stub locale + *tries to have it? remove after 0.9.31 + *# define __tolower(c) __body(tolower,c) + *# define __toupper(c) __body(toupper,c) + */ -#endif +/* Do not combine in one #if - unifdef tool is not that clever */ +# ifndef __NO_CTYPE +# ifndef __cplusplus + +# define isspace(c) __isspace(c) +# define isblank(c) __isblank(c) +# define isdigit(c) __isdigit(c) +# define isxdigit(c) __isxdigit(c) +# define iscntrl(c) __iscntrl(c) +# define isalpha(c) __isalpha(c) +# define isalnum(c) __isalnum(c) +# define isprint(c) __isprint(c) +# define islower(c) __islower(c) +# define isupper(c) __isupper(c) +# define ispunct(c) __ispunct(c) +# define isgraph(c) __isgraph(c) + +# define tolower(c) __body(tolower,c) +# define toupper(c) __body(toupper,c) + +# endif +# endif + +#else /* !_GNUC__ */ + +# ifndef __NO_CTYPE +# ifndef __cplusplus + +/* These macros should be safe from side effects! + * (not all __C_xxx macros are) */ +# define isdigit(c) __C_isdigit(c) +# define isalpha(c) __C_isalpha(c) +# define isprint(c) __C_isprint(c) +# define islower(c) __C_islower(c) +# define isupper(c) __C_isupper(c) +# define isgraph(c) __C_isgraph(c) + +# endif +# endif #endif /* __GNUC__ */ /**********************************************************************/ #endif /* __UCLIBC_GEN_LOCALE */ -#endif /* _BITS_CTYPE_H */ +#endif /* _BITS_UCLIBC_CTYPE_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_errno.h b/libc/sysdeps/linux/common/bits/uClibc_errno.h deleted file mode 100644 index 631e10c50..000000000 --- a/libc/sysdeps/linux/common/bits/uClibc_errno.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ -#ifndef _BITS_UCLIBC_ERRNO_H -#define _BITS_UCLIBC_ERRNO_H 1 - -#ifdef IS_IN_rtld -# undef errno -# define errno _dl_errno -extern int _dl_errno; // attribute_hidden; -#elif defined __UCLIBC_HAS_THREADS__ -# include <tls.h> -# if defined USE___THREAD && USE___THREAD -# undef errno -# ifndef NOT_IN_libc -# define errno __libc_errno -# else -# define errno errno -# endif -extern __thread int errno attribute_tls_model_ie; -# endif /* USE___THREAD */ -#endif /* IS_IN_rtld */ - -#define __set_errno(val) (errno = (val)) - -#ifndef __ASSEMBLER__ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)) -# ifdef IS_IN_rtld - attribute_hidden -# endif -; -# if defined __UCLIBC_HAS_THREADS__ -# include <tls.h> -# if defined USE___THREAD && USE___THREAD -libc_hidden_proto(__errno_location) -# endif -# endif - -#endif /* !__ASSEMBLER__ */ - -#endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h index e1721bf40..b7dcee1d3 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h +++ b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h @@ -12,10 +12,6 @@ #ifndef _UCLIBC_FPMAX_H #define _UCLIBC_FPMAX_H -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif - #include <features.h> #include <float.h> @@ -72,10 +68,6 @@ typedef float __fpmax_t; #ifndef DECIMAL_DIG -#ifdef L___strtofpmax -/* Emit warning only once. */ -#warning DECIMAL_DIG is not defined! If you are using gcc, it may not be defining __STDC_VERSION__ as it should. -#endif #if !defined(FLT_RADIX) || (FLT_RADIX != 2) #error unable to compensate for missing DECIMAL_DIG! #endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h index 6c23f398b..0727ebf55 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h +++ b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h @@ -11,14 +11,22 @@ #define _BITS_UCLIBC_LOCAL_LIM_H 1 /* This file works correctly only if local_lim.h is the NPTL version */ -#if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX +#if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX || !defined SEM_VALUE_MAX # error local_lim.h was incorrectly updated, use the NPTL version from glibc #endif /* This should really be moved to thread specific directories */ -#if defined __UCLIBC_HAS_THREADS__ +#if defined __UCLIBC_HAS_THREADS__ && !defined __UCLIBC_HAS_THREADS_NATIVE__ +/* glibc uses 16384 */ # define PTHREAD_THREADS_MAX 1024 # define TIMER_MAX 256 +# ifdef __LINUXTHREADS_OLD__ +# undef SEM_VALUE_MAX +# define SEM_VALUE_MAX ((int) ((~0u) >> 1)) +# endif +# undef PTHREAD_STACK_MIN +/* glibc uses at least 16364 */ +# define PTHREAD_STACK_MIN 1024 #endif #ifndef __UCLIBC_HAS_THREADS__ @@ -28,6 +36,7 @@ # undef PTHREAD_DESTRUCTOR_ITERATIONS # undef PTHREAD_STACK_MIN # undef DELAYTIMER_MAX +# undef SEM_VALUE_MAX #endif #endif /* bits/uClibc_local_lim.h */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h index a6b381c95..b42236d38 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_locale.h +++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! @@ -35,49 +34,38 @@ #ifdef __UCLIBC_HAS_LOCALE__ -#undef __LOCALE_C_ONLY +# undef __LOCALE_C_ONLY -#else /* __UCLIBC_HAS_LOCALE__ */ +#else -#define __LOCALE_C_ONLY +# define __LOCALE_C_ONLY -#define __XL_NPP(N) N -#define __LOCALE_PARAM -#define __LOCALE_ARG +# ifdef _LIBC +# define __XL_NPP(N) N +# define __LOCALE_PARAM +# define __LOCALE_ARG +# endif -#endif /* __UCLIBC_HAS_LOCALE__ */ +#endif /**********************************************************************/ -#define __NL_ITEM_CATEGORY_SHIFT (8) -#define __NL_ITEM_INDEX_MASK (0xff) +#define __NL_ITEM_CATEGORY_SHIFT 8 +#define __NL_ITEM_INDEX_MASK 0xff /* TODO: Make sure these agree with the locale mmap file gererator! */ -#define __LC_CTYPE 0 -#define __LC_NUMERIC 1 -#define __LC_MONETARY 2 -#define __LC_TIME 3 -#define __LC_COLLATE 4 -#define __LC_MESSAGES 5 -#define __LC_ALL 6 +#define __LC_CTYPE 0 +#define __LC_NUMERIC 1 +#define __LC_MONETARY 2 +#define __LC_TIME 3 +#define __LC_COLLATE 4 +#define __LC_MESSAGES 5 +#define __LC_ALL 6 /**********************************************************************/ #ifndef __LOCALE_C_ONLY -#if defined _LIBC /* && (defined IS_IN_libc || defined NOT_IN_libc) */ -#include <stddef.h> -#include <stdint.h> -#include <bits/uClibc_touplow.h> - -#ifndef __UCLIBC_GEN_LOCALE -#include <bits/uClibc_locale_data.h> -#endif -#endif - -/* extern void _locale_set(const unsigned char *p); */ -/* extern void _locale_init(void); */ - enum { __ctype_encoding_7_bit, /* C/POSIX */ __ctype_encoding_utf8, /* UTF-8 */ @@ -98,7 +86,22 @@ enum { * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul. */ -#if defined _LIBC && !defined __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */ +struct __uclibc_locale_struct; +typedef struct __uclibc_locale_struct *__locale_t; + +#ifdef _LIBC + +/* extern void _locale_set(const unsigned char *p); */ +extern void weak_function _locale_init(void) attribute_hidden; + +#include <stddef.h> +#include <stdint.h> +#include <bits/uClibc_touplow.h> +#ifndef __UCLIBC_GEN_LOCALE +# include <bits/uClibc_locale_data.h> +#endif + +#ifndef __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */ typedef struct { uint16_t num_weights; uint16_t num_starters; @@ -139,10 +142,9 @@ typedef struct { uint16_t MAX_WEIGHTS; } __collate_t; - /* static unsigned char cur_locale[LOCALE_STRING_SIZE]; */ -typedef struct __uclibc_locale_struct { +struct __uclibc_locale_struct { #ifdef __UCLIBC_HAS_XLOCALE__ const __ctype_mask_t *__ctype_b; const __ctype_touplow_t *__ctype_tolower; @@ -174,14 +176,14 @@ typedef struct __uclibc_locale_struct { const unsigned char *idx8ctype; const unsigned char *tbl8ctype; const unsigned char *idx8uplow; - const unsigned char *tbl8uplow; -#ifdef __UCLIBC_HAS_WCHAR__ + const unsigned char *tbl8uplow; +# ifdef __UCLIBC_HAS_WCHAR__ const unsigned char *idx8c2wc; const uint16_t *tbl8c2wc; /* char > 0x7f to wide char */ const unsigned char *idx8wc2c; const unsigned char *tbl8wc2c; /* translit */ -#endif /* __UCLIBC_HAS_WCHAR__ */ +# endif #endif /* __CTYPE_HAS_8_BIT_LOCALES */ #ifdef __UCLIBC_HAS_WCHAR__ @@ -301,8 +303,6 @@ typedef struct __uclibc_locale_struct { const char *era_d_t_fmt; const char *era_t_fmt; - /* collate is at the end */ - /* messages */ const char *yesexpr; const char *noexpr; @@ -311,70 +311,65 @@ typedef struct __uclibc_locale_struct { /* collate is at the end */ __collate_t collate; +}; -} __uclibc_locale_t; - -extern __uclibc_locale_t __global_locale_data; -extern struct __uclibc_locale_struct * __global_locale; -#endif /* _LIBC */ +extern struct __uclibc_locale_struct __global_locale_data; +extern struct __uclibc_locale_struct *__global_locale; +#endif /* !__UCLIBC_GEN_LOCALE */ -typedef struct __uclibc_locale_struct *__locale_t; - -/* if we need to leave only _LIBC, then attribute_hidden is not usable */ -#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +#if defined IS_IN_libc || defined NOT_IN_libc +/* If you plan to remove xxx_IN_libc guards, + * remove attribute_hidden, it won't work. + */ extern int __locale_mbrtowc_l(wchar_t *__restrict dst, - const char *__restrict src, - __locale_t loc ) attribute_hidden; + const char *__restrict src, + __locale_t loc) attribute_hidden; #endif #ifdef L_setlocale /* so we only get the warning once... */ #warning need thread version of CUR_LOCALE! #endif + /**********************************************************************/ #ifdef __UCLIBC_HAS_XLOCALE__ extern __locale_t __curlocale_var; - -#ifdef __UCLIBC_HAS_THREADS__ - +# ifdef __UCLIBC_HAS_THREADS__ extern __locale_t __curlocale(void) __THROW __attribute__ ((__const__)); +libc_hidden_proto(__curlocale) extern __locale_t __curlocale_set(__locale_t newloc); -#define __UCLIBC_CURLOCALE (__curlocale()) -#define __UCLIBC_CURLOCALE_DATA (*__curlocale()) - -#else /* __UCLIBC_HAS_THREADS__ */ - -#define __UCLIBC_CURLOCALE (__curlocale_var) -#define __UCLIBC_CURLOCALE_DATA (*__curlocale_var) - -#endif /* __UCLIBC_HAS_THREADS__ */ +libc_hidden_proto(__curlocale_set) +# define __UCLIBC_CURLOCALE (__curlocale()) +# else +# define __UCLIBC_CURLOCALE (__curlocale_var) +# endif #elif defined(__UCLIBC_HAS_LOCALE__) -#define __UCLIBC_CURLOCALE (__global_locale) -#define __UCLIBC_CURLOCALE_DATA (*__global_locale) +# define __UCLIBC_CURLOCALE (__global_locale) #endif /**********************************************************************/ #if defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) -#define __XL_NPP(N) N ## _l -#define __LOCALE_PARAM , __locale_t locale_arg -#define __LOCALE_ARG , locale_arg -#define __LOCALE_PTR locale_arg +# define __XL_NPP(N) N ## _l +# define __LOCALE_PARAM , __locale_t locale_arg +# define __LOCALE_ARG , locale_arg +# define __LOCALE_PTR locale_arg -#else /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */ +#else -#define __XL_NPP(N) N -#define __LOCALE_PARAM -#define __LOCALE_ARG -#define __LOCALE_PTR __UCLIBC_CURLOCALE +# define __XL_NPP(N) N +# define __LOCALE_PARAM +# define __LOCALE_ARG +# define __LOCALE_PTR __UCLIBC_CURLOCALE -#endif /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */ +#endif /**********************************************************************/ +#endif /* _LIBC */ + #endif /* !defined(__LOCALE_C_ONLY) */ -/**********************************************************************/ #endif /* _UCLIBC_LOCALE_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_mutex.h b/libc/sysdeps/linux/common/bits/uClibc_mutex.h index 14aeb9c80..94597e840 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_mutex.h +++ b/libc/sysdeps/linux/common/bits/uClibc_mutex.h @@ -13,7 +13,9 @@ #ifdef __UCLIBC_HAS_THREADS__ #include <pthread.h> +#ifdef _LIBC #include <bits/uClibc_pthread.h> +#endif #define __UCLIBC_MUTEX_TYPE pthread_mutex_t @@ -22,6 +24,9 @@ #define __UCLIBC_MUTEX_STATIC(M,I) static pthread_mutex_t M = I #define __UCLIBC_MUTEX_EXTERN(M) extern pthread_mutex_t M +#define __UCLIBC_MUTEX_INIT_VAR(M) \ + ((M) = (pthread_mutex_t) PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) + #define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) \ __pthread_mutex_lock(&(M)) @@ -34,7 +39,8 @@ #define __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,C) \ do { \ struct _pthread_cleanup_buffer __infunc_pthread_cleanup_buffer; \ - if (C) { \ + int __infunc_need_locking = (C); \ + if (__infunc_need_locking) { \ _pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer, \ (void (*) (void *))__pthread_mutex_unlock, \ &(M)); \ @@ -43,7 +49,7 @@ ((void)0) #define __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) \ - if (C) { \ + if (__infunc_need_locking) { \ _pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1); \ } \ } while (0) @@ -62,13 +68,62 @@ #define __UCLIBC_MUTEX_UNLOCK(M) \ __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1) -#else +#ifdef __USE_STDIO_FUTEXES__ + +#include <bits/stdio-lock.h> + +#define __UCLIBC_IO_MUTEX(M) _IO_lock_t M +#define __UCLIBC_IO_MUTEX_LOCK(M) _IO_lock_lock(M) +#define __UCLIBC_IO_MUTEX_UNLOCK(M) _IO_lock_unlock(M) +#define __UCLIBC_IO_MUTEX_TRYLOCK(M) _IO_lock_trylock(M) +#define __UCLIBC_IO_MUTEX_INIT(M) _IO_lock_t M = _IO_lock_initializer +#define __UCLIBC_IO_MUTEX_EXTERN(M) extern _IO_lock_t M + +#define __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,C) \ + if (C) { \ + _IO_lock_lock(M); \ + } + +#define __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,C) \ + if (C) { \ + _IO_lock_unlock(M); \ + } + +#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V) \ + __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,((A=(V))) == 0) + +#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A) \ + __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,((A) == 0)) + +#define __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE(M) _IO_lock_lock(M) +#define __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(M) _IO_lock_unlock(M) + +#else /* of __USE_STDIO_FUTEXES__ */ + +#define __UCLIBC_IO_MUTEX(M) __UCLIBC_MUTEX(M) +#define __UCLIBC_IO_MUTEX_LOCK(M) __UCLIBC_MUTEX_CONDITIONAL_LOCK(M, 1) +#define __UCLIBC_IO_MUTEX_UNLOCK(M) __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1) +#define __UCLIBC_IO_MUTEX_TRYLOCK(M) __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_INIT(M) __UCLIBC_MUTEX_INIT(M, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) +#define __UCLIBC_IO_MUTEX_EXTERN(M) __UCLIBC_MUTEX_EXTERN(M) +#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V) __UCLIBC_MUTEX_AUTO_LOCK(M,A,V) +#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A) __UCLIBC_MUTEX_AUTO_UNLOCK(M,A) +#define __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE(M) __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(M) __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,C) __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,C) +#define __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,C) __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) + +#endif /* of __USE_STDIO_FUTEXES__ */ + + +#else /* of __UCLIBC_HAS_THREADS__ */ #define __UCLIBC_MUTEX(M) void *__UCLIBC_MUTEX_DUMMY_ ## M #define __UCLIBC_MUTEX_INIT(M,I) extern void *__UCLIBC_MUTEX_DUMMY_ ## M #define __UCLIBC_MUTEX_STATIC(M,I) extern void *__UCLIBC_MUTEX_DUMMY_ ## M #define __UCLIBC_MUTEX_EXTERN(M) extern void *__UCLIBC_MUTEX_DUMMY_ ## M +#define __UCLIBC_MUTEX_INIT_VAR(M) ((void)0) #define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) ((void)0) #define __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(M) ((void)0) #define __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) (0) /* Always succeed? */ @@ -83,6 +138,22 @@ #define __UCLIBC_MUTEX_LOCK(M) ((void)0) #define __UCLIBC_MUTEX_UNLOCK(M) ((void)0) -#endif +#define __UCLIBC_IO_MUTEX(M) __UCLIBC_MUTEX(M) +#define __UCLIBC_IO_MUTEX_LOCK(M) __UCLIBC_MUTEX_CONDITIONAL_LOCK(M, 1) +#define __UCLIBC_IO_MUTEX_UNLOCK(M) __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1) +#define __UCLIBC_IO_MUTEX_TRYLOCK(M) __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_INIT(M) __UCLIBC_MUTEX_INIT(M, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) +#define __UCLIBC_IO_MUTEX_EXTERN(M) __UCLIBC_MUTEX_EXTERN(M) +#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V) __UCLIBC_MUTEX_AUTO_LOCK(M,A,V) +#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A) __UCLIBC_MUTEX_AUTO_UNLOCK(M,A) +#define __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE(M) __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(M) __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(M) +#define __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,C) __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,C) +#define __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,C) __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) + +#endif /* of __UCLIBC_HAS_THREADS__ */ + +#define __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) \ + __UCLIBC_IO_MUTEX_TRYLOCK(M) #endif /* _UCLIBC_MUTEX_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_page.h b/libc/sysdeps/linux/common/bits/uClibc_page.h index 134094536..d1f9262fd 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_page.h +++ b/libc/sysdeps/linux/common/bits/uClibc_page.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* Supply an architecture specific value for PAGE_SIZE and friends. */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_posix_opt.h b/libc/sysdeps/linux/common/bits/uClibc_posix_opt.h new file mode 100644 index 000000000..0ae0da188 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/uClibc_posix_opt.h @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* + * Never include this file directly; use <unistd.h> instead. + */ + +#ifndef _BITS_UCLIBC_POSIX_OPT_H +#define _BITS_UCLIBC_POSIX_OPT_H 1 + +/* This file works correctly only if posix_opt.h is the NPTL version */ +#ifndef _POSIX_THREADS +# error posix_opt.h was incorrectly updated, use the NPTL version from glibc +#endif + +/* change first options based on what glibc does */ + +#ifndef __UCLIBC_HAS_THREADS_NATIVE__ +# undef _POSIX_THREAD_PROCESS_SHARED +# define _POSIX_THREAD_PROCESS_SHARED -1 +# undef _POSIX_CLOCK_SELECTION +# define _POSIX_CLOCK_SELECTION -1 +# undef _POSIX_THREAD_PRIO_INHERIT +# define _POSIX_THREAD_PRIO_INHERIT -1 +# undef _POSIX_THREAD_PRIO_PROTECT +# define _POSIX_THREAD_PRIO_PROTECT -1 +# undef _POSIX_THREAD_ROBUST_PRIO_INHERIT +# undef _POSIX_THREAD_ROBUST_PRIO_PROTECT +#endif + +/* this has to be adapted to uClibc, not all are thread related */ +#ifndef __UCLIBC_HAS_THREADS__ +# undef _XOPEN_REALTIME_THREADS +# undef _POSIX_THREADS +# undef _POSIX_REENTRANT_FUNCTIONS +# undef _POSIX_THREAD_SAFE_FUNCTIONS +# undef _POSIX_THREAD_PRIORITY_SCHEDULING +# undef _POSIX_THREAD_ATTR_STACKSIZE +# undef _POSIX_THREAD_ATTR_STACKADDR +# undef _POSIX_THREAD_PRIO_INHERIT +# undef _POSIX_THREAD_PRIO_PROTECT +# undef _POSIX_SEMAPHORES +# undef _POSIX_ASYNCHRONOUS_IO +# undef _POSIX_ASYNC_IO +# undef _LFS_ASYNCHRONOUS_IO +# undef _POSIX_PRIORITIZED_IO +# undef _LFS64_ASYNCHRONOUS_IO +# undef _POSIX_CPUTIME +# undef _POSIX_THREAD_CPUTIME +# undef _POSIX_READER_WRITER_LOCKS +# undef _POSIX_TIMEOUTS +# undef _POSIX_SPIN_LOCKS +# undef _POSIX_BARRIERS +# undef _POSIX_MESSAGE_PASSING +# undef _POSIX_THREAD_PROCESS_SHARED +# undef _POSIX_CLOCK_SELECTION +# undef _POSIX_ADVISORY_INFO +/*# undef _POSIX_RAW_SOCKETS*/ +/*# undef _POSIX2_CHAR_TERM*/ +# undef _POSIX_SPORADIC_SERVER +# undef _POSIX_THREAD_SPORADIC_SERVER +/*# undef _POSIX_TRACE +# undef _POSIX_TRACE_EVENT_FILTER +# undef _POSIX_TRACE_INHERIT +# undef _POSIX_TRACE_LOG +# undef _POSIX_TYPED_MEMORY_OBJECTS*/ +#endif + +/* were in earlier version, used by sysconf */ +#define _POSIX_POLL 1 +#define _POSIX_SELECT 1 + +/* disable independently unsupported features */ +#undef _POSIX_TRACE +#undef _POSIX_TRACE_EVENT_FILTER +#undef _POSIX_TRACE_INHERIT +#undef _POSIX_TRACE_LOG +#undef _POSIX_TYPED_MEMORY_OBJECTS +#undef _POSIX_SPAWN + +#if 0 /* does uClibc support these? */ +# undef _POSIX_ASYNCHRONOUS_IO +# undef _POSIX_ASYNC_IO +# undef _LFS_ASYNCHRONOUS_IO +# undef _POSIX_PRIORITIZED_IO +# undef _LFS64_ASYNCHRONOUS_IO +# undef _POSIX_MESSAGE_PASSING +#endif + +/* change options based on uClibc config options */ + +#if 0 /*ndef __UCLIBC_HAS_POSIX_TIMERS__*/ +# undef _POSIX_TIMERS +# undef _POSIX_THREAD_CPUTIME +#endif + +#if 0 /*ndef __UCLIBC_HAS_POSIX_BARRIERS__*/ +# undef _POSIX_BARRIERS +#endif + +#if 0 /*ndef __UCLIBC_HAS_POSIX_SPINLOCKS__*/ +# undef _POSIX_SPIN_LOCKS +#endif + +#ifndef __ARCH_USE_MMU__ +# undef _POSIX_MEMLOCK +# undef _POSIX_MEMLOCK_RANGE +# undef _POSIX_MEMORY_PROTECTION +#endif + +#ifndef __UCLIBC_HAS_LFS__ +# undef _LFS64_ASYNCHRONOUS_IO +# undef _LFS_LARGEFILE +# undef _LFS64_LARGEFILE +# undef _LFS64_STDIO +#endif + +#ifndef __UCLIBC_HAS_REALTIME__ +# undef _POSIX_SEMAPHORES +#endif + +#ifndef __UCLIBC_HAS_REGEX__ +# undef _POSIX_REGEXP +#endif + +#ifndef __UCLIBC_HAS_IPV6__ +# undef _POSIX_IPV6 +#endif + +#ifndef __UCLIBC_HAS_SOCKET__ +# undef _POSIX_RAW_SOCKETS +#endif + +#endif /* bits/uClibc_posix_opt.h */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_pthread.h b/libc/sysdeps/linux/common/bits/uClibc_pthread.h index 1d6209f5e..708d0fed2 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_pthread.h +++ b/libc/sysdeps/linux/common/bits/uClibc_pthread.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* Supply prototypes for the internal thread functions used by the @@ -27,24 +26,20 @@ # error "Always include <pthread.h> rather than <bits/uClibc_pthread.h>" #endif -#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +struct _pthread_cleanup_buffer; + /* Threading functions internal to uClibc. Make these thread functions * weak so that we can elide them from single-threaded processes. */ extern int weak_function __pthread_mutex_init (pthread_mutex_t *__mutex, - __const pthread_mutexattr_t *__mutex_attr); -extern int weak_function __pthread_mutex_destroy (pthread_mutex_t *__mutex); + const pthread_mutexattr_t *__mutex_attr); extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex); extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex); -extern void __uclibc_mutex_unlock (void *) attribute_hidden; extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex); -# ifndef __UCLIBC_HAS_THREADS_NATIVE__ extern void weak_function _pthread_cleanup_push_defer ( struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), void *__arg); extern void weak_function _pthread_cleanup_pop_restore ( struct _pthread_cleanup_buffer *__buffer, int __execute); -# endif -#endif #endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h index 843a2f2c3..efd8a6c89 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h +++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h @@ -54,27 +54,6 @@ #endif /**********************************************************************/ -/* Make sure defines related to large files are consistent. */ -#ifdef _LIBC - -#ifdef __UCLIBC_HAS_LFS__ -#undef __USE_LARGEFILE -#undef __USE_LARGEFILE64 -#undef __USE_FILE_OFFSET64 -/* If we're actually building uClibc with large file support, only define... */ -#define __USE_LARGEFILE64 1 -#endif /* __UCLIBC_HAS_LFS__ */ - -#else /* not _LIBC */ - -#ifndef __UCLIBC_HAS_LFS__ -#if defined(__LARGEFILE64_SOURCE) || defined(__USE_LARGEFILE64) || defined(__USE_FILE_OFFSET64) -#error Sorry... uClibc was built without large file support! -#endif -#endif /* __UCLIBC_HAS_LFS__ */ - -#endif /* _LIBC */ -/**********************************************************************/ #ifdef __UCLIBC_HAS_WCHAR__ #define __need_wchar_t @@ -99,22 +78,7 @@ #define __STDIO_PUTC_MACRO #endif - -/* These are consistency checks on the different options */ - -#ifndef __STDIO_BUFFERS -#undef __STDIO_GETC_MACRO -#undef __STDIO_PUTC_MACRO -#endif - -#ifdef __BCC__ -#undef __UCLIBC_HAS_LFS__ -#endif - -#ifndef __UCLIBC_HAS_LFS__ -#undef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__ -#endif - +#ifdef _LIBC /**********************************************************************/ #include <bits/uClibc_mutex.h> @@ -134,26 +98,26 @@ __UCLIBC_MUTEX_AUTO_LOCK_VAR(__infunc_user_locking) #define __STDIO_AUTO_THREADLOCK(__stream) \ - __UCLIBC_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking, \ + __UCLIBC_IO_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking, \ (__stream)->__user_locking) #define __STDIO_AUTO_THREADUNLOCK(__stream) \ - __UCLIBC_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking) + __UCLIBC_IO_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking) #define __STDIO_ALWAYS_THREADLOCK(__stream) \ - __UCLIBC_MUTEX_LOCK((__stream)->__lock) + __UCLIBC_IO_MUTEX_LOCK((__stream)->__lock) #define __STDIO_ALWAYS_THREADUNLOCK(__stream) \ - __UCLIBC_MUTEX_UNLOCK((__stream)->__lock) + __UCLIBC_IO_MUTEX_UNLOCK((__stream)->__lock) #define __STDIO_ALWAYS_THREADLOCK_CANCEL_UNSAFE(__stream) \ - __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock) + __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock) #define __STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(__stream) \ - __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock) + __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock) #define __STDIO_ALWAYS_THREADUNLOCK_CANCEL_UNSAFE(__stream) \ - __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock) + __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock) #ifdef __UCLIBC_HAS_THREADS__ #define __STDIO_SET_USER_LOCKING(__stream) ((__stream)->__user_locking = 1) @@ -161,6 +125,16 @@ #define __STDIO_SET_USER_LOCKING(__stream) ((void)0) #endif +#ifdef __UCLIBC_HAS_THREADS__ +#ifdef __USE_STDIO_FUTEXES__ +#define STDIO_INIT_MUTEX(M) _IO_lock_init(M) +#else +#define STDIO_INIT_MUTEX(M) __stdio_init_mutex(& M) +#endif +#endif + +#endif /* _LIBC */ + /**********************************************************************/ #define __STDIO_IOFBF 0 /* Fully buffered. */ @@ -201,7 +175,7 @@ typedef __off_t __offmax_t; /* TODO -- rename this? */ typedef __ssize_t __io_read_fn(void *__cookie, char *__buf, size_t __bufsize); typedef __ssize_t __io_write_fn(void *__cookie, - __const char *__buf, size_t __bufsize); + const char *__buf, size_t __bufsize); /* NOTE: GLIBC difference!!! -- fopencookie seek function * For glibc, the type of pos is always (__off64_t *) but in our case * it is type (__off_t *) when the lib is built without large file support. @@ -216,7 +190,7 @@ typedef struct { __io_close_fn *close; } _IO_cookie_io_functions_t; -#if defined(_LIBC) || defined(_GNU_SOURCE) +#ifdef __USE_GNU typedef __io_read_fn cookie_read_function_t; typedef __io_write_fn cookie_write_function_t; @@ -230,6 +204,17 @@ typedef _IO_cookie_io_functions_t cookie_io_functions_t; #endif /**********************************************************************/ +#if defined __UCLIBC_HAS_THREADS__ && !defined __UCLIBC_IO_MUTEX +/* keep this in sync with uClibc_mutex.h */ +# ifdef __USE_STDIO_FUTEXES__ +# include <bits/stdio-lock.h> +# define __UCLIBC_IO_MUTEX(M) _IO_lock_t M +# else +# include <bits/pthreadtypes.h> +# define __UCLIBC_IO_MUTEX(M) pthread_mutex_t M +# endif /* __UCLIBC_HAS_THREADS_NATIVE__ */ +#endif + struct __STDIO_FILE_STRUCT { unsigned short __modeflags; /* There could be a hole here, but modeflags is used most.*/ @@ -260,10 +245,6 @@ struct __STDIO_FILE_STRUCT { #ifdef __STDIO_HAS_OPENLIST struct __STDIO_FILE_STRUCT *__nextopen; #endif -#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ - void *__cookie; - _IO_cookie_io_functions_t __gcs; -#endif #ifdef __UCLIBC_HAS_WCHAR__ wchar_t __ungot[2]; #endif @@ -275,7 +256,7 @@ struct __STDIO_FILE_STRUCT { #endif #ifdef __UCLIBC_HAS_THREADS__ int __user_locking; - __UCLIBC_MUTEX(__lock); + __UCLIBC_IO_MUTEX(__lock); #endif /* Everything after this is unimplemented... and may be trashed. */ #if __STDIO_BUILTIN_BUF_SIZE > 0 @@ -343,22 +324,27 @@ struct __STDIO_FILE_STRUCT { **********************************************************************/ #if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) -extern void _stdio_init(void) attribute_hidden; -extern void _stdio_term(void) attribute_hidden; +extern void weak_function _stdio_init(void) attribute_hidden; +extern void weak_function _stdio_term(void) attribute_hidden; #ifdef __STDIO_HAS_OPENLIST extern struct __STDIO_FILE_STRUCT *_stdio_openlist; #ifdef __UCLIBC_HAS_THREADS__ -__UCLIBC_MUTEX_EXTERN(_stdio_openlist_add_lock); +__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_add_lock) +# ifndef __UCLIBC_HAS_THREADS_NATIVE__ + attribute_hidden +# endif + ; #ifdef __STDIO_BUFFERS -__UCLIBC_MUTEX_EXTERN(_stdio_openlist_del_lock); -extern volatile int _stdio_openlist_use_count; /* _stdio_openlist_del_lock */ -extern int _stdio_openlist_del_count; /* _stdio_openlist_del_lock */ +__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_del_lock) +# ifndef __UCLIBC_HAS_THREADS_NATIVE__ + attribute_hidden +# endif + ; #endif extern int _stdio_user_locking; -extern void __stdio_init_mutex(__UCLIBC_MUTEX_TYPE *m) attribute_hidden; #endif #endif @@ -382,7 +368,9 @@ extern void __stdio_init_mutex(__UCLIBC_MUTEX_TYPE *m) attribute_hidden; #endif extern int __fgetc_unlocked(FILE *__stream); +libc_hidden_proto(__fgetc_unlocked) extern int __fputc_unlocked(int __c, FILE *__stream); +libc_hidden_proto(__fputc_unlocked) /* First define the default definitions. They are overridden below as necessary. */ @@ -455,6 +443,8 @@ extern FILE *__stdin; /* For getchar() macro. */ #else +# define __stdin stdin + #endif /* __STDIO_GETC_MACRO */ @@ -514,4 +504,8 @@ extern FILE *__stdout; /* For putchar() macro. */ # endif # endif +#else + +# define __stdout stdout + #endif /* __STDIO_PUTC_MACRO */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_touplow.h b/libc/sysdeps/linux/common/bits/uClibc_touplow.h index 28d4e2f48..d4c228dcf 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_touplow.h +++ b/libc/sysdeps/linux/common/bits/uClibc_touplow.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! @@ -43,13 +42,13 @@ typedef __int16_t __ctype_touplow_t; #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 -#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */ +#else typedef unsigned char __ctype_touplow_t; #define __UCLIBC_CTYPE_B_TBL_OFFSET 1 #define __UCLIBC_CTYPE_TO_TBL_OFFSET 0 -#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */ +#endif #endif /* _UCLIBC_TOUPLOW_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h index 92633ffa6..08d0a86d3 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! @@ -28,16 +27,6 @@ #ifndef _UINTMAXTOSTR_H #define _UINTMAXTOSTR_H 1 -#ifdef _FEATURES_H -# ifndef __USE_ISOC99 -# error features was included without defining _ISOC99_SOURCE! -# endif -#else -# ifndef _ISOC99_SOURCE -# define _ISOC99_SOURCE -# endif -#endif - #include <features.h> #include <limits.h> #include <stdint.h> diff --git a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h index ba2c42db7..47ea3cda1 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h @@ -11,9 +11,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_va_copy.h b/libc/sysdeps/linux/common/bits/uClibc_va_copy.h index 98663fc0e..39dd378fc 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_va_copy.h +++ b/libc/sysdeps/linux/common/bits/uClibc_va_copy.h @@ -13,9 +13,8 @@ * 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. + * License along with the GNU C Library; see the file COPYING.LIB. If + * not, see <http://www.gnu.org/licenses/>. */ #ifndef _UCLIBC_VA_COPY_H diff --git a/libc/sysdeps/linux/common/bits/uio.h b/libc/sysdeps/linux/common/bits/uio.h index 6a283ed77..611e42476 100644 --- a/libc/sysdeps/linux/common/bits/uio.h +++ b/libc/sysdeps/linux/common/bits/uio.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _SYS_UIO_H && !defined _FCNTL_H # error "Never include <bits/uio.h> directly; use <sys/uio.h> instead." @@ -38,6 +37,7 @@ functionality even if the currently running kernel does not support this large value the readv/writev call will not fail because of this. */ #define UIO_MAXIOV 1024 +#define UIO_FASTIOV 8 /* Structure for scatter/gather I/O. */ diff --git a/libc/sysdeps/linux/common/bits/ustat.h b/libc/sysdeps/linux/common/bits/ustat.h index 69c6b7227..ea048d122 100644 --- a/libc/sysdeps/linux/common/bits/ustat.h +++ b/libc/sysdeps/linux/common/bits/ustat.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_USTAT_H # error "Never include <bits/ustat.h> directly; use <sys/ustat.h> instead." diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h index e855ad73f..6ece31e34 100644 --- a/libc/sysdeps/linux/common/bits/utmp.h +++ b/libc/sysdeps/linux/common/bits/utmp.h @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _UTMP_H # error "Never include <bits/utmp.h> directly; use <utmp.h> instead." @@ -37,7 +36,7 @@ previous logins. */ struct lastlog { -#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 +#ifdef __WORDSIZE_TIME64_COMPAT32 int32_t ll_time; #else __time_t ll_time; @@ -70,7 +69,7 @@ struct utmp /* The ut_session and ut_tv fields must be the same size when compiled 32- and 64-bit. This allows data files and shared memory to be shared between 32- and 64-bit applications. */ -#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 +#ifdef __WORDSIZE_TIME64_COMPAT32 int32_t ut_session; /* Session ID, used for windowing. */ struct { diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h index c84cda6fe..815fc90b8 100644 --- a/libc/sysdeps/linux/common/bits/utmpx.h +++ b/libc/sysdeps/linux/common/bits/utmpx.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _UTMPX_H # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." @@ -67,7 +66,7 @@ struct utmpx /* The fields ut_session and ut_tv must be the same size when compiled 32- and 64-bit. This allows files and shared memory to be shared between 32- and 64-bit applications. */ -#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 +#ifdef __WORDSIZE_TIME64_COMPAT32 __int32_t ut_session; /* Session ID, used for windowing. */ struct { diff --git a/libc/sysdeps/linux/common/bits/utsname.h b/libc/sysdeps/linux/common/bits/utsname.h index 35e71e3ba..d82dec91e 100644 --- a/libc/sysdeps/linux/common/bits/utsname.h +++ b/libc/sysdeps/linux/common/bits/utsname.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UTSNAME_H # error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." diff --git a/libc/sysdeps/linux/common/bits/waitflags.h b/libc/sysdeps/linux/common/bits/waitflags.h index 464cedb1f..4ffe40c01 100644 --- a/libc/sysdeps/linux/common/bits/waitflags.h +++ b/libc/sysdeps/linux/common/bits/waitflags.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." diff --git a/libc/sysdeps/linux/common/bits/waitstatus.h b/libc/sysdeps/linux/common/bits/waitstatus.h index 699c22498..33f39a84a 100644 --- a/libc/sysdeps/linux/common/bits/waitstatus.h +++ b/libc/sysdeps/linux/common/bits/waitstatus.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead." @@ -25,7 +24,7 @@ /* Everything extant so far uses these same bits. */ -/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ +/* If WIFEXITED(STATUS), the low-order 8 bits of exit(N). */ #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) /* If WIFSIGNALED(STATUS), the terminating signal. */ @@ -37,12 +36,20 @@ /* Nonzero if STATUS indicates normal termination. */ #define __WIFEXITED(status) (__WTERMSIG(status) == 0) -/* Nonzero if STATUS indicates termination by a signal. */ -#define __WIFSIGNALED(status) \ - (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) +/* Nonzero if STATUS indicates termination by a signal. + * Note that status 0x007f is "died from signal 127", not "stopped by signal 0". + * This does happen on MIPS. + * The comparison is "< 0xff", not "< 0x7f", because WCOREDUMP bit (0x80) + * can be set too. + */ +#define __WIFSIGNALED(status) (((unsigned)((status) & 0xffff) - 1U) < 0xffU) /* Nonzero if STATUS indicates the child is stopped. */ +#if !defined(__mips__) #define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) +#else +#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f && ((status) & 0xff00)) +#endif /* Nonzero if STATUS indicates the child continued after a stop. We only define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */ diff --git a/libc/sysdeps/linux/common/bits/wchar.h b/libc/sysdeps/linux/common/bits/wchar.h index ef1f56363..a3ff5319e 100644 --- a/libc/sysdeps/linux/common/bits/wchar.h +++ b/libc/sysdeps/linux/common/bits/wchar.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _BITS_WCHAR_H #define _BITS_WCHAR_H 1 diff --git a/libc/sysdeps/linux/common/bits/xopen_lim.h b/libc/sysdeps/linux/common/bits/xopen_lim.h index c2363ab04..90620266b 100644 --- a/libc/sysdeps/linux/common/bits/xopen_lim.h +++ b/libc/sysdeps/linux/common/bits/xopen_lim.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <limits.h> instead. |
