Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include/sys')
-rw-r--r--newlib/libc/include/sys/features.h89
-rw-r--r--newlib/libc/include/sys/sched.h65
-rw-r--r--newlib/libc/include/sys/signal.h157
-rw-r--r--newlib/libc/include/sys/types.h138
-rw-r--r--newlib/libc/include/sys/unistd.h130
5 files changed, 529 insertions, 50 deletions
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
new file mode 100644
index 000000000..c73d439e9
--- /dev/null
+++ b/newlib/libc/include/sys/features.h
@@ -0,0 +1,89 @@
+/*
+ * Written by Joel Sherrill <joel@OARcorp.com>.
+ *
+ * COPYRIGHT (c) 1989-2000.
+ *
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
+ * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
+ * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ * $Id$
+ */
+
+#ifndef _SYS_FEATURES_H
+#define _SYS_FEATURES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
+
+#ifdef __rtems__
+#define _POSIX_JOB_CONTROL 1
+#define _POSIX_SAVED_IDS 1
+#define _POSIX_VERSION 199309L
+#define _POSIX_ASYNCHRONOUS_IO 1
+#define _POSIX_FSYNC 1
+#define _POSIX_MAPPED_FILES 1
+#define _POSIX_MEMLOCK 1
+#define _POSIX_MEMLOCK_RANGE 1
+#define _POSIX_MEMORY_PROTECTION 1
+#define _POSIX_MESSAGE_PASSING 1
+#define _POSIX_PRIORITIZED_IO 1
+#define _POSIX_PRIORITY_SCHEDULING 1
+#define _POSIX_REALTIME_SIGNALS 1
+#define _POSIX_SEMAPHORES 1
+#define _POSIX_SHARED_MEMORY_OBJECTS 1
+#define _POSIX_SYNCHRONIZED_IO 1
+#define _POSIX_TIMERS 1
+
+
+/* In P1003.1b but defined by drafts at least as early as P1003.1c/D10 */
+#define _POSIX_THREADS 1
+#define _POSIX_THREAD_ATTR_STACKADDR 1
+#define _POSIX_THREAD_ATTR_STACKSIZE 1
+#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
+#define _POSIX_THREAD_PRIO_INHERIT 1
+#define _POSIX_THREAD_PRIO_PROTECT 1
+#define _POSIX_THREAD_PROCESS_SHARED 1
+#define _POSIX_THREAD_SAFE_FUNCTIONS 1
+
+/* P1003.4b/D8 defines the constants below this comment. */
+#define _POSIX_SPAWN 1
+#define _POSIX_TIMEOUTS 1
+#define _POSIX_CPUTIME 1
+#define _POSIX_THREAD_CPUTIME 1
+#define _POSIX_SPORADIC_SERVER 1
+#define _POSIX_THREAD_SPORADIC_SERVER 1
+#define _POSIX_DEVICE_CONTROL 1
+#define _POSIX_DEVCTL_DIRECTION 1
+#define _POSIX_INTERRUPT_CONTROL 1
+#define _POSIX_ADVISORY_INFO 1
+
+#endif
+
+#ifdef __svr4__
+# define _POSIX_JOB_CONTROL 1
+# define _POSIX_SAVED_IDS 1
+# define _POSIX_VERSION 199009L
+#endif
+
+#ifdef __CYGWIN32__
+# define _POSIX_JOB_CONTROL 1
+# define _POSIX_SAVED_IDS 0
+# define _POSIX_VERSION 199009L
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SYS_FEATURES_H */
diff --git a/newlib/libc/include/sys/sched.h b/newlib/libc/include/sys/sched.h
new file mode 100644
index 000000000..540552199
--- /dev/null
+++ b/newlib/libc/include/sys/sched.h
@@ -0,0 +1,65 @@
+/*
+ * Written by Joel Sherrill <joel@OARcorp.com>.
+ *
+ * COPYRIGHT (c) 1989-2000.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
+ * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
+ * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ * $Id$
+ */
+
+
+#ifndef __POSIX_SYS_SCHEDULING_h
+#define __POSIX_SYS_SCHEDULING_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/unistd.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+/* Scheduling Policies, P1003.1b-1993, p. 250
+ NOTE: SCHED_SPORADIC added by P1003.4b/D8, p. 34. */
+
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+
+#if defined(_POSIX_SPORADIC_SERVER)
+#define SCHED_SPORADIC 3
+#endif
+
+/* Scheduling Parameters, P1003.1b-1993, p. 249
+ NOTE: Fields whose name begins with "ss_" added by P1003.4b/D8, p. 33. */
+
+struct sched_param {
+ int sched_priority; /* Process execution scheduling priority */
+
+#if defined(_POSIX_SPORADIC_SERVER)
+ int ss_low_priority; /* Low scheduling priority for sporadic */
+ /* server */
+ struct timespec ss_replenish_period;
+ /* Replenishment period for sporadic server */
+ struct timespec ss_initial_budget; /* Initial budget for sporadic server */
+#endif
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
+
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 478531023..58d84de11 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -8,16 +8,113 @@ extern "C" {
#endif
#include "_ansi.h"
+#include <sys/features.h>
+
+/* #ifndef __STRICT_ANSI__*/
+
+#if defined(_POSIX_THREADS)
+#include <sys/types.h> /* for pthread data types */
+#endif
-#ifndef __STRICT_ANSI__
typedef unsigned long sigset_t;
+
+#if defined(__rtems__)
+
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/* sigev_notify values
+ NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
+
+#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */
+ /* when the event of interest occurs. */
+#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */
+ /* value, shall be delivered when the event of */
+ /* interest occurs. */
+#define SIGEV_THREAD 3 /* A notification function shall be called to */
+ /* perform notification. */
+
+/* Signal Generation and Delivery, P1003.1b-1993, p. 63
+ NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
+ sigev_notify_attributes to the sigevent structure. */
+
+union sigval {
+ int sival_int; /* Integer signal value */
+ void *sival_ptr; /* Pointer signal value */
+};
+
+struct sigevent {
+ int sigev_notify; /* Notification type */
+ int sigev_signo; /* Signal number */
+ union sigval sigev_value; /* Signal value */
+
+#if defined(_POSIX_THREADS)
+ void (*sigev_notify_function)( union sigval );
+ /* Notification function */
+ pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */
+#endif
+};
+
+/* Signal Actions, P1003.1b-1993, p. 64 */
+/* si_code values, p. 66 */
+
+#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
+#define SI_QUEUE 2 /* Sent by sigqueue() */
+#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
+#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
+#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
+
+typedef struct {
+ int si_signo; /* Signal number */
+ int si_code; /* Cause of the signal */
+ union sigval si_value; /* Signal value */
+} siginfo_t;
+#endif
+
+/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
+
+#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */
+#define SA_SIGINFO 2 /* Invoke the signal catching function with */
+ /* three arguments instead of one. */
+
+/* struct sigaction notes from POSIX:
+ *
+ * (1) Routines stored in sa_handler should take a single int as
+ * there argument although the POSIX standard does not require this.
+ * (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
+ * application should not use both simultaneously.
+ */
+
+struct sigaction {
+ int sa_flags; /* Special flags to affect behavior of signal */
+ sigset_t sa_mask; /* Additional set of signals to be blocked */
+ /* during execution of signal-catching */
+ /* function. */
+ union {
+ void (*_handler)(); /* SIG_DFL, SIG_IGN, or pointer to a function */
+#if defined(_POSIX_REALTIME_SIGNALS)
+ void (*_sigaction)( int, siginfo_t *, void * );
+#endif
+ } _signal_handlers;
+};
+
+#define sa_handler _signal_handlers._handler
+#if defined(_POSIX_REALTIME_SIGNALS)
+#define sa_sigaction _signal_handlers._sigaction
+#endif
+
+#else
+
struct sigaction
{
void (*sa_handler)(int);
sigset_t sa_mask;
int sa_flags;
};
-#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
+
+#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
+
+#endif /* defined(__rtems__) */
+
#define SIG_SETMASK 0 /* set mask with sigprocmask() */
#define SIG_BLOCK 1 /* set of signals to block */
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
@@ -28,10 +125,14 @@ struct sigaction
#define sigaddset(what,sig) (*(what) |= (1<<(sig)))
#define sigemptyset(what) (*(what) = 0)
-int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b);
+int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
+
+#if defined(_POSIX_THREADS)
+int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
+#endif
-/* protos for functions found in winsup sources */
-#if defined(__CYGWIN__)
+/* protos for functions found in winsup sources for CYGWIN */
+#if defined(__CYGWIN__) || defined(__rtems__)
#undef sigaddset
#undef sigemptyset
/* The first argument to kill should be pid_t. Right now
@@ -48,9 +149,30 @@ int _EXFUN(sigemptyset, (sigset_t *));
int _EXFUN(sigpending, (sigset_t *));
int _EXFUN(sigsuspend, (const sigset_t *));
int _EXFUN(sigpause, (int));
+
+#if defined(_POSIX_THREADS)
+int _EXFUN(pthread_kill, (pthread_t thread, int sig));
#endif
-#endif /* __STRICT_ANSI__ */
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
+ NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
+
+int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
+int _EXFUN(sigtimedwait,
+ (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
+);
+int _EXFUN(sigwait, (const sigset_t *set, int *sig));
+
+/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
+int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
+
+#endif /* defined(_POSIX_REALTIME_SIGNALS) */
+
+#endif /* defined(__CYGWIN32__) || defined(__rtems__) */
+
+/* #endif __STRICT_ANSI__ */
#if defined(___AM29K__)
/* These all need to be defined for ANSI C, but I don't think they are
@@ -139,7 +261,28 @@ int _EXFUN(sigpause, (int));
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
-#if defined(__svr4__)
+#if defined(__rtems__)
+#define SIGUSR1 16 /* reserved as application defined signal 1 */
+#define SIGUSR2 17 /* reserved as application defined signal 2 */
+
+#define __SIGFIRSTNOTRT SIGHUP
+#define __SIGLASTNOTRT SIGUSR2
+
+/* RTEMS does not support job control, hence no Job Control Signals are
+ defined per P1003.1b-1993, p. 60-61.
+
+ RTEMS does not support memory protection, hence no Memory Protection
+ Signals are defined per P1003.1b-1993, p. 60-61. */
+
+/* Real-Time Signals Range, P1003.1b-1993, p. 61
+ NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX
+ (which is a minimum of 8) signals.
+ */
+
+#define SIGRTMIN 18
+#define SIGRTMAX 32
+
+#elif defined(__svr4__)
/* svr4 specifics. different signals above 15, and sigaction. */
#define SIGUSR1 16
#define SIGUSR2 17
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index 1f147c6a8..d37a5f9ae 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -60,9 +60,26 @@ typedef unsigned short ushort; /* System V compatibility */
typedef unsigned int uint; /* System V compatibility */
# endif /*!_POSIX_SOURCE */
+#ifndef __clock_t_defined
+typedef _CLOCK_T_ clock_t;
+#define __clock_t_defined
+#endif
+
#ifndef __time_t_defined
typedef _TIME_T_ time_t;
#define __time_t_defined
+
+/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
+
+struct timespec {
+ time_t tv_sec; /* Seconds */
+ long tv_nsec; /* Nanoseconds */
+};
+
+struct itimerspec {
+ struct timespec it_interval; /* Timer period */
+ struct timespec it_value; /* Timer expiration */
+};
#endif
typedef long daddr_t;
@@ -102,7 +119,12 @@ typedef int32_t register_t;
* how the file was compiled (e.g. -mint16 vs -mint32, etc.).
*/
+#if defined(__rtems__)
+/* device numbers are 32-bit major and and 32-bit minor */
+typedef unsigned long long dev_t;
+#else
typedef short dev_t;
+#endif
typedef long off_t;
@@ -176,4 +198,120 @@ typedef struct _types_fd_set {
#undef __MS_types__
#undef _ST_INT32
+/* The following are actually standard POSIX 1003.1b-1993 threads, mutexes,
+ condition variables, and keys. But since RTEMS is currently the only
+ newlib user of these, the ifdef is just on RTEMS. */
+
+#if defined(__rtems__)
+
+#ifndef __clockid_t_defined
+typedef _CLOCKID_T_ clockid_t;
+#define __clockid_t_defined
+#endif
+
+#ifndef __timer_t_defined
+typedef _TIMER_T_ timer_t;
+#define __timer_t_defined
+#endif
+
+#include <sys/features.h>
+
+#if defined(_POSIX_THREADS)
+
+#include <sys/sched.h>
+
+/*
+ * 2.5 Primitive System Data Types, P1003.1c/D10, p. 19.
+ */
+
+typedef __uint32_t pthread_t; /* identify a thread */
+
+/* P1003.1c/D10, p. 118-119 */
+#define PTHREAD_SCOPE_PROCESS 0
+#define PTHREAD_SCOPE_SYSTEM 1
+
+/* P1003.1c/D10, p. 111 */
+#define PTHREAD_INHERIT_SCHED 1 /* scheduling policy and associated */
+ /* attributes are inherited from */
+ /* the calling thread. */
+#define PTHREAD_EXPLICIT_SCHED 2 /* set from provided attribute object */
+
+/* P1003.1c/D10, p. 141 */
+#define PTHREAD_CREATE_DETACHED 0
+#define PTHREAD_CREATE_JOINABLE 1
+
+typedef struct {
+ int is_initialized;
+ void *stackaddr;
+ int stacksize;
+ int contentionscope;
+ int inheritsched;
+ int schedpolicy;
+ struct sched_param schedparam;
+
+ /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute. */
+#if defined(_POSIX_THREAD_CPUTIME)
+ int cputime_clock_allowed; /* see time.h */
+#endif
+ int detachstate;
+
+} pthread_attr_t;
+
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
+/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */
+
+#define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
+#define PTHREAD_PROCESS_SHARED 1 /* visible too all processes with access to */
+ /* the memory where the resource is */
+ /* located */
+#endif
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+/* Mutexes */
+
+/* Values for blocking protocol. */
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+#endif
+
+typedef __uint32_t pthread_mutex_t; /* identify a mutex */
+
+typedef struct {
+ int is_initialized;
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
+ int process_shared; /* allow mutex to be shared amongst processes */
+#endif
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+ int prio_ceiling;
+ int protocol;
+#endif
+ int recursive;
+} pthread_mutexattr_t;
+
+/* Condition Variables */
+
+typedef __uint32_t pthread_cond_t; /* identify a condition variable */
+
+typedef struct {
+ int is_initialized;
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
+ int process_shared; /* allow this to be shared amongst processes */
+#endif
+} pthread_condattr_t; /* a condition attribute object */
+
+/* Keys */
+
+typedef __uint32_t pthread_key_t; /* thread-specific data keys */
+
+typedef struct {
+ int is_initialized; /* is this structure initialized? */
+ int init_executed; /* has the initialization routine been run? */
+} pthread_once_t; /* dynamic package initialization */
+
+#endif /* defined(_POSIX_THREADS) */
+
+#endif /* defined(__rtems__) */
+
#endif /* _SYS_TYPES_H */
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index fa103a91f..9d87365b4 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -8,6 +8,7 @@ extern "C" {
#include <_ansi.h>
#include <sys/types.h>
#define __need_size_t
+#define __need_ptrdiff_t
#include <stddef.h>
extern char **environ;
@@ -41,6 +42,9 @@ uid_t _EXFUN(geteuid, (void ));
gid_t _EXFUN(getgid, (void ));
int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
char _EXFUN(*getlogin, (void ));
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+int _EXFUN(getlogin_r, (char *name, size_t namesize) );
+#endif
char _EXFUN(*getpass, (__const char *__prompt));
size_t _EXFUN(getpagesize, (void));
pid_t _EXFUN(getpgrp, (void ));
@@ -55,9 +59,18 @@ off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
long _EXFUN(pathconf, (const char *__path, int __name ));
int _EXFUN(pause, (void ));
int _EXFUN(pipe, (int __fildes[2] ));
-int _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
+/* POSIX 1003.1b-1993 says read() returns ssize_t */
+#if defined(__rtems__)
+ssize_t _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
+#else
+int _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
+#endif
int _EXFUN(rmdir, (const char *__path ));
-void * _EXFUN(sbrk, (size_t __incr));
+#if defined(__rtems__)
+void * _EXFUN(sbrk, (ptrdiff_t __incr));
+#else
+void * _EXFUN(sbrk, (size_t __incr));
+#endif
#if defined(__CYGWIN__)
int _EXFUN(setegid, (gid_t __gid ));
int _EXFUN(seteuid, (uid_t __uid ));
@@ -73,7 +86,12 @@ pid_t _EXFUN(tcgetpgrp, (int __fildes ));
int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
char _EXFUN(*ttyname, (int __fildes ));
int _EXFUN(unlink, (const char *__path ));
+/* POSIX 1003.1b-1993 says write() returns ssize_t */
+#if defined(__rtems__)
+ssize_t _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte ));
+#else
int _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte ));
+#endif
#ifndef _POSIX_SOURCE
pid_t _EXFUN(vfork, (void ));
@@ -114,33 +132,7 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2));
# define SEEK_CUR 1
# define SEEK_END 2
-/*
- * RTEMS adheres to a later version of POSIX -- 1003.1b.
- *
- * XXX this version string should change.
- */
-
-#ifdef __rtems__
-#ifndef _POSIX_JOB_CONTROL
-# define _POSIX_JOB_CONTROL 1
-#endif
-#ifndef _POSIX_SAVED_IDS
-# define _POSIX_SAVED_IDS 1
-#endif
-# define _POSIX_VERSION 199009L
-#else
-#ifdef __svr4__
-# define _POSIX_JOB_CONTROL 1
-# define _POSIX_SAVED_IDS 1
-# define _POSIX_VERSION 199009L
-#endif
-#endif
-
-#ifdef __CYGWIN__
-# define _POSIX_JOB_CONTROL 1
-# define _POSIX_SAVED_IDS 0
-# define _POSIX_VERSION 199009L
-#endif
+#include <sys/features.h>
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
@@ -148,21 +140,73 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2));
long _EXFUN(sysconf, (int __name));
-# 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
-# define _SC_NPROCESSORS_CONF 9
-# define _SC_NPROCESSORS_ONLN 10
-# define _SC_PHYS_PAGES 11
-# define _SC_AVPHYS_PAGES 12
+/*
+ * 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
+#define _SC_AIO_LISTIO_MAX 9
+#define _SC_AIO_MAX 10
+#define _SC_AIO_PRIO_DELTA_MAX 11
+#define _SC_DELAYTIMER_MAX 12
+#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
+
+/*
+ * P1003.1c/D10, p. 52 adds the following.
+ */
+#define _SC_GETGR_R_SIZE_MAX 34
+#define _SC_GETPW_R_SIZE_MAX 35
+#define _SC_LOGIN_NAME_MAX 36
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS 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
+#define _SC_THREAD_PRIORITY_SCHEDULING 45
+#define _SC_THREAD_PRIO_INHERIT 46
+/* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
+#define _SC_THREAD_PRIO_PROTECT 47
+#define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT
+#define _SC_THREAD_PROCESS_SHARED 48
+#define _SC_THREAD_SAFE_FUNCTIONS 49
+
# define _PC_LINK_MAX 0
# define _PC_MAX_CANON 1
# define _PC_MAX_INPUT 2