From 5c421ad6358fe601b3253ddf524f6ad64c03a281 Mon Sep 17 00:00:00 2001 From: corinna Date: Wed, 7 Feb 2007 17:19:34 +0000 Subject: [PATCH] * libc/include/sys/features.h: Add definition of all supported _POSIX_xxx values for Cygwin. * libc/include/sys/types.h (pthread_rwlock_t): Omit definition on Cygwin. (pthread_rwlockattr_t): Ditto. * libc/include/sys/unistd.h: Define all _SC_xxx values as required by SUSv3. Unify formatting. --- newlib/ChangeLog | 10 ++ newlib/libc/include/sys/features.h | 94 +++++++++++++++-- newlib/libc/include/sys/types.h | 2 + newlib/libc/include/sys/unistd.h | 207 +++++++++++++++++++++++-------------- 4 files changed, 227 insertions(+), 86 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 7df0807d36..9b98919b2b 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,13 @@ +2007-02-07 Corinna Vinschen + + * libc/include/sys/features.h: Add definition of all supported + _POSIX_xxx values for Cygwin. + * libc/include/sys/types.h (pthread_rwlock_t): Omit definition + on Cygwin. + (pthread_rwlockattr_t): Ditto. + * libc/include/sys/unistd.h: Define all _SC_xxx values as + required by SUSv3. Unify formatting. + 2007-02-02 Ralf Corsépius * libc/include/sys/errno.h: Add ECANCELED. diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 7dc9486681..ed0b6b7b82 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -81,17 +81,89 @@ extern "C" { #endif #ifdef __CYGWIN__ -# define _POSIX_JOB_CONTROL 1 -# define _POSIX_SAVED_IDS 0 -# define _POSIX_VERSION 199009L -# define _POSIX_THREADS 1 -# define _POSIX_THREAD_PROCESS_SHARED 1 -# define _POSIX_THREAD_SAFE_FUNCTIONS 1 -# define _POSIX_THREAD_PRIORITY_SCHEDULING 1 -# define _POSIX_THREAD_ATTR_STACKSIZE 1 -# define _POSIX_SEMAPHORES 1 -# define _POSIX_TIMERS 1 -# define _POSIX_MEMLOCK_RANGE 1 +#define _POSIX_VERSION 200112L +#define _POSIX2_VERSION 200112L +#define _XOPEN_VERSION 600 + +#define _POSIX_ADVISORY_INFO 200112L +/* #define _POSIX_ASYNCHRONOUS_IO -1 */ +/* #define _POSIX_BARRIERS -1 */ +#define _POSIX_CHOWN_RESTRICTED 1 +/* #define _POSIX_CLOCK_SELECTION -1 */ +/* #define _POSIX_CPUTIME -1 */ +#define _POSIX_FSYNC 200112L +#define _POSIX_IPV6 200112L +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_MAPPED_FILES 200112L +/* #define _POSIX_MEMLOCK -1 */ +#define _POSIX_MEMLOCK_RANGE 200112L +#define _POSIX_MEMORY_PROTECTION 200112L +/* #define _POSIX_MESSAGE_PASSING -1 */ +/* #define _POSIX_MONOTONIC_CLOCK -1 */ +#define _POSIX_NO_TRUNC 1 +/* #define _POSIX_PRIORITIZED_IO -1 */ +#define _POSIX_PRIORITY_SCHEDULING 200112L +#define _POSIX_RAW_SOCKETS 200112L +#define _POSIX_READER_WRITER_LOCKS 200112L +#define _POSIX_REALTIME_SIGNALS 200112L +#define _POSIX_REGEXP 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_SEMAPHORES 1 +/* #define _POSIX_SHARED_MEMORY_OBJECTS -1 */ +#define _POSIX_SHELL 1 +/* #define _POSIX_SPAWN -1 */ +/* #define _POSIX_SPIN_LOCKS -1 */ +/* #define _POSIX_SPORADIC_SERVER -1 */ +#define _POSIX_SYNCHRONIZED_IO 200112L +/* #define _POSIX_THREAD_ATTR_STACKADDR -1 */ +#define _POSIX_THREAD_ATTR_STACKSIZE 200112L +/* #define _POSIX_THREAD_CPUTIME -1 */ +/* #define _POSIX_THREAD_PRIO_INHERIT -1 */ +/* #define _POSIX_THREAD_PRIO_PROTECT -1 */ +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L +#define _POSIX_THREAD_PROCESS_SHARED 200112L +#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L +/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */ +#define _POSIX_THREADS 200112L +/* #define _POSIX_TIMEOUTS -1 */ +#define _POSIX_TIMERS 1 +/* #define _POSIX_TRACE -1 */ +/* #define _POSIX_TRACE_EVENT_FILTER -1 */ +/* #define _POSIX_TRACE_INHERIT -1 */ +/* #define _POSIX_TRACE_LOG -1 */ +/* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */ +#define _POSIX_VDISABLE '\0' +#define _POSIX2_C_BIND 200112L +#define _POSIX2_C_DEV 200112L +#define _POSIX2_CHAR_TERM 200112L +/* #define _POSIX2_FORT_DEV -1 */ +/* #define _POSIX2_FORT_RUN -1 */ +/* #define _POSIX2_LOCALEDEF -1 */ +/* #define _POSIX2_PBS -1 */ +/* #define _POSIX2_PBS_ACCOUNTING -1 */ +/* #define _POSIX2_PBS_CHECKPOINT -1 */ +/* #define _POSIX2_PBS_LOCATE -1 */ +/* #define _POSIX2_PBS_MESSAGE -1 */ +/* #define _POSIX2_PBS_TRACK -1 */ +#define _POSIX2_SW_DEV 200112L +#define _POSIX2_UPE 200112L +/* #define _POSIX_V6_ILP32_OFF32 -1 */ +#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 +#define _POSIX_V6_ILP32_OFFBIG 1 +#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG +/* #define _POSIX_V6_LP64_OFF64 -1 */ +#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64 +/* #define _POSIX_V6_LPBIG_OFFBIG -1 */ +#define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG +#define _XOPEN_CRYPT 1 +#define _XOPEN_ENH_I18N 1 +/* #define _XOPEN_LEGACY -1 */ +/* #define _XOPEN_REALTIME -1 */ +/* #define _XOPEN_REALTIME_THREADS -1 */ +#define _XOPEN_SHM 1 +/* #define _XOPEN_STREAMS -1 */ +/* #define _XOPEN_UNIX -1 */ + #endif #ifdef __cplusplus diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index c1bff47935..c8b5d9453f 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -391,6 +391,7 @@ typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */ /* POSIX Reader/Writer Lock Types */ +#if !defined (__CYGWIN__) #if defined(_POSIX_READER_WRITER_LOCKS) typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */ typedef struct { @@ -400,6 +401,7 @@ typedef struct { #endif } pthread_rwlockattr_t; #endif /* defined(_POSIX_READER_WRITER_LOCKS) */ +#endif /* __CYGWIN__ */ #endif /* !__need_inttypes */ diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 9b0e8e6b93..fee70fd28e 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -231,63 +231,55 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2)); #define STDERR_FILENO 2 /* standard error file descriptor */ /* - * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96 - * - * NOTE: Table 4-2, Configurable System Variables, p. 96 - */ - -#define _SC_ARG_MAX 0 -#define _SC_CHILD_MAX 1 -#define _SC_CLK_TCK 2 -#define _SC_NGROUPS_MAX 3 -#define _SC_OPEN_MAX 4 - /* no _SC_STREAM_MAX */ -#define _SC_JOB_CONTROL 5 -#define _SC_SAVED_IDS 6 -#define _SC_VERSION 7 -#define _SC_PAGESIZE 8 -/* CYGWIN-specific values .. do not touch */ -#define _SC_NPROCESSORS_CONF 9 -#define _SC_NPROCESSORS_ONLN 10 -#define _SC_PHYS_PAGES 11 -#define _SC_AVPHYS_PAGES 12 -/* end of CYGWIN-specific values */ -#define _SC_MQ_OPEN_MAX 13 -#define _SC_MQ_PRIO_MAX 14 -#define _SC_RTSIG_MAX 15 -#define _SC_SEM_NSEMS_MAX 16 -#define _SC_SEM_VALUE_MAX 17 -#define _SC_SIGQUEUE_MAX 18 -#define _SC_TIMER_MAX 19 -#define _SC_TZNAME_MAX 20 - -#define _SC_ASYNCHRONOUS_IO 21 -#define _SC_FSYNC 22 -#define _SC_MAPPED_FILES 23 -#define _SC_MEMLOCK 24 -#define _SC_MEMLOCK_RANGE 25 -#define _SC_MEMORY_PROTECTION 26 -#define _SC_MESSAGE_PASSING 27 -#define _SC_PRIORITIZED_IO 28 -#define _SC_REALTIME_SIGNALS 29 -#define _SC_SEMAPHORES 30 -#define _SC_SHARED_MEMORY_OBJECTS 31 -#define _SC_SYNCHRONIZED_IO 32 -#define _SC_TIMERS 33 -#define _SC_AIO_LISTIO_MAX 34 -#define _SC_AIO_MAX 35 -#define _SC_AIO_PRIO_DELTA_MAX 36 -#define _SC_DELAYTIMER_MAX 37 - -/* - * P1003.1c/D10, p. 52 adds the following. + * sysconf values per IEEE Std 1003.1, 2004 Edition */ +#define _SC_ARG_MAX 0 +#define _SC_CHILD_MAX 1 +#define _SC_CLK_TCK 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_JOB_CONTROL 5 +#define _SC_SAVED_IDS 6 +#define _SC_VERSION 7 +#define _SC_PAGESIZE 8 +#define _SC_PAGE_SIZE _SC_PAGESIZE +/* These are non-POSIX values we accidentally introduced in 2000 without + guarding them. Keeping them unguarded for backward compatibility. */ +#define _SC_NPROCESSORS_CONF 9 +#define _SC_NPROCESSORS_ONLN 10 +#define _SC_PHYS_PAGES 11 +#define _SC_AVPHYS_PAGES 12 +/* End of non-POSIX values. */ +#define _SC_MQ_OPEN_MAX 13 +#define _SC_MQ_PRIO_MAX 14 +#define _SC_RTSIG_MAX 15 +#define _SC_SEM_NSEMS_MAX 16 +#define _SC_SEM_VALUE_MAX 17 +#define _SC_SIGQUEUE_MAX 18 +#define _SC_TIMER_MAX 19 +#define _SC_TZNAME_MAX 20 +#define _SC_ASYNCHRONOUS_IO 21 +#define _SC_FSYNC 22 +#define _SC_MAPPED_FILES 23 +#define _SC_MEMLOCK 24 +#define _SC_MEMLOCK_RANGE 25 +#define _SC_MEMORY_PROTECTION 26 +#define _SC_MESSAGE_PASSING 27 +#define _SC_PRIORITIZED_IO 28 +#define _SC_REALTIME_SIGNALS 29 +#define _SC_SEMAPHORES 30 +#define _SC_SHARED_MEMORY_OBJECTS 31 +#define _SC_SYNCHRONIZED_IO 32 +#define _SC_TIMERS 33 +#define _SC_AIO_LISTIO_MAX 34 +#define _SC_AIO_MAX 35 +#define _SC_AIO_PRIO_DELTA_MAX 36 +#define _SC_DELAYTIMER_MAX 37 #define _SC_THREAD_KEYS_MAX 38 #define _SC_THREAD_STACK_MIN 39 #define _SC_THREAD_THREADS_MAX 40 #define _SC_TTY_NAME_MAX 41 - #define _SC_THREADS 42 #define _SC_THREAD_ATTR_STACKADDR 43 #define _SC_THREAD_ATTR_STACKSIZE 44 @@ -302,34 +294,99 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2)); #define _SC_GETPW_R_SIZE_MAX 51 #define _SC_LOGIN_NAME_MAX 52 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 53 +#define _SC_ADVISORY_INFO 54 +#define _SC_ATEXIT_MAX 55 +#define _SC_BARRIERS 56 +#define _SC_BC_BASE_MAX 57 +#define _SC_BC_DIM_MAX 58 +#define _SC_BC_SCALE_MAX 59 +#define _SC_BC_STRING_MAX 60 +#define _SC_CLOCK_SELECTION 61 +#define _SC_COLL_WEIGHTS_MAX 62 +#define _SC_CPUTIME 63 +#define _SC_EXPR_NEST_MAX 64 +#define _SC_HOST_NAME_MAX 65 +#define _SC_IOV_MAX 66 +#define _SC_IPV6 67 +#define _SC_LINE_MAX 68 +#define _SC_MONOTONIC_CLOCK 69 +#define _SC_RAW_SOCKETS 70 +#define _SC_READER_WRITER_LOCKS 71 +#define _SC_REGEXP 72 +#define _SC_RE_DUP_MAX 73 +#define _SC_SHELL 74 +#define _SC_SPAWN 75 +#define _SC_SPIN_LOCKS 76 +#define _SC_SPORADIC_SERVER 77 +#define _SC_SS_REPL_MAX 78 +#define _SC_SYMLOOP_MAX 79 +#define _SC_THREAD_CPUTIME 80 +#define _SC_THREAD_SPORADIC_SERVER 81 +#define _SC_TIMEOUTS 82 +#define _SC_TRACE 83 +#define _SC_TRACE_EVENT_FILTER 84 +#define _SC_TRACE_EVENT_NAME_MAX 85 +#define _SC_TRACE_INHERIT 86 +#define _SC_TRACE_LOG 87 +#define _SC_TRACE_NAME_MAX 88 +#define _SC_TRACE_SYS_MAX 89 +#define _SC_TRACE_USER_EVENT_MAX 90 +#define _SC_TYPED_MEMORY_OBJECTS 91 +#define _SC_V6_ILP32_OFF32 92 +#define _SC_XBS5_ILP32_OFF32 _SC_V6_ILP32_OFF32 +#define _SC_V6_ILP32_OFFBIG 93 +#define _SC_XBS5_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG +#define _SC_V6_LP64_OFF64 94 +#define _SC_XBS5_LP64_OFF64 _SC_V6_LP64_OFF64 +#define _SC_V6_LPBIG_OFFBIG 95 +#define _SC_XBS5_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG +#define _SC_XOPEN_CRYPT 96 +#define _SC_XOPEN_ENH_I18N 97 +#define _SC_XOPEN_LEGACY 98 +#define _SC_XOPEN_REALTIME 99 +#define _SC_STREAM_MAX 100 +#define _SC_PRIORITY_SCHEDULING 101 +#define _SC_XOPEN_REALTIME_THREADS 102 +#define _SC_XOPEN_SHM 103 +#define _SC_XOPEN_STREAMS 104 +#define _SC_XOPEN_UNIX 105 +#define _SC_XOPEN_VERSION 106 +#define _SC_2_CHAR_TERM 107 +#define _SC_2_C_BIND 108 +#define _SC_2_C_DEV 109 +#define _SC_2_FORT_DEV 110 +#define _SC_2_FORT_RUN 111 +#define _SC_2_LOCALEDEF 112 +#define _SC_2_PBS 113 +#define _SC_2_PBS_ACCOUNTING 114 +#define _SC_2_PBS_CHECKPOINT 115 +#define _SC_2_PBS_LOCATE 116 +#define _SC_2_PBS_MESSAGE 117 +#define _SC_2_PBS_TRACK 118 +#define _SC_2_SW_DEV 119 +#define _SC_2_UPE 120 +#define _SC_2_VERSION 121 -#if !defined(__rtems__) -#define _SC_STREAM_MAX 100 -#endif -#if !defined(__CYGWIN__) && !defined(__rtems__) -#define _SC_PRIORITY_SCHEDULING 101 -#endif - -# define _PC_LINK_MAX 0 -# define _PC_MAX_CANON 1 -# define _PC_MAX_INPUT 2 -# define _PC_NAME_MAX 3 -# define _PC_PATH_MAX 4 -# define _PC_PIPE_BUF 5 -# define _PC_CHOWN_RESTRICTED 6 -# define _PC_NO_TRUNC 7 -# define _PC_VDISABLE 8 -# define _PC_ASYNC_IO 9 -# define _PC_PRIO_IO 10 -# define _PC_SYNC_IO 11 -# define _PC_FILESIZEBITS 12 -# define _PC_2_SYMLINKS 13 -# define _PC_SYMLINK_MAX 14 +#define _PC_LINK_MAX 0 +#define _PC_MAX_CANON 1 +#define _PC_MAX_INPUT 2 +#define _PC_NAME_MAX 3 +#define _PC_PATH_MAX 4 +#define _PC_PIPE_BUF 5 +#define _PC_CHOWN_RESTRICTED 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_ASYNC_IO 9 +#define _PC_PRIO_IO 10 +#define _PC_SYNC_IO 11 +#define _PC_FILESIZEBITS 12 +#define _PC_2_SYMLINKS 13 +#define _PC_SYMLINK_MAX 14 #ifdef __CYGWIN__ /* Ask for POSIX permission bits support. */ -# define _PC_POSIX_PERMISSIONS 90 +#define _PC_POSIX_PERMISSIONS 90 /* Ask for full POSIX permission support including uid/gid settings. */ -# define _PC_POSIX_SECURITY 91 +#define _PC_POSIX_SECURITY 91 #endif /* FIXME: This is temporary until winsup gets sorted out. */ -- 2.11.0