man-pages/man0p/unistd.h.0p

1397 lines
39 KiB
Plaintext

.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "<unistd.h>" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <unistd.h>
.SH NAME
unistd.h \- standard symbolic constants and types
.SH SYNOPSIS
.LP
\fB#include <unistd.h>\fP
.SH DESCRIPTION
.LP
The \fI<unistd.h>\fP 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.
.SS Version Test Macros
.LP
The following symbolic constants shall be defined:
.TP 7
_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.
.TP 7
_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.
.sp
.LP
The following symbolic constant shall be defined only if the implementation
supports the XSI option; see \fIXSI Conformance\fP .
.TP 7
_XOPEN_VERSION
.sp
Integer value indicating version of the X/Open Portability Guide to
which the implementation conforms. The value shall be 600.
.sp
.SS Constants for Options and Option Groups
.LP
The following symbolic constants, if defined in \fI<unistd.h>\fP,
shall have a value of -1, 0, or greater, unless
otherwise specified below. If these are undefined, the \fIfpathconf\fP(),
\fIpathconf\fP(), or \fIsysconf\fP() functions can be
used to determine whether the option is provided for a particular
invocation of the application.
.LP
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.
.LP
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.
.LP
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
\fIfpathconf\fP(), \fIpathconf\fP(), or \fIsysconf\fP() with the indicated
\fIname\fP parameter.
.LP
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 \fIfpathconf\fP(),
\fIpathconf\fP(), or \fIsysconf\fP() is considered to be
requiring an extension.
.LP
For conformance requirements, refer to \fIConformance\fP .
.TP 7
_POSIX_ADVISORY_INFO
.sp
The implementation supports the Advisory Information option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_ASYNCHRONOUS_IO
.sp
The implementation supports the Asynchronous Input and Output option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_BARRIERS
.sp
The implementation supports the Barriers option. If this symbol has
a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_CHOWN_RESTRICTED
The use of \fIchown\fP() and \fIfchown\fP() 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
always be set to a value other than -1.
.TP 7
_POSIX_CLOCK_SELECTION
.sp
The implementation supports the Clock Selection option. If this symbol
has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_CPUTIME
.sp
The implementation supports the Process CPU-Time Clocks option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_FSYNC
.sp
The implementation supports the File Synchronization option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_IPV6
The implementation supports the IPv6 option. If this symbol has a
value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_JOB_CONTROL
The implementation supports job control. This symbol shall always
be set to a value greater than zero.
.TP 7
_POSIX_MAPPED_FILES
.sp
The implementation supports the Memory Mapped Files option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_MEMLOCK
.sp
The implementation supports the Process Memory Locking option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_MEMLOCK_RANGE
.sp
The implementation supports the Range Memory Locking option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_MEMORY_PROTECTION
.sp
The implementation supports the Memory Protection option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_MESSAGE_PASSING
.sp
The implementation supports the Message Passing option. If this symbol
has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_MONOTONIC_CLOCK
.sp
The implementation supports the Monotonic Clock option. If this symbol
has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_NO_TRUNC
Pathname components longer than {NAME_MAX} generate an error. This
symbol shall always be set to a value other than -1.
.TP 7
_POSIX_PRIORITIZED_IO
.sp
The implementation supports the Prioritized Input and Output option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_PRIORITY_SCHEDULING
.sp
The implementation supports the Process Scheduling option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_RAW_SOCKETS
.sp
The implementation supports the Raw Sockets option. If this symbol
has a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_READER_WRITER_LOCKS
.sp
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 has a value other than -1 or 0, it shall
have the value 200112L.
.TP 7
_POSIX_REALTIME_SIGNALS
.sp
The implementation supports the Realtime Signals Extension option.
If this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_REGEXP
The implementation supports the Regular Expression Handling option.
This symbol shall always be set to a value greater than
zero.
.TP 7
_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.
.TP 7
_POSIX_SEMAPHORES
.sp
The implementation supports the Semaphores option. If this symbol
has a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_SHARED_MEMORY_OBJECTS
.sp
The implementation supports the Shared Memory Objects option. If this
symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_SHELL
The implementation supports the POSIX shell. This symbol shall always
be set to a value greater than zero.
.TP 7
_POSIX_SPAWN
.sp
The implementation supports the Spawn option. If this symbol has a
value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_SPIN_LOCKS
.sp
The implementation supports the Spin Locks option. If this symbol
has a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_SPORADIC_SERVER
.sp
The implementation supports the Process Sporadic Server option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_SYNCHRONIZED_IO
.sp
The implementation supports the Synchronized Input and Output option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_THREAD_ATTR_STACKADDR
.sp
The implementation supports the Thread Stack Address Attribute option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_THREAD_ATTR_STACKSIZE
.sp
The implementation supports the Thread Stack Size Attribute option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_THREAD_CPUTIME
.sp
The implementation supports the Thread CPU-Time Clocks option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_THREAD_PRIO_INHERIT
.sp
The implementation supports the Thread Priority Inheritance option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_THREAD_PRIO_PROTECT
.sp
The implementation supports the Thread Priority Protection option.
If this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_THREAD_PRIORITY_SCHEDULING
.sp
The implementation supports the Thread Execution Scheduling option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX_THREAD_PROCESS_SHARED
.sp
The implementation supports the Thread Process-Shared Synchronization
option. If this symbol has a value other than -1 or 0, it
shall have the value 200112L.
.TP 7
_POSIX_THREAD_SAFE_FUNCTIONS
.sp
The implementation supports the Thread-Safe Functions option. If this
symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_THREAD_SPORADIC_SERVER
.sp
The implementation supports the Thread Sporadic Server option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX_THREADS
.sp
The implementation supports the Threads option. If this symbol has
a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_TIMEOUTS
.sp
The implementation supports the Timeouts option. If this symbol has
a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_TIMERS
.sp
The implementation supports the Timers option. If this symbol has
a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_TRACE
.sp
The implementation supports the Trace option. If this symbol has a
value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_TRACE_EVENT_FILTER
.sp
The implementation supports the Trace Event Filter option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_TRACE_INHERIT
.sp
The implementation supports the Trace Inherit option. If this symbol
has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_TRACE_LOG
.sp
The implementation supports the Trace Log option. If this symbol has
a value other than -1 or 0, it shall have the value 200112L.
.TP 7
_POSIX_TYPED_MEMORY_OBJECTS
.sp
The implementation supports the Typed Memory Objects option. If this
symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX_VDISABLE
This symbol shall be defined to be the value of a character that shall
disable terminal special character handling as described in
\fI<termios.h>\fP . This symbol shall always be set to a value other
than -1.
.TP 7
_POSIX2_C_BIND
The implementation supports the C-Language Binding option. This symbol
shall always have the value 200112L.
.TP 7
_POSIX2_C_DEV
.sp
The implementation supports the C-Language Development Utilities option.
If this symbol has a value other than -1 or 0, it shall
have the value 200112L.
.TP 7
_POSIX2_CHAR_TERM
The implementation supports at least one terminal type.
.TP 7
_POSIX2_FORT_DEV
.sp
The implementation supports the FORTRAN Development Utilities option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX2_FORT_RUN
.sp
The implementation supports the FORTRAN Runtime Utilities option.
If this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX2_LOCALEDEF
The implementation supports the creation of locales by the \fIlocaledef\fP
utility. If
this symbol has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX2_PBS
.sp
The implementation supports the Batch Environment Services and Utilities
option. If this symbol has a value other than -1 or 0, it
shall have the value 200112L.
.TP 7
_POSIX2_PBS_ACCOUNTING
.sp
The implementation supports the Batch Accounting option. If this symbol
has a value other than -1 or 0, it shall have the value
200112L.
.TP 7
_POSIX2_PBS_CHECKPOINT
.sp
The implementation supports the Batch Checkpoint/Restart option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX2_PBS_LOCATE
.sp
The implementation supports the Locate Batch Job Request option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX2_PBS_MESSAGE
.sp
The implementation supports the Batch Job Message Request option.
If this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX2_PBS_TRACK
.sp
The implementation supports the Track Batch Job Request option. If
this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_POSIX2_SW_DEV
.sp
The implementation supports the Software Development Utilities option.
If this symbol has a value other than -1 or 0, it shall have
the value 200112L.
.TP 7
_POSIX2_UPE
.sp
The implementation supports the User Portability Utilities option.
If this symbol has a value other than -1 or 0, it shall have the
value 200112L.
.TP 7
_V6_ILP32_OFF32
The implementation provides a C-language compilation environment with
32-bit \fBint\fP, \fBlong\fP, \fBpointer\fP, and
\fBoff_t\fP types.
.TP 7
_V6_ILP32_OFFBIG
The implementation provides a C-language compilation environment with
32-bit \fBint\fP, \fBlong\fP, and \fBpointer\fP types and
an \fBoff_t\fP type using at least 64 bits.
.TP 7
_V6_LP64_OFF64
The implementation provides a C-language compilation environment with
32-bit \fBint\fP and 64-bit \fBlong\fP, \fBpointer\fP, and
\fBoff_t\fP types.
.TP 7
_V6_LPBIG_OFFBIG
The implementation provides a C-language compilation environment with
an \fBint\fP type using at least 32 bits and \fBlong\fP,
\fBpointer\fP, and \fBoff_t\fP types using at least 64 bits.
.TP 7
_XBS5_ILP32_OFF32 (\fBLEGACY\fP)
.sp
The implementation provides a C-language compilation environment with
32-bit \fBint\fP, \fBlong\fP, \fBpointer\fP, and
\fBoff_t\fP types.
.TP 7
_XBS5_ILP32_OFFBIG (\fBLEGACY\fP)
.sp
The implementation provides a C-language compilation environment with
32-bit \fBint\fP, \fBlong\fP, and \fBpointer\fP types and
an \fBoff_t\fP type using at least 64 bits.
.TP 7
_XBS5_LP64_OFF64 (\fBLEGACY\fP)
.sp
The implementation provides a C-language compilation environment with
32-bit \fBint\fP and 64-bit \fBlong\fP, \fBpointer\fP, and
\fBoff_t\fP types.
.TP 7
_XBS5_LPBIG_OFFBIG (\fBLEGACY\fP)
.sp
The implementation provides a C-language compilation environment with
an \fBint\fP type using at least 32 bits and \fBlong\fP,
\fBpointer\fP, and \fBoff_t\fP types using at least 64 bits.
.TP 7
_XOPEN_CRYPT
.sp
The implementation supports the X/Open Encryption Option Group.
.TP 7
_XOPEN_ENH_I18N
The implementation supports the Issue 4, Version 2 Enhanced Internationalization
Option Group. This symbol shall always be set to a
value other than -1.
.TP 7
_XOPEN_LEGACY
The implementation supports the Legacy Option Group.
.TP 7
_XOPEN_REALTIME
The implementation supports the X/Open Realtime Option Group.
.TP 7
_XOPEN_REALTIME_THREADS
The implementation supports the X/Open Realtime Threads Option Group.
.TP 7
_XOPEN_SHM
The implementation supports the Issue 4, Version 2 Shared Memory Option
Group. This symbol shall always be set to a value other
than -1.
.TP 7
_XOPEN_STREAMS
The implementation supports the XSI STREAMS Option Group.
.TP 7
_XOPEN_UNIX
.sp
The implementation supports the XSI extension.
.sp
.SS Execution-Time Symbolic Constants
.LP
If any of the following constants are not defined in the \fI<unistd.h>\fP
header, the value shall vary depending on the
file to which it is applied.
.LP
If any of the following constants are defined to have value -1 in
the \fI<unistd.h>\fP header, the implementation shall
not provide the option on any file; if any are defined to have a value
other than -1 in the \fI<unistd.h>\fP header, the
implementation shall provide the option on all applicable files.
.LP
All of the following constants, whether defined in \fI<unistd.h>\fP
or not, may be queried with respect to a specific
file using the \fIpathconf\fP() or \fIfpathconf\fP() functions:
.TP 7
_POSIX_ASYNC_IO
Asynchronous input or output operations may be performed for the associated
file.
.TP 7
_POSIX_PRIO_IO
Prioritized input or output operations may be performed for the associated
file.
.TP 7
_POSIX_SYNC_IO
Synchronized input or output operations may be performed for the associated
file.
.sp
.SS Constants for Functions
.LP
The following symbolic constant shall be defined:
.TP 7
NULL
Null pointer
.sp
.LP
The following symbolic constants shall be defined for the \fIaccess\fP()
function:
.TP 7
F_OK
Test for existence of file.
.TP 7
R_OK
Test for read permission.
.TP 7
W_OK
Test for write permission.
.TP 7
X_OK
Test for execute (search) permission.
.sp
.LP
The constants F_OK, R_OK, W_OK, and X_OK and the expressions \fIR_OK\fP|\fIW_OK\fP,
\fIR_OK\fP|\fIX_OK\fP, and
\fIR_OK\fP|\fIW_OK\fP|\fIX_OK\fP shall all have distinct values.
.LP
The following symbolic constants shall be defined for the \fIconfstr\fP()
function:
.TP 7
_CS_PATH
This is the value for the \fIPATH\fP environment variable that finds
all standard utilities.
.TP 7
_CS_POSIX_V6_ILP32_OFF32_CFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a
programming model with 32-bit \fBint\fP, \fBlong\fP, \fBpointer\fP,
and \fBoff_t\fP types.
.TP 7
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP, \fBlong\fP, \fBpointer\fP, and \fBoff_t\fP
types.
.TP 7
_CS_POSIX_V6_ILP32_OFF32_LIBS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP, \fBlong\fP, \fBpointer\fP, and \fBoff_t\fP
types.
.TP 7
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a
programming model with 32-bit \fBint\fP, \fBlong\fP, and \fBpointer\fP
types, and an \fBoff_t\fP type using at least 64
bits.
.TP 7
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP, \fBlong\fP, and \fBpointer\fP types,
and an \fBoff_t\fP type using at least 64 bits.
.TP 7
_CS_POSIX_V6_ILP32_OFFBIG_LIBS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP, \fBlong\fP, and \fBpointer\fP types,
and an \fBoff_t\fP type using at least 64 bits.
.TP 7
_CS_POSIX_V6_LP64_OFF64_CFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a
programming model with 32-bit \fBint\fP and 64-bit \fBlong\fP, \fBpointer\fP,
and \fBoff_t\fP types.
.TP 7
_CS_POSIX_V6_LP64_OFF64_LDFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP and 64-bit \fBlong\fP, \fBpointer\fP,
and \fBoff_t\fP types.
.TP 7
_CS_POSIX_V6_LP64_OFF64_LIBS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with 32-bit \fBint\fP and 64-bit \fBlong\fP, \fBpointer\fP,
and \fBoff_t\fP types.
.TP 7
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a
programming model with an \fBint\fP type using at least 32 bits and
\fBlong\fP, \fBpointer\fP, and \fBoff_t\fP types using at
least 64 bits.
.TP 7
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with an \fBint\fP type using at least 32 bits and \fBlong\fP,
\fBpointer\fP, and \fBoff_t\fP types using at least 64
bits.
.TP 7
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
If \fIsysconf\fP(_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 \fIc99\fP utility to build an application
using a programming
model with an \fBint\fP type using at least 32 bits and \fBlong\fP,
\fBpointer\fP, and \fBoff_t\fP types using at least 64
bits.
.TP 7
_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 \fBblksize_t\fP, \fBcc_t\fP, \fBmode_t\fP, \fBnfds_t\fP,
\fBpid_t\fP, \fBptrdiff_t\fP, \fBsize_t\fP,
\fBspeed_t\fP, \fBssize_t\fP, \fBsuseconds_t\fP, \fBtcflag_t\fP, \fBuseconds_t\fP,
\fBwchar_t\fP, and \fBwint_t\fP types are
no greater than the width of type \fBlong\fP.
.sp
.LP
The following symbolic constants are reserved for compatibility with
Issue 5:
.LP
.sp
_CS_XBS5_ILP32_OFF32_CFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFF32_LDFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFF32_LIBS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFF32_LINTFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFFBIG_CFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFFBIG_LDFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFFBIG_LIBS (\fBLEGACY\fP)
.br
_CS_XBS5_ILP32_OFFBIG_LINTFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LP64_OFF64_CFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LP64_OFF64_LDFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LP64_OFF64_LIBS (\fBLEGACY\fP)
.br
_CS_XBS5_LP64_OFF64_LINTFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LPBIG_OFFBIG_CFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LPBIG_OFFBIG_LDFLAGS (\fBLEGACY\fP)
.br
_CS_XBS5_LPBIG_OFFBIG_LIBS (\fBLEGACY\fP)
.br
_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS (\fBLEGACY\fP)
.br
.sp
.LP
The following symbolic constants shall be defined for the \fIlseek\fP()
and \fIfcntl\fP() functions and shall have distinct values:
.TP 7
SEEK_CUR
Set file offset to current plus \fIoffset\fP.
.TP 7
SEEK_END
Set file offset to EOF plus \fIoffset\fP.
.TP 7
SEEK_SET
Set file offset to \fIoffset\fP.
.sp
.LP
The following symbolic constants shall be defined as possible values
for the \fIfunction\fP argument to the \fIlockf\fP() function:
.TP 7
F_LOCK
Lock a section for exclusive use.
.TP 7
F_TEST
Test section for locks by other processes.
.TP 7
F_TLOCK
Test and lock a section for exclusive use.
.TP 7
F_ULOCK
Unlock locked sections.
.sp
.LP
The following symbolic constants shall be defined for \fIpathconf\fP():
.LP
.sp
_PC_ALLOC_SIZE_MIN
.br
_PC_ASYNC_IO
.br
_PC_CHOWN_RESTRICTED
.br
_PC_FILESIZEBITS
.br
_PC_LINK_MAX
.br
_PC_MAX_CANON
.br
_PC_MAX_INPUT
.br
_PC_NAME_MAX
.br
_PC_NO_TRUNC
.br
_PC_PATH_MAX
.br
_PC_PIPE_BUF
.br
_PC_PRIO_IO
.br
_PC_REC_INCR_XFER_SIZE
.br
_PC_REC_MIN_XFER_SIZE
.br
_PC_REC_XFER_ALIGN
.br
_PC_SYMLINK_MAX
.br
_PC_SYNC_IO
.br
_PC_VDISABLE
.br
.LP
The following symbolic constants shall be defined for \fIsysconf\fP():
.LP
.sp
_SC_2_C_BIND
.br
_SC_2_C_DEV
.br
_SC_2_C_VERSION
.br
_SC_2_CHAR_TERM
.br
_SC_2_FORT_DEV
.br
_SC_2_FORT_RUN
.br
_SC_2_LOCALEDEF
.br
_SC_2_PBS
.br
_SC_2_PBS_ACCOUNTING
.br
_SC_2_PBS_CHECKPOINT
.br
_SC_2_PBS_LOCATE
.br
_SC_2_PBS_MESSAGE
.br
_SC_2_PBS_TRACK
.br
_SC_2_SW_DEV
.br
_SC_2_UPE
.br
_SC_2_VERSION
.br
_SC_ADVISORY_INFO
.br
_SC_ARG_MAX
.br
_SC_AIO_LISTIO_MAX
.br
_SC_AIO_MAX
.br
_SC_AIO_PRIO_DELTA_MAX
.br
_SC_ASYNCHRONOUS_IO
.br
_SC_ATEXIT_MAX
.br
_SC_BARRIERS
.br
_SC_BC_BASE_MAX
.br
_SC_BC_DIM_MAX
.br
_SC_BC_SCALE_MAX
.br
_SC_BC_STRING_MAX
.br
_SC_CHILD_MAX
.br
_SC_CLK_TCK
.br
_SC_CLOCK_SELECTION
.br
_SC_COLL_WEIGHTS_MAX
.br
_SC_CPUTIME
.br
_SC_DELAYTIMER_MAX
.br
_SC_EXPR_NEST_MAX
.br
_SC_FILE_LOCKING
.br
_SC_FSYNC
.br
_SC_GETGR_R_SIZE_MAX
.br
_SC_GETPW_R_SIZE_MAX
.br
_SC_HOST_NAME_MAX
.br
_SC_IOV_MAX
.br
_SC_IPV6
.br
_SC_JOB_CONTROL
.br
_SC_LINE_MAX
.br
_SC_LOGIN_NAME_MAX
.br
_SC_MAPPED_FILES
.br
_SC_MEMLOCK
.br
_SC_MEMLOCK_RANGE
.br
_SC_MEMORY_PROTECTION
.br
_SC_MESSAGE_PASSING
.br
_SC_MONOTONIC_CLOCK
.br
_SC_MQ_OPEN_MAX
.br
_SC_MQ_PRIO_MAX
.br
_SC_NGROUPS_MAX
.br
_SC_OPEN_MAX
.br
_SC_PAGE_SIZE
.br
_SC_PAGESIZE
.br
_SC_PRIORITIZED_IO
.br
_SC_PRIORITY_SCHEDULING
.br
_SC_RAW_SOCKETS
.br
_SC_RE_DUP_MAX
.br
_SC_READER_WRITER_LOCKS
.br
_SC_REALTIME_SIGNALS
.br
_SC_REGEXP
.br
_SC_RTSIG_MAX
.br
_SC_SAVED_IDS
.br
_SC_SEMAPHORES
.br
_SC_SEM_NSEMS_MAX
.br
_SC_SEM_VALUE_MAX
.br
_SC_SHARED_MEMORY_OBJECTS
.br
_SC_SHELL
.br
_SC_SIGQUEUE_MAX
.br
_SC_SPAWN
.br
_SC_SPIN_LOCKS
.br
_SC_SPORADIC_SERVER
.br
_SC_STREAM_MAX
.br
_SC_SYMLOOP_MAX
.br
_SC_SYNCHRONIZED_IO
.br
_SC_THREAD_ATTR_STACKADDR
.br
_SC_THREAD_ATTR_STACKSIZE
.br
_SC_THREAD_CPUTIME
.br
_SC_THREAD_DESTRUCTOR_ITERATIONS
.br
_SC_THREAD_KEYS_MAX
.br
_SC_THREAD_PRIO_INHERIT
.br
_SC_THREAD_PRIO_PROTECT
.br
_SC_THREAD_PRIORITY_SCHEDULING
.br
_SC_THREAD_PROCESS_SHARED
.br
_SC_THREAD_SAFE_FUNCTIONS
.br
_SC_THREAD_SPORADIC_SERVER
.br
_SC_THREAD_STACK_MIN
.br
_SC_THREAD_THREADS_MAX
.br
_SC_TIMEOUTS
.br
_SC_THREADS
.br
_SC_TIMER_MAX
.br
_SC_TIMERS
.br
_SC_TRACE
.br
_SC_TRACE_EVENT_FILTER
.br
_SC_TRACE_INHERIT
.br
_SC_TRACE_LOG
.br
_SC_TTY_NAME_MAX
.br
_SC_TYPED_MEMORY_OBJECTS
.br
_SC_TZNAME_MAX
.br
_SC_V6_ILP32_OFF32
.br
_SC_V6_ILP32_OFFBIG
.br
_SC_V6_LP64_OFF64
.br
_SC_V6_LPBIG_OFFBIG
.br
_SC_VERSION
.br
_SC_XBS5_ILP32_OFF32 (\fBLEGACY\fP)
.br
_SC_XBS5_ILP32_OFFBIG (\fBLEGACY\fP)
.br
_SC_XBS5_LP64_OFF64 (\fBLEGACY\fP)
.br
_SC_XBS5_LPBIG_OFFBIG (\fBLEGACY\fP)
.br
_SC_XOPEN_CRYPT
.br
_SC_XOPEN_ENH_I18N
.br
_SC_XOPEN_LEGACY
.br
_SC_XOPEN_REALTIME
.br
_SC_XOPEN_REALTIME_THREADS
.br
_SC_XOPEN_SHM
.br
_SC_XOPEN_STREAMS
.br
_SC_XOPEN_UNIX
.br
_SC_XOPEN_VERSION
.br
_SC_XOPEN_XCU_VERSION
.br
.LP
The two constants _SC_PAGESIZE and _SC_PAGE_SIZE may be defined to
have the same value.
.LP
The following symbolic constants shall be defined for file streams:
.TP 7
STDERR_FILENO
File number of \fIstderr\fP; 2.
.TP 7
STDIN_FILENO
File number of \fIstdin\fP; 0.
.TP 7
STDOUT_FILENO
File number of \fIstdout\fP; 1.
.sp
.SS Type Definitions
.LP
The \fBsize_t\fP, \fBssize_t\fP, \fBuid_t\fP, \fBgid_t\fP, \fBoff_t\fP,
\fBpid_t\fP, and \fBuseconds_t\fP types shall be
defined as described in \fI<sys/types.h>\fP.
.LP
The \fBintptr_t\fP type shall be defined as described in \fI<inttypes.h>\fP.
.SS Declarations
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf
\fBint access(const char *, int);
unsigned alarm(unsigned);
int chdir(const char *);
int chown(const char *, uid_t, gid_t);
int close(int);
size_t confstr(int, char *, size_t);
.sp
char *crypt(const char *, const char *);
char *ctermid(char *);
int dup(int);
.sp
int dup2(int, int);
void encrypt(char[64], int);
int execl(const char *, const char *, ...);
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...);
int execv(const char *, char *const []);
int execve(const char *, char *const [], char *const []);
int execvp(const char *, char *const []);
void _exit(int);
int fchown(int, uid_t, gid_t);
int fchdir(int);
int fdatasync(int);
pid_t fork(void);
long fpathconf(int, int);
int fsync(int);
int ftruncate(int, off_t);
char *getcwd(char *, size_t);
gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t []);
long gethostid(void);
int gethostname(char *, size_t);
char *getlogin(void);
int getlogin_r(char *, size_t);
int getopt(int, char * const [], const char *);
pid_t getpgid(pid_t);
pid_t getpgrp(void);
pid_t getpid(void);
pid_t getppid(void);
pid_t getsid(pid_t);
uid_t getuid(void);
char *getwd(char *); (\fP\fBLEGACY\fP \fB)
int isatty(int);
int lchown(const char *, uid_t, gid_t);
int link(const char *, const char *);
int lockf(int, int, off_t);
off_t lseek(int, off_t, int);
int nice(int);
long pathconf(const char *, int);
int pause(void);
int pipe(int [2]);
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
ssize_t read(int, void *, size_t);
ssize_t readlink(const char *restrict, char *restrict, size_t);
int rmdir(const char *);
int setegid(gid_t);
int seteuid(uid_t);
int setgid(gid_t);
.sp
int setpgid(pid_t, pid_t);
pid_t setpgrp(void);
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
pid_t setsid(void);
int setuid(uid_t);
unsigned sleep(unsigned);
void swab(const void *restrict, void *restrict, ssize_t);
int symlink(const char *, const char *);
void sync(void);
long sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
int truncate(const char *, off_t);
char *ttyname(int);
int ttyname_r(int, char *, size_t);
useconds_t ualarm(useconds_t, useconds_t);
int unlink(const char *);
int usleep(useconds_t);
pid_t vfork(void);
ssize_t write(int, const void *, size_t);
\fP
.fi
.RE
.LP
Implementations may also include the \fIpthread_atfork\fP() prototype
as defined
in \fI<pthread.h>\fP .
.LP
The following external variables shall be declared:
.sp
.RS
.nf
\fBextern char *optarg;
extern int optind, opterr, optopt;
\fP
.fi
.RE
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
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:
.sp
.RS
.nf
\fB#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
\fP
.fi
.RE
.LP
Earlier versions of IEEE\ Std\ 1003.1 and of the Single UNIX Specification
can be identified by the following
macros:
.TP 7
POSIX.1-1988 standard
_POSIX_VERSION==198808L
.TP 7
POSIX.1-1990 standard
_POSIX_VERSION==199009L
.TP 7
ISO\ POSIX-1:1996 standard
_POSIX_VERSION==199506L
.TP 7
Single UNIX Specification, Version 1
_XOPEN_UNIX and _XOPEN_VERSION==4
.TP 7
Single UNIX Specification, Version 2
_XOPEN_UNIX and _XOPEN_VERSION==500
.sp
.LP
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 \fIsysconf\fP() to determine whether the
current version of the operating system supports the
necessary functionality as in the following program fragment:
.sp
.RS
.nf
\fBif (sysconf(_SC_VERSION) < 200112L) {
fprintf(stderr, "POSIX.1-2001 system required, terminating \\n");
exit(1);
}
\fP
.fi
.RE
.LP
New applications should not use _XOPEN_SHM or _XOPEN_ENH_I18N.
.SH RATIONALE
.LP
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.
.SS Version Test Macros
.LP
The standard developers considered altering the definition of _POSIX_VERSION
and removing _SC_VERSION from the specification of
\fIsysconf\fP() 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.
.LP
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
\fBcore\fP 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.
.SS Compile-Time Symbolic Constants for System-Wide Options
.LP
IEEE\ Std\ 1003.1-2001 now includes support in certain areas for the
newly adopted policy governing options and
stubs.
.LP
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:
.IP " 1." 4
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.
.LP
.IP " 2." 4
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.
.LP
.IP " 3." 4
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.
.LP
.LP
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 \fIsetpgid\fP()
function in the POSIX.1-1990 standard, for example, is considered
appropriate.
.LP
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.
.LP
Any application must consider the following three cases for each option:
.IP " 1." 4
Option never supported.
.LP
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.
.LP
.IP " 2." 4
Option always supported.
.LP
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.
.LP
.IP " 3." 4
Option might or might not be supported.
.LP
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.
.LP
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<inttypes.h>\fP , \fI<limits.h>\fP , \fI<sys/socket.h>\fP , \fI<sys/types.h>\fP
, \fI<termios.h>\fP , \fI<wctype.h>\fP , the System Interfaces volume
of IEEE\ Std\ 1003.1-2001, \fIaccess\fP(), \fIalarm\fP(), \fIchdir\fP(),
\fIchown\fP(), \fIclose\fP(), \fIcrypt\fP(), \fIctermid\fP(), \fIdup\fP(),
\fIencrypt\fP(), \fIenviron\fP, \fIexec\fP, \fIexit\fP(), \fIfchdir\fP(),
\fIfchown\fP(), \fIfcntl\fP(), \fIfork\fP(), \fIfpathconf\fP(), \fIfsync\fP(),
\fIftruncate\fP(), \fIgetcwd\fP(), \fIgetegid\fP(), \fIgeteuid\fP(),
\fIgetgid\fP(), \fIgetgroups\fP(), \fIgethostid\fP(), \fIgethostname\fP(),
\fIgetlogin\fP(), \fIgetpgid\fP(), \fIgetpgrp\fP(), \fIgetpid\fP(),
\fIgetppid\fP(), \fIgetsid\fP(), \fIgetuid\fP(), \fIisatty\fP(), \fIlchown\fP(),
\fIlink\fP(), \fIlockf\fP(), \fIlseek\fP(), \fInice\fP(), \fIpathconf\fP(),
\fIpause\fP(), \fIpipe\fP(), \fIread\fP(), \fIreadlink\fP(), \fIrmdir\fP(),
\fIsetgid\fP(), \fIsetpgid\fP(), \fIsetpgrp\fP(), \fIsetregid\fP(),
\fIsetreuid\fP(), \fIsetsid\fP(), \fIsetuid\fP(), \fIsleep\fP(), \fIswab\fP(),
\fIsymlink\fP(), \fIsync\fP(), \fIsysconf\fP(), \fItcgetpgrp\fP(),
\fItcsetpgrp\fP(), \fItruncate\fP(), \fIttyname\fP(), \fIualarm\fP(),
\fIunlink\fP(), \fIusleep\fP(), \fIvfork\fP(), \fIwrite\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .