diff --git a/sys/sys/_posix.h b/sys/sys/_posix.h index d75a29547fa5..a5a9c0195eca 100644 --- a/sys/sys/_posix.h +++ b/sys/sys/_posix.h @@ -69,12 +69,6 @@ #else -/* Default to existing user space version. - */ -#ifndef _POSIX_VERSION -#define _POSIX_VERSION 199009L -#endif - /* Test for visibility of P1003.1B features: * If _POSIX_SOURCE and POSIX_C_SOURCE are completely undefined * they show up. diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h index 9a05b2c3b921..159944300489 100644 --- a/sys/sys/syslimits.h +++ b/sys/sys/syslimits.h @@ -53,6 +53,7 @@ #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define IOV_MAX 1024 /* max elements in i/o vector */ +/* XXX - these don't belong here */ #define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ #define BC_DIM_MAX 2048 /* max array elements in bc(1) */ #define BC_SCALE_MAX 99 /* max scale value in bc(1) */ @@ -62,4 +63,10 @@ #define LINE_MAX 2048 /* max bytes in an input line */ #define RE_DUP_MAX 255 /* max RE's in interval notation */ +/* + * We leave the following values undefined to force applications to either + * assume conservative values or call sysconf() to get the current value. + * + * HOST_NAME_MAX + */ #endif diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index d96e005f22dd..76e5c544d8f1 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -37,56 +37,64 @@ #ifndef _SYS_UNISTD_H_ #define _SYS_UNISTD_H_ -#include +#include -/* compile-time symbolic constants */ -#define _POSIX_JOB_CONTROL /* implementation supports job control */ +/* + * POSIX options and option groups we unconditionally do or don't + * implement. Those options which are implemented (or not) entirely + * in user mode are defined in . Please keep this list in + * alphabetical order. + * + * Anything which is defined as zero below **must** have an + * implementation for the corresponding sysconf() which is able to + * determine conclusively whether or not the feature is supported. + * Anything which is defined as other than -1 below **must** have + * complete headers, types, and function declarations as specified by + * the POSIX standard; however, if the relevant sysconf() function + * returns -1, the functions may be stubbed out. + */ +#define _POSIX_ADVISORY_INFO -1 +#define _POSIX_ASYNCHRONOUS_IO 0 +#define _POSIX_CHOWN_RESTRICTED 1 +#define _POSIX_CLOCK_SELECTION -1 +#define _POSIX_CPUTIME -1 +#define _POSIX_FSYNC 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_REALTIME_SIGNALS -1 +#define _POSIX_SEMAPHORES -1 +#define _POSIX_SHARED_MEMORY_OBJECTS 200112L +#define _POSIX_SPORADIC_SERVER -1 +#define _POSIX_SYNCHRONIZED_IO -1 +#define _POSIX_TIMEOUTS -1 +#define _POSIX_TYPED_MEMORY_OBJECTS -1 +#define _POSIX_VDISABLE 0xff + +#if __XSI_VISIBLE +#define _XOPEN_SHM 1 +#define _XOPEN_STREAMS -1 +#endif /* * Although we have saved user/group IDs, we do not use them in setuid * as described in POSIX 1003.1, because the feature does not work for * root. We use the saved IDs in seteuid/setegid, which are not currently - * part of the POSIX 1003.1 specification. + * part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001 + * as this is now mandatory. */ #ifdef _NOT_AVAILABLE -#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ +#define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */ #endif -#define _POSIX2_VERSION 199212L - -/* execution-time symbolic constants */ - /* chown requires appropriate privileges */ -#define _POSIX_CHOWN_RESTRICTED 1 - /* too-long path components generate errors */ -#define _POSIX_NO_TRUNC 1 - /* may disable terminal special characters */ -#define _POSIX_VDISABLE 0xff - -/* - * Threads features: - * - * Note that those commented out are not currently supported by the - * implementation. - */ -#define _POSIX_THREADS -#define _POSIX_THREAD_ATTR_STACKADDR -#define _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_PRIORITY_SCHEDULING -#define _POSIX_THREAD_PRIO_INHERIT -#define _POSIX_THREAD_PRIO_PROTECT -/* #define _POSIX_THREAD_PROCESS_SHARED */ -/* - * 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS is - * defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined. (This is - * likely a typo (reversed dependency), in which case we would be compliant if - * the typo were officially acknowledged.) However, we do not support all of - * the required _r() interfaces, which means we cannot legitimately define - * _POSIX_THREAD_SAFE_FUNCTIONS. Therefore, we are non-compliant here in two - * ways. - */ -/* #define _POSIX_THREAD_SAFE_FUNCTIONS */ -#define _POSIX_SEMAPHORES - /* access function */ #define F_OK 0 /* test for existence of file */ #define X_OK 0x01 /* test for execute or search permission */ @@ -116,127 +124,54 @@ #define _PC_NO_TRUNC 8 #define _PC_VDISABLE 9 -/* configurable system variables */ -#define _SC_ARG_MAX 1 -#define _SC_CHILD_MAX 2 -#define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 -#define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 -#define _SC_SAVED_IDS 7 -#define _SC_VERSION 8 -#define _SC_BC_BASE_MAX 9 -#define _SC_BC_DIM_MAX 10 -#define _SC_BC_SCALE_MAX 11 -#define _SC_BC_STRING_MAX 12 -#define _SC_COLL_WEIGHTS_MAX 13 -#define _SC_EXPR_NEST_MAX 14 -#define _SC_LINE_MAX 15 -#define _SC_RE_DUP_MAX 16 -#define _SC_2_VERSION 17 -#define _SC_2_C_BIND 18 -#define _SC_2_C_DEV 19 -#define _SC_2_CHAR_TERM 20 -#define _SC_2_FORT_DEV 21 -#define _SC_2_FORT_RUN 22 -#define _SC_2_LOCALEDEF 23 -#define _SC_2_SW_DEV 24 -#define _SC_2_UPE 25 -#define _SC_STREAM_MAX 26 -#define _SC_TZNAME_MAX 27 - -#ifdef _P1003_1B_VISIBLE - -#define _POSIX_PRIORITY_SCHEDULING - -#if 0 -/* Not until the dust settles after the header commit - */ -#define _POSIX_ASYNCHRONOUS_IO -#define _POSIX_MEMLOCK -#define _POSIX_MEMLOCK_RANGE -#endif - -#define _POSIX_FSYNC 200112L -#define _POSIX_MAPPED_FILES 200112L -#define _POSIX_SHARED_MEMORY_OBJECTS 200112L - -/* POSIX.1B sysconf options */ -#define _SC_ASYNCHRONOUS_IO 28 -#define _SC_MAPPED_FILES 29 -#define _SC_MEMLOCK 30 -#define _SC_MEMLOCK_RANGE 31 -#define _SC_MEMORY_PROTECTION 32 -#define _SC_MESSAGE_PASSING 33 -#define _SC_PRIORITIZED_IO 34 -#define _SC_PRIORITY_SCHEDULING 35 -#define _SC_REALTIME_SIGNALS 36 -#define _SC_SEMAPHORES 37 -#define _SC_FSYNC 38 -#define _SC_SHARED_MEMORY_OBJECTS 39 -#define _SC_SYNCHRONIZED_IO 40 -#define _SC_TIMERS 41 -#define _SC_AIO_LISTIO_MAX 42 -#define _SC_AIO_MAX 43 -#define _SC_AIO_PRIO_DELTA_MAX 44 -#define _SC_DELAYTIMER_MAX 45 -#define _SC_MQ_OPEN_MAX 46 -#define _SC_PAGESIZE 47 -#define _SC_RTSIG_MAX 48 -#define _SC_SEM_NSEMS_MAX 49 -#define _SC_SEM_VALUE_MAX 50 -#define _SC_SIGQUEUE_MAX 51 -#define _SC_TIMER_MAX 52 - -/* POSIX.1B pathconf and fpathconf options */ +#if __POSIX_VISIBLE >= 199309 #define _PC_ASYNC_IO 53 #define _PC_PRIO_IO 54 #define _PC_SYNC_IO 55 +#endif -#endif /* _P1003_1B_VISIBLE */ +#if __POSIX_VISIBLE >= 200112 +#define _PC_ALLOC_SIZE_MIN 10 +#define _PC_FILESIZEBITS 12 +#define _PC_REC_INCR_XFER_SIZE 14 +#define _PC_REC_MAX_XFER_SIZE 15 +#define _PC_REC_MIN_XFER_SIZE 16 +#define _PC_REC_XFER_ALIGN 17 +#endif -#define _SC_IOV_MAX 56 - -#ifndef _POSIX_SOURCE - -/* Linux/Solaris/AIX/SVR4.0MP API */ -#define _SC_NPROCESSORS_CONF 57 -#define _SC_NPROCESSORS_ONLN 58 - -#endif /* !_POSIX_SOURCE */ - -/* POSIX.1e pathconf and fpathconf options */ +#if __BSD_VISIBLE +/* XXX: These symbols are in the WRONG namespace (should be _PC_*). */ #define _POSIX_ACL_EXTENDED 59 #define _POSIX_ACL_PATH_MAX 60 #define _POSIX_ACL_CAP_PRESENT 61 #define _POSIX_INF_PRESENT 62 #define _POSIX_MAC_PRESENT 63 +#endif -#ifndef _POSIX_SOURCE - +#if __BSD_VISIBLE /* * rfork() options. * * XXX currently, some operations without RFPROC set are not supported. */ -#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ -#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ -#define RFFDG (1<<2) /* copy fd table */ -#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ -#define RFPROC (1<<4) /* change child (else changes curproc) */ -#define RFMEM (1<<5) /* share `address space' */ -#define RFNOWAIT (1<<6) /* give child to init */ -#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ -#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ -#define RFCFDG (1<<12) /* close all fds, zero fd table */ -#define RFTHREAD (1<<13) /* enable kernel thread support */ -#define RFSIGSHARE (1<<14) /* share signal handlers */ -#define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ -#define RFSTOPPED (1<<17) /* leave child in a stopped state */ +#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ +#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ +#define RFFDG (1<<2) /* copy fd table */ +#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ +#define RFPROC (1<<4) /* change child (else changes curproc) */ +#define RFMEM (1<<5) /* share `address space' */ +#define RFNOWAIT (1<<6) /* give child to init */ +#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ +#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ +#define RFCFDG (1<<12) /* close all fds, zero fd table */ +#define RFTHREAD (1<<13) /* enable kernel thread support */ +#define RFSIGSHARE (1<<14) /* share signal handlers */ +#define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ +#define RFSTOPPED (1<<17) /* leave child in a stopped state */ #define RFHIGHPID (1<<18) /* use a pid higher then 10 (idleproc) */ -#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ -#define RFKERNELONLY (RFSTOPPED|RFHIGHPID|RFPPWAIT) +#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ +#define RFKERNELONLY (RFSTOPPED|RFHIGHPID|RFPPWAIT) -#endif /* !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ #endif /* !_SYS_UNISTD_H_ */