NAME

unistd.h - standard symbolic constants and types

SYNOPSIS

#include <unistd.h>

DESCRIPTION

The <unistd.h> header defines miscellaneous symbolic constants and types, and declares miscellaneous functions. The
actual values of the constants are unspecified except as shown. The contents of this header are shown below.

Version Test Macros

The following symbolic constants shall be defined:

_POSIX_VERSION

Integer value indicating version of IEEE Std 1003.1 (C-language binding) to which the implementation conforms. For
implementations conforming to IEEE Std 1003.1-2001, the value shall be 200112L.

_POSIX2_VERSION

Integer value indicating version of the Shell and Utilities volume of IEEE Std 1003.1 to which the implementation
conforms. For implementations conforming to IEEE Std 1003.1-2001, the value shall be 200112L.

The following symbolic constant shall be defined only if the implementation supports the XSI option; see XSI Conformance.

_XOPEN_VERSION

[XSI]
Integer value indicating version of the X/Open Portability Guide to which the implementation conforms. The value shall be 600.

Constants for Options and Option Groups

The following symbolic constants, if defined in <unistd.h>, shall have a value of -1, 0, or greater, unless
otherwise specified below. If these are undefined, the fpathconf(), pathconf(), or sysconf() functions can be
used to determine whether the option is provided for a particular invocation of the application.

If a symbolic constant is defined with the value -1, the option is not supported. Headers, data types, and function interfaces
required only for the option need not be supplied. An application that attempts to use anything associated only with the option is
considered to be requiring an extension.

If a symbolic constant is defined with a value greater than zero, the option shall always be supported when the application is
executed. All headers, data types, and functions shall be present and shall operate as specified.

If a symbolic constant is defined with the value zero, all headers, data types, and functions shall be present. The application
can check at runtime to see whether the option is supported by calling fpathconf(), pathconf(), or sysconf() with the indicated name parameter.

Unless explicitly specified otherwise, the behavior of functions associated with an unsupported option is unspecified, and an
application that uses such functions without first checking fpathconf(), pathconf(), or sysconf() is considered to be
requiring an extension.

[ADV]
The implementation supports the Advisory Information option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_ASYNCHRONOUS_IO

[AIO]
The implementation supports the Asynchronous Input and Output option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX_BARRIERS

[BAR]
The implementation supports the Barriers option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_CHOWN_RESTRICTED

The use of chown() and fchown() is
restricted to a process with appropriate privileges, and to changing the group ID of a file only to the effective group ID of the
process or to one of its supplementary group IDs. This symbol shall either be undefined or defined with a value other than -1.

_POSIX_CLOCK_SELECTION

[CS]
The implementation supports the Clock Selection option. If this symbol is defined in <unistd.h>, it shall be defined
to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either
be -1 or 200112L.

_POSIX_CPUTIME

[CPT]
The implementation supports the Process CPU-Time Clocks option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_FSYNC

[FSC]
The implementation supports the File Synchronization option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_IPV6

The implementation supports the IPv6 option. If this symbol is defined in <unistd.h>, it shall be defined to be -1, 0,
or 200112L. The value of this symbol reported by sysconf() shall either be -1 or
200112L.

_POSIX_JOB_CONTROL

The implementation supports job control. This symbol shall always be set to a value greater than zero.

_POSIX_MAPPED_FILES

[MF]
The implementation supports the Memory Mapped Files option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_MEMLOCK

[ML]
The implementation supports the Process Memory Locking option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_MEMLOCK_RANGE

[MR]
The implementation supports the Range Memory Locking option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_MEMORY_PROTECTION

[MPR]
The implementation supports the Memory Protection option. If this symbol is defined in <unistd.h>, it shall be defined
to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either
be -1 or 200112L.

_POSIX_MESSAGE_PASSING

[MSG]
The implementation supports the Message Passing option. If this symbol is defined in <unistd.h>, it shall be defined
to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either
be -1 or 200112L.

_POSIX_MONOTONIC_CLOCK

[MON]
The implementation supports the Monotonic Clock option. If this symbol is defined in <unistd.h>, it shall be defined
to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either
be -1 or 200112L.

_POSIX_NO_TRUNC

Pathname components longer than {NAME_MAX} generate an error. This symbol shall either be undefined or defined with a value other
than -1.

_POSIX_PRIORITIZED_IO

[PIO]
The implementation supports the Prioritized Input and Output option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_PRIORITY_SCHEDULING

[PS]
The implementation supports the Process Scheduling option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_RAW_SOCKETS

[RS]
The implementation supports the Raw Sockets option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_READER_WRITER_LOCKS

[THR]
The implementation supports the Read-Write Locks option. This is always set to a value greater than zero if the Threads option is
supported. If this symbol is defined in <unistd.h>, it shall be defined to be -1, 0, or 200112L. The value of this
symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX_REALTIME_SIGNALS

[RTS]
The implementation supports the Realtime Signals Extension option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_REGEXP

The implementation supports the Regular Expression Handling option. This symbol shall always be set to a value greater than
zero.

_POSIX_SAVED_IDS

Each process has a saved set-user-ID and a saved set-group-ID. This symbol shall always be set to a value greater than zero.

_POSIX_SEMAPHORES

[SEM]
The implementation supports the Semaphores option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_SHARED_MEMORY_OBJECTS

[SHM]
The implementation supports the Shared Memory Objects option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_SHELL

The implementation supports the POSIX shell. This symbol shall always be set to a value greater than zero.

_POSIX_SPAWN

[SPN]
The implementation supports the Spawn option. If this symbol is defined in <unistd.h>, it shall be defined to be -1,
0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or
200112L.

_POSIX_SPIN_LOCKS

[SPI]
The implementation supports the Spin Locks option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_SPORADIC_SERVER

[SS]
The implementation supports the Process Sporadic Server option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_SYNCHRONIZED_IO

[SIO]
The implementation supports the Synchronized Input and Output option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX_THREAD_ATTR_STACKADDR

[TSA]
The implementation supports the Thread Stack Address Attribute option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX_THREAD_ATTR_STACKSIZE

[TSS]
The implementation supports the Thread Stack Size Attribute option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_CPUTIME

[TCT]
The implementation supports the Thread CPU-Time Clocks option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_PRIO_INHERIT

[TPI]
The implementation supports the Thread Priority Inheritance option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_PRIO_PROTECT

[TPP]
The implementation supports the Thread Priority Protection option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_PRIORITY_SCHEDULING

[TPS]
The implementation supports the Thread Execution Scheduling option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_PROCESS_SHARED

[TSH]
The implementation supports the Thread Process-Shared Synchronization option. If this symbol is defined in <unistd.h>,
it shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX_THREAD_SAFE_FUNCTIONS

[TSF]
The implementation supports the Thread-Safe Functions option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREAD_SPORADIC_SERVER

[TSP]
The implementation supports the Thread Sporadic Server option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_THREADS

[THR]
The implementation supports the Threads option. If this symbol is defined in <unistd.h>, it shall be defined to be -1,
0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or
200112L.

_POSIX_TIMEOUTS

[TMO]
The implementation supports the Timeouts option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_TIMERS

[TMR]
The implementation supports the Timers option. If this symbol is defined in <unistd.h>, it shall be defined to be -1,
0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or
200112L.

_POSIX_TRACE

[TRC]
The implementation supports the Trace option. If this symbol is defined in <unistd.h>, it shall be defined to be -1,
0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or
200112L.

_POSIX_TRACE_EVENT_FILTER

[TEF]
The implementation supports the Trace Event Filter option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_TRACE_INHERIT

[TRI]
The implementation supports the Trace Inherit option. If this symbol is defined in <unistd.h>, it shall be defined to
be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be
-1 or 200112L.

_POSIX_TRACE_LOG

[TRL]
The implementation supports the Trace Log option. If this symbol is defined in <unistd.h>, it shall be defined to be
-1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1
or 200112L.

_POSIX_TYPED_MEMORY_OBJECTS

[TYM]
The implementation supports the Typed Memory Objects option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX_VDISABLE

This symbol shall be defined to be the value of a character that shall disable terminal special character handling as described in
<termios.h>. This symbol shall always be set to a value other than -1.

_POSIX2_C_BIND

The implementation supports the C-Language Binding option. This symbol shall always have the value 200112L.

_POSIX2_C_DEV

[CD]
The implementation supports the C-Language Development Utilities option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX2_CHAR_TERM

The implementation supports at least one terminal type.

_POSIX2_FORT_DEV

[FD]
The implementation supports the FORTRAN Development Utilities option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX2_FORT_RUN

[FR]
The implementation supports the FORTRAN Runtime Utilities option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX2_LOCALEDEF

The implementation supports the creation of locales by the localedef utility. If
this symbol is defined in <unistd.h>, it shall be defined to be -1, 0, or 200112L. The value of this symbol reported
by sysconf() shall either be -1 or 200112L.

_POSIX2_PBS

[BE]
The implementation supports the Batch Environment Services and Utilities option. If this symbol is defined in
<unistd.h>, it shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX2_PBS_ACCOUNTING

[BE]
The implementation supports the Batch Accounting option. If this symbol is defined in <unistd.h>, it shall be defined
to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either
be -1 or 200112L.

_POSIX2_PBS_CHECKPOINT

[BE]
The implementation supports the Batch Checkpoint/Restart option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX2_PBS_LOCATE

[BE]
The implementation supports the Locate Batch Job Request option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX2_PBS_MESSAGE

[BE]
The implementation supports the Batch Job Message Request option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX2_PBS_TRACK

[BE]
The implementation supports the Track Batch Job Request option. If this symbol is defined in <unistd.h>, it shall be
defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

_POSIX2_SW_DEV

[SD]
The implementation supports the Software Development Utilities option. If this symbol is defined in <unistd.h>, it
shall be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf() shall either be -1 or 200112L.

_POSIX2_UPE

[UP]
The implementation supports the User Portability Utilities option. If this symbol is defined in <unistd.h>, it shall
be defined to be -1, 0, or 200112L. The value of this symbol reported by sysconf()
shall either be -1 or 200112L.

Execution-Time Symbolic Constants

If any of the following constants are not defined in the <unistd.h> header, the value shall vary depending on the
file to which it is applied.

If any of the following constants are defined to have value -1 in the <unistd.h> header, the implementation shall
not provide the option on any file; if any are defined to have a value other than -1 in the <unistd.h> header, the
implementation shall provide the option on all applicable files.

All of the following constants, whether defined in <unistd.h> or not, may be queried with respect to a specific
file using the pathconf() or fpathconf() functions:

_POSIX_ASYNC_IO

Asynchronous input or output operations may be performed for the associated file.

_POSIX_PRIO_IO

Prioritized input or output operations may be performed for the associated file.

_POSIX_SYNC_IO

Synchronized input or output operations may be performed for the associated file.

Constants for Functions

The following symbolic constant shall be defined:

NULL

Null pointer

The following symbolic constants shall be defined for the access() function:

F_OK

Test for existence of file.

R_OK

Test for read permission.

W_OK

Test for write permission.

X_OK

Test for execute (search) permission.

The constants F_OK, R_OK, W_OK, and X_OK and the expressions R_OK|W_OK, R_OK|X_OK, and
R_OK|W_OK|X_OK shall all have distinct values.

The following symbolic constants shall be defined for the confstr() function:

_CS_PATH

This is the value for the PATH environment variable that finds all standard utilities.

_CS_POSIX_V6_ILP32_OFF32_CFLAGS

If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
initial options to be given to the c99 utility to build an application using a
programming model with 32-bit int, long, pointer, and off_t types.

_CS_POSIX_V6_ILP32_OFF32_LDFLAGS

If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
final options to be given to the c99 utility to build an application using a programming
model with 32-bit int, long, pointer, and off_t types.

_CS_POSIX_V6_ILP32_OFF32_LIBS

If sysconf(_SC_V6_ILP32_OFF32) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
libraries to be given to the c99 utility to build an application using a programming
model with 32-bit int, long, pointer, and off_t types.

_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS

If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
initial options to be given to the c99 utility to build an application using a
programming model with 32-bit int, long, and pointer types, and an off_t type using at least 64
bits.

_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS

If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
final options to be given to the c99 utility to build an application using a programming
model with 32-bit int, long, and pointer types, and an off_t type using at least 64 bits.

_CS_POSIX_V6_ILP32_OFFBIG_LIBS

If sysconf(_SC_V6_ILP32_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
libraries to be given to the c99 utility to build an application using a programming
model with 32-bit int, long, and pointer types, and an off_t type using at least 64 bits.

_CS_POSIX_V6_LP64_OFF64_CFLAGS

If sysconf(_SC_V6_LP64_OFF64) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
initial options to be given to the c99 utility to build an application using a
programming model with 32-bit int and 64-bit long, pointer, and off_t types.

_CS_POSIX_V6_LP64_OFF64_LDFLAGS

If sysconf(_SC_V6_LP64_OFF64) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
final options to be given to the c99 utility to build an application using a programming
model with 32-bit int and 64-bit long, pointer, and off_t types.

_CS_POSIX_V6_LP64_OFF64_LIBS

If sysconf(_SC_V6_LP64_OFF64) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
libraries to be given to the c99 utility to build an application using a programming
model with 32-bit int and 64-bit long, pointer, and off_t types.

_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS

If sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
initial options to be given to the c99 utility to build an application using a
programming model with an int type using at least 32 bits and long, pointer, and off_t types using at
least 64 bits.

_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS

If sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
final options to be given to the c99 utility to build an application using a programming
model with an int type using at least 32 bits and long, pointer, and off_t types using at least 64
bits.

_CS_POSIX_V6_LPBIG_OFFBIG_LIBS

If sysconf(_SC_V6_LPBIG_OFFBIG) returns -1, the meaning of this value is unspecified. Otherwise, this value is the set of
libraries to be given to the c99 utility to build an application using a programming
model with an int type using at least 32 bits and long, pointer, and off_t types using at least 64
bits.

_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS

This value is a <newline>-separated list of names of programming environments supported by the implementation in which the
widths of the blksize_t, cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t,
speed_t, ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and wint_t types are
no greater than the width of type long. The format of each name shall be suitable for use with the getconf-v option.

[XSI]
The following symbolic constants are reserved for compatibility with Issue 5:

APPLICATION USAGE

IEEE Std 1003.1-2001 only describes the behavior of systems that claim conformance to it. However, application
developers who want to write applications that adapt to other versions of IEEE Std 1003.1 (or to systems that do not
conform to any POSIX standard) may find it useful to code them so as to conditionally compile different code depending on the value
of _POSIX_VERSION, for example:

#if _POSIX_VERSION >= 200112L
/* Use the newer function that copes with large files. */
off_t pos=ftello(fp);
#else
/* Either this is an old version of POSIX, or _POSIX_VERSION is
not even defined, so use the traditional function. */
long pos=ftell(fp);
#endif

Earlier versions of IEEE Std 1003.1 and of the Single UNIX Specification can be identified by the following
macros:

POSIX.1-1988 standard

_POSIX_VERSION==198808L

POSIX.1-1990 standard

_POSIX_VERSION==199009L

ISO POSIX-1:1996 standard

_POSIX_VERSION==199506L

Single UNIX Specification, Version 1

_XOPEN_UNIX and _XOPEN_VERSION==4

Single UNIX Specification, Version 2

_XOPEN_UNIX and _XOPEN_VERSION==500

IEEE Std 1003.1-2001 does not make any attempt to define application binary interaction with the underlying operating
system. However, application developers may find it useful to query _SC_VERSION at runtime via sysconf() to determine whether the current version of the operating system supports the
necessary functionality as in the following program fragment:

RATIONALE

As IEEE Std 1003.1-2001 evolved, certain options became sufficiently standardized that it was concluded that simply
requiring one of the option choices was simpler than retaining the option. However, for backwards-compatibility, the option flags
(with required constant values) are retained.

Version Test Macros

The standard developers considered altering the definition of _POSIX_VERSION and removing _SC_VERSION from the specification of
sysconf() since the utility to an application was deemed by some to be minimal, and
since the implementation of the functionality is potentially problematic. However, they recognized that support for existing
application binaries is a concern to manufacturers, application developers, and the users of implementations conforming to
IEEE Std 1003.1-2001.

While the example using _SC_VERSION in the APPLICATION USAGE section does not provide the greatest degree of imaginable utility
to the application developer or user, it is arguably better than a core file or some other equally obscure result. (It is
also possible for implementations to encode and recognize application binaries compiled in various POSIX.1-conforming environments,
and modify the semantics of the underlying system to conform to the expectations of the application.) For the reasons outlined in
the preceding paragraphs and in the APPLICATION USAGE section, the standard developers elected to retain the _POSIX_VERSION and
_SC_VERSION functionality.

Compile-Time Symbolic Constants for System-Wide Options

IEEE Std 1003.1-2001 now includes support in certain areas for the newly adopted policy governing options and
stubs.

This policy provides flexibility for implementations in how they support options. It also specifies how conforming applications
can adapt to different implementations that support different sets of options. It allows the following:

If an implementation has no interest in supporting an option, it does not have to provide anything associated with that option
beyond the announcement that it does not support it.

An implementation can support a partial or incompatible version of an option (as a non-standard extension) as long as it does
not claim to support the option.

An application can determine whether the option is supported. A strictly conforming application must check this announcement
mechanism before first using anything associated with the option.

There is an important implication of this policy. IEEE Std 1003.1-2001 cannot dictate the behavior of interfaces
associated with an option when the implementation does not claim to support the option. In particular, it cannot require that a
function associated with an unsupported option will fail if it does not perform as specified. However, this policy does not prevent
a standard from requiring certain functions to always be present, but that they shall always fail on some implementations. The setpgid() function in the POSIX.1-1990 standard, for example, is considered
appropriate.

The POSIX standards include various options, and the C-language binding support for an option implies that the implementation
must supply data types and function interfaces. An application must be able to discover whether the implementation supports each
option.

Any application must consider the following three cases for each option:

Option never supported.

The implementation advertises at compile time that the option will never be supported. In this case, it is not necessary for the
implementation to supply any of the data types or function interfaces that are provided only as part of the option. The
implementation might provide data types and functions that are similar to those defined by IEEE Std 1003.1-2001, but
there is no guarantee for any particular behavior.

Option always supported.

The implementation advertises at compile time that the option will always be supported. In this case, all data types and
function interfaces shall be available and shall operate as specified.

Option might or might not be supported.

Some implementations might not provide a mechanism to specify support of options at compile time. In addition, the
implementation might be unable or unwilling to specify support or non-support at compile time. In either case, any application that
might use the option at runtime must be able to compile and execute. The implementation must provide, at compile time, all data
types and function interfaces that are necessary to allow this. In this situation, there must be a mechanism that allows the
application to query, at runtime, whether the option is supported. If the application attempts to use the option when it is not
supported, the result is unspecified unless explicitly specified otherwise in IEEE Std 1003.1-2001.

CHANGE HISTORY

Issue 5

The DESCRIPTION is updated for alignment with the POSIX Realtime Extension and the POSIX Threads Extension.

The symbolic constants _XOPEN_REALTIME and _XOPEN_REALTIME_THREADS are added. _POSIX2_C_BIND, _XOPEN_ENH_I18N, and _XOPEN_SHM
must now be set to a value other than -1 by a conforming implementation.

Large File System extensions are added.

The type of the argument to sbrk() is changed from int to intptr_t.

_XBS_ constants are added to the list of constants for Options and Option Groups, to the list of constants for the confstr() function, and to the list of constants to the sysconf() function. These are all marked EX.

Issue 6

_POSIX2_C_VERSION is removed.

The Open Group Corrigendum U026/4 is applied, adding the prototype for fdatasync().

The Open Group Corrigendum U026/1 is applied, adding the symbols _SC_XOPEN_LEGACY, _SC_XOPEN_REALTIME, and
_SC_XOPEN_REALTIME_THREADS.

The symbols _XOPEN_STREAMS and _SC_XOPEN_STREAMS are added to support the XSI STREAMS Option Group.

Text in the DESCRIPTION relating to conformance requirements is moved elsewhere in IEEE Std 1003.1-2001.

The legacy symbol _SC_PASS_MAX is removed.

The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:

The _CS_POSIX_* and _CS_XBS5_* constants are added for the confstr()
function.

IEEE Std 1003.1-2001/Cor 1-2002, item XBD/TC1/D6/25 is applied, adding the following text to the APPLICATION USAGE
section: ``New applications should not use _XOPEN_SHM or _XOPEN_ENH_I18N.''.

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/29 is applied, clarifying the requirements for when constants
for Options and Option Groups can be defined or undefined.

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/30 is applied, changing the _V6_ILP32_OFF32, _V6_ILP32_OFFBIG,
_V6_LP64_OFF64, and _V6_LPBIG_OFFBIG symbols to _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF64, and
_POSIX_V6_LPBIG_OFFBIG, respectively. This is for consistency with the sysconf() and
c99 reference pages.

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/31 is applied, adding that the format of names of programming
environments can be obtained using the getconf-v option.

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/34 is applied, updating the prototype for the symlink() function to match that in the System Interfaces volume of
IEEE Std 1003.1-2001.

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/35 is applied, adding _PC_2_SYMLINKS to the symbolic constants
list for pathconf(). This corresponds to the definition of POSIX2_SYMLINKS in the
Shell and Utilities volume of IEEE Std 1003.1-2001.

End of informative text.

UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
[ Main Index | XBD | XCU | XSH | XRAT
]