+# find /usr/share/man/man2 | grep 2 | xargs pr -t | mandoc >> bsd_man2_all
+
+KQUEUE(2) System Calls Manual KQUEUE(2)
+
+N\bNA\bAM\bME\bE
+ k\bkq\bqu\bue\beu\bue\be, k\bke\bev\bve\ben\bnt\bt - kernel event notification mechanism
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/e\bev\bve\ben\bnt\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ k\bkq\bqu\bue\beu\bue\be(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ k\bke\bev\bve\ben\bnt\bt(_\bi_\bn_\bt _\bk_\bq, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\be_\bv_\be_\bn_\bt_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ E\bEV\bV_\b_S\bSE\bET\bT(_\b&_\bk_\be_\bv, _\bi_\bd_\be_\bn_\bt, _\bf_\bi_\bl_\bt_\be_\br, _\bf_\bl_\ba_\bg_\bs, _\bf_\bf_\bl_\ba_\bg_\bs, _\bd_\ba_\bt_\ba, _\bu_\bd_\ba_\bt_\ba);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ k\bkq\bqu\bue\beu\bue\be() provides a generic method of notifying the user when an event
+ happens or a condition holds, based on the results of small pieces of
+ kernel code termed ``filters''. A kevent is identified by the (ident,
+ filter) pair; there may only be one unique kevent per kqueue.
+
+ The filter is executed upon the initial registration of a kevent in order
+ to detect whether a preexisting condition is present, and is also
+ executed whenever an event is passed to the filter for evaluation. If
+ the filter determines that the condition should be reported, then the
+ kevent is placed on the kqueue for the user to retrieve.
+
+ The filter is also run when the user attempts to retrieve the kevent from
+ the kqueue. If the filter indicates that the condition that triggered
+ the event no longer holds, the kevent is removed from the kqueue and is
+ not returned.
+
+ Multiple events which trigger the filter do not result in multiple
+ kevents being placed on the kqueue; instead, the filter will aggregate
+ the events into a single struct kevent. Calling c\bcl\blo\bos\bse\be() on a file
+ descriptor will remove any kevents that reference the descriptor.
+
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a descriptor. The
+ queue is not inherited by a child created with fork(2). Similarly,
+ kqueues cannot be passed across UNIX-domain sockets.
+
+ k\bke\bev\bve\ben\bnt\bt() is used to register events with the queue, and return any
+ pending events to the user. _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt is a pointer to an array of
+ _\bk_\be_\bv_\be_\bn_\bt structures, as defined in <_\bs_\by_\bs_\b/_\be_\bv_\be_\bn_\bt_\b._\bh>. All changes contained in
+ the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt are applied before any pending events are read from the
+ queue. _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs gives the size of _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt. _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt is a pointer to
+ an array of kevent structures. _\bn_\be_\bv_\be_\bn_\bt_\bs determines the size of _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+ When _\bn_\be_\bv_\be_\bn_\bt_\bs is zero, k\bke\bev\bve\ben\bnt\bt() will return immediately even if there is a
+ _\bt_\bi_\bm_\be_\bo_\bu_\bt specified unlike select(2). If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a non-null pointer, it
+ specifies a maximum interval to wait for an event, which will be
+ interpreted as a struct timespec. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a null pointer, k\bke\bev\bve\ben\bnt\bt()
+ waits indefinitely. To effect a poll, the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument should be
+ non-null, pointing to a zero-valued _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc structure. The same array
+ may be used for the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+
+ E\bEV\bV_\b_S\bSE\bET\bT() is a macro which is provided for ease of initializing a kevent
+ structure.
+
+ The _\bk_\be_\bv_\be_\bn_\bt structure is defined as:
+
+ struct kevent {
+ uintptr_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags; /* action flags for kqueue */
+ u_int fflags; /* filter flag value */
+ quad_t data; /* filter data value */
+ void *udata; /* opaque user data identifier */
+ };
+
+ The fields of struct kevent are:
+
+ ident Value used to identify this event. The exact interpretation
+ is determined by the attached filter, but often is a file
+ descriptor.
+
+ filter Identifies the kernel filter used to process this event. The
+ pre-defined system filters are described below.
+
+ flags Actions to perform on the event.
+
+ fflags Filter-specific flags.
+
+ data Filter-specific data value.
+
+ udata Opaque user-defined value passed through the kernel unchanged.
+
+ The _\bf_\bl_\ba_\bg_\bs field can contain the following values:
+
+ EV_ADD Adds the event to the kqueue. Re-adding an existing event
+ will modify the parameters of the original event, and not
+ result in a duplicate entry. Adding an event
+ automatically enables it, unless overridden by the
+ EV_DISABLE flag.
+
+ EV_ENABLE Permit k\bke\bev\bve\ben\bnt\bt() to return the event if it is triggered.
+
+ EV_DISABLE Disable the event so k\bke\bev\bve\ben\bnt\bt() will not return it. The
+ filter itself is not disabled.
+
+ EV_DELETE Removes the event from the kqueue. Events which are
+ attached to file descriptors are automatically deleted on
+ the last close of the descriptor.
+
+ EV_ONESHOT Causes the event to return only the first occurrence of
+ the filter being triggered. After the user retrieves the
+ event from the kqueue, it is deleted.
+
+ EV_CLEAR After the event is retrieved by the user, its state is
+ reset. This is useful for filters which report state
+ transitions instead of the current state. Note that some
+ filters may automatically set this flag internally.
+
+ EV_EOF Filters may set this flag to indicate filter-specific EOF
+ condition.
+
+ EV_ERROR See _\bR_\bE_\bT_\bU_\bR_\bN _\bV_\bA_\bL_\bU_\bE_\bS below.
+
+ The predefined system filters are listed below. Arguments may be passed
+ to and from the filter via the _\bf_\bf_\bl_\ba_\bg_\bs and _\bd_\ba_\bt_\ba fields in the kevent
+ structure.
+
+ EVFILT_READ Takes a descriptor as the identifier, and returns whenever
+ there is data available to read. The behavior of the
+ filter is slightly different depending on the descriptor
+ type.
+
+ Sockets
+ Sockets which have previously been passed to l\bli\bis\bst\bte\ben\bn()
+ return when there is an incoming connection pending.
+ _\bd_\ba_\bt_\ba contains the size of the listen backlog.
+
+ Other socket descriptors return when there is data to
+ be read, subject to the SO_RCVLOWAT value of the
+ socket buffer. This may be overridden with a per-
+ filter low water mark at the time the filter is added
+ by setting the NOTE_LOWAT flag in _\bf_\bf_\bl_\ba_\bg_\bs, and
+ specifying the new low water mark in _\bd_\ba_\bt_\ba. On return,
+ _\bd_\ba_\bt_\ba contains the number of bytes in the socket
+ buffer.
+
+ If the read direction of the socket has shutdown, then
+ the filter also sets EV_EOF in _\bf_\bl_\ba_\bg_\bs, and returns the
+ socket error (if any) in _\bf_\bf_\bl_\ba_\bg_\bs. It is possible for
+ EOF to be returned (indicating the connection is gone)
+ while there is still data pending in the socket
+ buffer.
+
+ Vnodes
+ Returns when the file pointer is not at the end of
+ file. _\bd_\ba_\bt_\ba contains the offset from current position
+ to end of file, and may be negative. If NOTE_EOF is
+ set in _\bf_\bf_\bl_\ba_\bg_\bs, k\bke\bev\bve\ben\bnt\bt() will also return when the file
+ pointer is at the end of file. The end of file
+ condition is indicated by the presence of NOTE_EOF in
+ _\bf_\bf_\bl_\ba_\bg_\bs on return.
+
+ Fifos, Pipes
+ Returns when there is data to read; _\bd_\ba_\bt_\ba contains the
+ number of bytes available.
+
+ When the last writer disconnects, the filter will set
+ EV_EOF in _\bf_\bl_\ba_\bg_\bs. This may be cleared by passing in
+ EV_CLEAR, at which point the filter will resume
+ waiting for data to become available before returning.
+
+ BPF devices
+ Returns when the BPF buffer is full, the BPF timeout
+ has expired, or when the BPF has ``immediate mode''
+ enabled and there is any data to read; _\bd_\ba_\bt_\ba contains
+ the number of bytes available.
+
+ EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever
+ it is possible to write to the descriptor. For sockets,
+ pipes, and FIFOs, _\bd_\ba_\bt_\ba will contain the amount of space
+ remaining in the write buffer. The filter will set EV_EOF
+ when the reader disconnects, and for the FIFO case, this
+ may be cleared by use of EV_CLEAR. Note that this filter
+ is not supported for vnodes or BPF devices.
+
+ For sockets, the low water mark and socket error handling
+ is identical to the EVFILT_READ case.
+
+ EVFILT_VNODE Takes a file descriptor as the identifier and the events
+ to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when one or more of
+ the requested events occurs on the descriptor. The events
+ to monitor are:
+
+ NOTE_DELETE u\bun\bnl\bli\bin\bnk\bk() was called on the file referenced
+ by the descriptor.
+
+ NOTE_WRITE A write occurred on the file referenced by
+ the descriptor.
+
+ NOTE_EXTEND The file referenced by the descriptor was
+ extended.
+
+ NOTE_TRUNCATE The file referenced by the descriptor was
+ truncated.
+
+ NOTE_ATTRIB The file referenced by the descriptor had
+ its attributes changed.
+
+ NOTE_LINK The link count on the file changed.
+
+ NOTE_RENAME The file referenced by the descriptor was
+ renamed.
+
+ NOTE_REVOKE Access to the file was revoked via
+ revoke(2) or the underlying file system was
+ unmounted.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_PROC Takes the process ID to monitor as the identifier and the
+ events to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when the
+ process performs one or more of the requested events. If
+ a process can normally see another process, it can attach
+ an event to it. The events to monitor are:
+
+ NOTE_EXIT The process has exited. The exit status
+ will be stored in _\bd_\ba_\bt_\ba in the same format
+ as the status set by wait(2).
+
+ NOTE_FORK The process has called f\bfo\bor\brk\bk().
+
+ NOTE_EXEC The process has executed a new process
+ via execve(2) or similar call.
+
+ NOTE_TRACK Follow a process across f\bfo\bor\brk\bk() calls.
+ The parent process will return with
+ NOTE_FORK set in the _\bf_\bf_\bl_\ba_\bg_\bs field, while
+ the child process will return with
+ NOTE_CHILD set in _\bf_\bf_\bl_\ba_\bg_\bs and the parent
+ PID in _\bd_\ba_\bt_\ba.
+
+ NOTE_TRACKERR This flag is returned if the system was
+ unable to attach an event to the child
+ process, usually due to resource
+ limitations.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_SIGNAL Takes the signal number to monitor as the identifier and
+ returns when the given signal is delivered to the process.
+ This coexists with the s\bsi\big\bgn\bna\bal\bl() and s\bsi\big\bga\bac\bct\bti\bio\bon\bn()
+ facilities, and has a lower precedence. The filter will
+ record all attempts to deliver a signal to a process, even
+ if the signal has been marked as SIG_IGN. Event
+ notification happens after normal signal delivery
+ processing. _\bd_\ba_\bt_\ba returns the number of times the signal
+ has occurred since the last call to k\bke\bev\bve\ben\bnt\bt(). This filter
+ automatically sets the EV_CLEAR flag internally.
+
+ EVFILT_TIMER Establishes an arbitrary timer identified by _\bi_\bd_\be_\bn_\bt. When
+ adding a timer, _\bd_\ba_\bt_\ba specifies the timeout period in
+ milliseconds. The timer will be periodic unless
+ EV_ONESHOT is specified. On return, _\bd_\ba_\bt_\ba contains the
+ number of times the timeout has expired since the last
+ call to k\bke\bev\bve\ben\bnt\bt(). This filter automatically sets the
+ EV_CLEAR flag internally.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a file descriptor.
+ If there was an error creating the kernel event queue, a value of -1 is
+ returned and errno set.
+
+ k\bke\bev\bve\ben\bnt\bt() returns the number of events placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, up to the
+ value given by _\bn_\be_\bv_\be_\bn_\bt_\bs. If an error occurs while processing an element
+ of the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and there is enough room in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, then the
+ event will be placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt with EV_ERROR set in _\bf_\bl_\ba_\bg_\bs and the
+ system error in _\bd_\ba_\bt_\ba. Otherwise, -1 will be returned, and errno will be
+ set to indicate the error condition. If the time limit expires, then
+ k\bke\bev\bve\ben\bnt\bt() returns 0.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() function fails if:
+
+ [ENOMEM] The kernel failed to allocate enough memory for the
+ kernel queue.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ The k\bke\bev\bve\ben\bnt\bt() function fails if:
+
+ [EACCES] The process does not have permission to register a
+ filter.
+
+ [EFAULT] There was an error reading or writing the _\bk_\be_\bv_\be_\bn_\bt
+ structure.
+
+ [EBADF] The specified descriptor is invalid.
+
+ [EINTR] A signal was delivered before the timeout expired and
+ before any events were placed on the kqueue for
+ return.
+
+ [EINVAL] The specified time limit or filter is invalid.
+
+ [ENOENT] The event could not be found to be modified or
+ deleted.
+
+ [ENOMEM] No memory was available to register the event.
+
+ [ESRCH] The specified process to attach to does not exist.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ poll(2), read(2), select(2), sigaction(2), wait(2), write(2), signal(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bkq\bqu\bue\beu\bue\be() and k\bke\bev\bve\ben\bnt\bt() functions first appeared in FreeBSD 4.1.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() system and this manual page were written by Jonathan Lemon
+ <_\bj_\bl_\be_\bm_\bo_\bn_\b@_\bF_\br_\be_\be_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+B\bBU\bUG\bGS\bS
+ It is currently not possible to watch FIFOs or AIO that reside on
+ anything but a UFS file system. Watching a vnode is possible on UFS, NFS
+ and MS-DOS file systems.
+
+ The _\bt_\bi_\bm_\be_\bo_\bu_\bt value is limited to 24 hours; longer timeouts will be
+ silently reinterpreted as 24 hours.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ _\b_e\bex\bxi\bit\bt, _\b_E\bEx\bxi\bit\bt - terminate the calling process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd
+ _\b_e\bex\bxi\bit\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\bt_\bu_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdl\bli\bib\bb.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd
+ _\b_E\bEx\bxi\bit\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\bt_\bu_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b_e\bex\bxi\bit\bt() and _\b_E\bEx\bxi\bit\bt() functions terminate a process with the following
+ consequences:
+
+ +\b+\bo\bo All threads in the process are terminated.
+
+ +\b+\bo\bo All open file descriptors in the calling process are closed. This
+ may entail delays; for example, waiting for output to drain. A
+ process in this state may not be killed, as it is already dying.
+
+ +\b+\bo\bo If the parent process of the calling process has an outstanding
+ wait(2) call or catches the SIGCHLD signal, it is notified of the
+ calling process's termination and _\bs_\bt_\ba_\bt_\bu_\bs is set as defined by
+ wait(2). (Note that typically only the lower 8 bits of _\bs_\bt_\ba_\bt_\bu_\bs are
+ passed on to the parent, thus negative values have less meaning.)
+
+ +\b+\bo\bo The parent process ID of all of the calling process's existing child
+ processes are set to 1; the initialization process (see the
+ DEFINITIONS section of intro(2)) inherits each of these processes.
+
+ +\b+\bo\bo If the termination of the process causes any process group to become
+ orphaned (usually because the parents of all members of the group
+ have now exited; see Orphaned Process Group in intro(2)), and if any
+ member of the orphaned group is stopped, the SIGHUP and SIGCONT
+ signals are sent to all members of the newly orphaned process group.
+
+ +\b+\bo\bo If the process is a controlling process (see intro(2)), the SIGHUP
+ signal is sent to the foreground process group of the controlling
+ terminal, and all current access to the controlling terminal is
+ revoked.
+
+ Most C programs call the library routine exit(3), which flushes buffers,
+ closes streams, unlinks temporary files, etc., and then calls _\b_e\bex\bxi\bit\bt().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b_e\bex\bxi\bit\bt() and _\b_E\bEx\bxi\bit\bt() can never return.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fork(2), intro(2), sigaction(2), wait(2), exit(3), sysexits(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b_e\bex\bxi\bit\bt() function conform to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ _\b_E\bEx\bxi\bit\bt() function conforms to ISO/IEC 9899:1999 (``ISO C99'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An e\bex\bxi\bit\bt() system call first appeared in Version 1 AT&T UNIX. It accepts
+ the _\bs_\bt_\ba_\bt_\bu_\bs argument since Version 2 AT&T UNIX. An _\b_e\bex\bxi\bit\bt() variant first
+ appeared in Version 7 AT&T UNIX. The _\b_E\bEx\bxi\bit\bt() function appeared in
+ OpenBSD 3.6.
+
+N\bNA\bAM\bME\bE
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb, _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb - get and set the address of the thread control
+ block of the current thread
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bv_\bo_\bi_\bd _\b*
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb(_\bv_\bo_\bi_\bd);
+
+ _\bv_\bo_\bi_\bd
+ _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb(_\bv_\bo_\bi_\bd _\b*);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() and _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb() functions are for use by librthread and
+ other parts of the system runtime to retrieve and set the address of the
+ current thread's thread control block (TCB). This is used to locate per-
+ thread data such as _\be_\br_\br_\bn_\bo. Each kernel-level thread in a process has a
+ separate value for this address, which can be obtained and changed via
+ these system calls. New threads (including the first thread of a new
+ process) created using fork(2), vfork(2), or __tfork(2), inherit the TCB
+ address of the thread that created them. execve(2) resets it to zero.
+
+ On some platforms, this address is also directly mapped to a CPU register
+ which can be accessed from userspace.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() returns the address of the thread control block of the
+ current thread.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() and _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb() system calls appeared in OpenBSD 5.1.
+
+N\bNA\bAM\bME\bE
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb, _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb - get and set the address of the thread control
+ block of the current thread
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bv_\bo_\bi_\bd _\b*
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb(_\bv_\bo_\bi_\bd);
+
+ _\bv_\bo_\bi_\bd
+ _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb(_\bv_\bo_\bi_\bd _\b*);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() and _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb() functions are for use by librthread and
+ other parts of the system runtime to retrieve and set the address of the
+ current thread's thread control block (TCB). This is used to locate per-
+ thread data such as _\be_\br_\br_\bn_\bo. Each kernel-level thread in a process has a
+ separate value for this address, which can be obtained and changed via
+ these system calls. New threads (including the first thread of a new
+ process) created using fork(2), vfork(2), or __tfork(2), inherit the TCB
+ address of the thread that created them. execve(2) resets it to zero.
+
+ On some platforms, this address is also directly mapped to a CPU register
+ which can be accessed from userspace.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() returns the address of the thread control block of the
+ current thread.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The _\b__\b_g\bge\bet\bt_\b_t\btc\bcb\bb() and _\b__\b_s\bse\bet\bt_\b_t\btc\bcb\bb() system calls appeared in OpenBSD 5.1.
+
+N\bNA\bAM\bME\bE
+ s\bsy\bys\bsc\bca\bal\bll\bl, _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl - indirect system call
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsy\bys\bsc\bca\bal\bll\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bys\bsc\bca\bal\bll\bl(_\bi_\bn_\bt _\bn_\bu_\bm_\bb_\be_\br, _\b._\b._\b.);
+
+ _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl(_\bq_\bu_\ba_\bd_\b__\bt _\bn_\bu_\bm_\bb_\be_\br, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsy\bys\bsc\bca\bal\bll\bl() performs the system call whose assembly language interface has
+ the specified _\bn_\bu_\bm_\bb_\be_\br with the specified arguments. Symbolic constants
+ for system calls can be found in the header file <_\bs_\by_\bs_\b/_\bs_\by_\bs_\bc_\ba_\bl_\bl_\b._\bh>.
+
+ Since different system calls have different return types, a prototype of
+ _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl specifying the correct return type should be declared locally.
+ This is especially important for system calls returning larger-than-int
+ results.
+
+ The _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl form should be used when one or more of the parameters is a
+ 64-bit argument to ensure that argument alignment is correct. This
+ system call is useful for testing new system calls that do not have
+ entries in the C library.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The return values are defined by the system call being invoked. In
+ general, for system calls returning _\bi_\bn_\bt, a 0 return value indicates
+ success. A -1 return value indicates an error, and an error code is
+ stored in _\be_\br_\br_\bn_\bo.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former i\bin\bnd\bdi\bir\br() system call, first
+ appeared in Version 4 AT&T UNIX. The s\bsy\bys\bsc\bca\bal\bll\bl() function first appeared
+ in 3BSD.
+
+B\bBU\bUG\bGS\bS
+ There is no way to simulate system calls that have multiple return values
+ such as pipe(2).
+
+N\bNA\bAM\bME\bE
+ _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd, _\b__\b_t\btf\bfo\bor\brk\bk - create a new kernel thread in the current
+ process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ struct __tfork {
+ void *tf_tcb; /* TCB address for new thread */
+ pid_t *tf_tid; /* where to write child's thread ID */
+ void *tf_stack; /* stack address for new thread */
+ };
+
+ _\bp_\bi_\bd_\b__\bt
+ _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\b__\b__\bt_\bf_\bo_\br_\bk _\b*_\bp_\ba_\br_\ba_\bm_\bs, _\bs_\bi_\bz_\be_\b__\bt _\bp_\bs_\bi_\bz_\be,
+ _\bv_\bo_\bi_\bd _\b(_\b*_\bs_\bt_\ba_\br_\bt_\bf_\bu_\bn_\bc_\b)_\b(_\bv_\bo_\bi_\bd _\b*_\b), _\bv_\bo_\bi_\bd _\b*_\bs_\bt_\ba_\br_\bt_\ba_\br_\bg);
+
+ _\bp_\bi_\bd_\b__\bt
+ _\b__\b_t\btf\bfo\bor\brk\bk(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\b__\b__\bt_\bf_\bo_\br_\bk _\b*_\bp_\ba_\br_\ba_\bm_\bs, _\bs_\bi_\bz_\be_\b__\bt _\bp_\bs_\bi_\bz_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd() function creates a new kernel thread in the current
+ process. The new thread starts by calling _\bs_\bt_\ba_\br_\bt_\bf_\bu_\bn_\bc, passing _\bs_\bt_\ba_\br_\bt_\ba_\br_\bg as
+ the only argument. If _\bs_\bt_\ba_\br_\bt_\bf_\bu_\bn_\bc returns, the thread will exit.
+
+ The _\bp_\ba_\br_\ba_\bm_\bs argument provides parameters used by the kernel during thread
+ creation. The new thread's thread control block (TCB) address is set to
+ _\bt_\bf_\b__\bt_\bc_\bb. If _\bt_\bf_\b__\bt_\bi_\bd is not NULL, the new thread's thread ID is returned to
+ the user at that address, with the guarantee that this is done before
+ returning to userspace in either the calling thread or the new thread.
+ If _\bt_\bf_\b__\bs_\bt_\ba_\bc_\bk is not NULL, the new thread's stack is initialized to start
+ at that address. On hppa and hppa64, that is the lowest address used; on
+ other architectures that is the address after the highest address used.
+
+ The _\bp_\bs_\bi_\bz_\be argument provides the size of the _\bs_\bt_\br_\bu_\bc_\bt _\b__\b__\bt_\bf_\bo_\br_\bk passed via the
+ _\bp_\ba_\br_\ba_\bm_\bs argument.
+
+ The underlying system call used to create the thread is _\b__\b_t\btf\bfo\bor\brk\bk().
+ Because the new thread returns without a stack frame, the syscall cannot
+ be directly used from C and is therefore not provided as a function.
+ However, the syscall may show up in the output of kdump(1).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd() returns in the calling
+ thread the thread ID of new thread. The _\b__\b_t\btf\bfo\bor\brk\bk() syscall itself, on
+ success, returns a value of 0 in the new thread and returns the thread ID
+ of the new thread to the calling thread. Otherwise, a value of -1 is
+ returned, no thread is created, and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate an error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd() and _\b__\b_t\btf\bfo\bor\brk\bk() will fail and no thread will be created
+ if:
+
+ [ENOMEM] Cannot allocate memory. The new process image
+ required more memory than was allowed by the hardware
+ or by system-imposed memory management constraints. A
+ lack of swap space is normally temporary; however, a
+ lack of core is not. Soft limits may be increased to
+ their corresponding hard limits.
+
+ [EINVAL] Invalid argument. Some invalid argument was supplied.
+
+ [EAGAIN] Resource temporarily unavailable. The system-imposed
+ limit on the total number of threads under execution
+ would be exceeded. This limit is configuration-
+ dependent.
+
+ [EAGAIN] Resource temporarily unavailable. The system-imposed
+ limit MAXUPRC on the total number of threads under
+ execution by a single user would be exceeded. MAXUPRC
+ is currently defined in <_\bs_\by_\bs_\b/_\bp_\ba_\br_\ba_\bm_\b._\bh> as CHILD_MAX,
+ which is currently defined as 80 in <_\bs_\by_\bs_\b/_\bs_\by_\bs_\bl_\bi_\bm_\bi_\bt_\bs_\b._\bh>.
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd() function and _\b__\b_t\btf\bfo\bor\brk\bk() syscall are specific to
+ OpenBSD and should not be used in portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The _\b__\b_t\btf\bfo\bor\brk\bk_\b_t\bth\bhr\bre\bea\bad\bd() function and _\b__\b_t\btf\bfo\bor\brk\bk() syscall appeared in
+ OpenBSD 5.1.
+
+N\bNA\bAM\bME\bE
+ _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt - synchronously accept a signal
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt(_\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\bs_\be_\bt, _\bs_\bi_\bg_\bi_\bn_\bf_\bo_\b__\bt _\b*_\bi_\bn_\bf_\bo,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() function is used to implement s\bsi\big\bgw\bwa\bai\bit\bt(). It selects
+ a signal pending for the calling thread or process from _\bs_\be_\bt, atomically
+ clears it from that set of pending signals, and returns that signal
+ number. If prior to the call to _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() there are multiple
+ pending instances of a single signal number, it is undefined whether upon
+ successful return there are any remaining pending signals for that signal
+ number. If no signal in _\bs_\be_\bt is pending at the time of the call, the
+ thread shall be suspended until one or more becomes pending. The signals
+ defined by _\bs_\be_\bt should have been blocked in all threads in the process at
+ the time of the call to _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt(); otherwise the signal may be
+ delivered to some thread that does not have it blocked.
+
+ If more than one thread is using _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() to wait for the same
+ signal, no more than one of these threads shall return from
+ _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() for any given signal that is sent. Which thread returns
+ from _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() if more than a single thread is waiting is
+ unspecified.
+
+ If the _\bi_\bn_\bf_\bo argument is not NULL, then a _\bs_\bi_\bg_\bi_\bn_\bf_\bo_\b__\bt will be stored there
+ which has the selected signal number in its _\bs_\bi_\b__\bs_\bi_\bg_\bn_\bo member and the cause
+ of the signal in its _\bs_\bi_\b__\bc_\bo_\bd_\be member.
+
+ If the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument is not NULL and no selected signal is currently
+ pending, then _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() will wait no longer than the specified
+ time period for a signal to arrive before failing.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of the signal that was accepted is returned.
+ Otherwise, a value of -1 is returned and errno is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() will succeed unless:
+
+ [EWOULDBLOCK] The timeout was reached before a selected signal was
+ received.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sigaction(2), sigprocmask(2), sigwait(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b__\b_t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() function is specific to OpenBSD and should not be
+ used in portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() syscall appeared in OpenBSD 3.9. The _\bi_\bn_\bf_\bo and _\bt_\bi_\bm_\be_\bo_\bu_\bt
+ arguments were added in OpenBSD 4.9.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The t\bth\bhr\brs\bsi\big\bgd\bdi\biv\bve\ber\brt\bt() syscall was created by Ted Unangst <_\bt_\be_\bd_\bu_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+ This manual page was written by Philip Guenther <_\bg_\bu_\be_\bn_\bt_\bh_\be_\br_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+N\bNA\bAM\bME\bE
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp, _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp - userspace thread sleep and wakeup
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bl_\ba_\bt_\bi_\bl_\be _\bv_\bo_\bi_\bd _\b*_\bi_\bd, _\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\ba_\bb_\bs_\bt_\bi_\bm_\be, _\bv_\bo_\bi_\bd _\b*_\bl_\bo_\bc_\bk, _\bc_\bo_\bn_\bs_\bt _\bi_\bn_\bt _\b*_\ba_\bb_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bl_\ba_\bt_\bi_\bl_\be _\bv_\bo_\bi_\bd _\b*_\bi_\bd, _\bi_\bn_\bt _\bc_\bo_\bu_\bn_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() functions provide thread sleep and
+ wakeup primitives with which synchronization primitives such as mutexes
+ and condition variables can be implemented. _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() blocks the
+ calling thread on the abstract ``wait channel'' identified by the _\bi_\bd
+ argument until another thread calls _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() with the same _\bi_\bd value.
+ If the _\ba_\bb_\bs_\bt_\bi_\bm_\be argument is not NULL, then it specifies an absolute time,
+ measured against the _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd clock, after which _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() should time
+ out and return. If the specified time is in the past then _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp()
+ will return immediately without blocking.
+
+ The _\bl_\bo_\bc_\bk argument, if not NULL, points to a locked spinlock that will be
+ unlocked by _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() atomically with respect to calls to
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(), such that if another thread locks the spinlock before
+ calling _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() with the same _\bi_\bd, then the thread that called
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will be eligible for being woken up and unblocked.
+
+ The _\ba_\bb_\bo_\br_\bt argument, if not NULL, points to an _\bi_\bn_\bt that will be examined
+ after unlocking the spinlock pointed to by _\bl_\bo_\bc_\bk and immediately before
+ blocking. If that _\bi_\bn_\bt is non-zero then _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will immediately
+ return EINTR without blocking. This provides a mechanism for a signal
+ handler to keep a call to _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() from blocking, even if the signal
+ is delivered immediately before the call.
+
+ The _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() function unblocks one or more threads that are sleeping
+ on the wait channel identified by _\bi_\bd. The number of threads unblocked is
+ specified by the _\bc_\bo_\bu_\bn_\bt argument, except that if zero is specified then
+ all threads sleeping on that _\bi_\bd are unblocked.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will return zero if woken by a matching call to
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(), otherwise an error number will be returned to indicate the
+ error.
+
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() will return zero if at least one matching call to
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() was unblocked, otherwise an error number will be returned to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() will fail if:
+
+ [EINVAL] The _\bi_\bd_\be_\bn_\bt argument is NULL.
+
+ In addition, _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() may return one of the following errors:
+
+ [EWOULDBLOCK] The time specified by the _\ba_\bb_\bs_\bt_\bi_\bm_\be and _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd
+ arguments was reached.
+
+ [EINTR] A signal arrived or the _\ba_\bb_\bo_\br_\bt argument pointed to a
+ non-zero value.
+
+ [EINVAL] The _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd argument is neither CLOCK_REALTIME nor
+ CLOCK_MONOTONIC.
+
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() may return the following error:
+
+ [ESRCH] No threads calling _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() with the same _\bi_\bd were
+ found.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ pthread_cond_wait(3), pthread_mutex_lock(3), tsleep(9)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() functions are specific to OpenBSD and
+ should not be used in portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The t\bth\bhr\brs\bsl\ble\bee\bep\bp() and t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() syscalls appeared in OpenBSD 3.9. The
+ _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd and _\ba_\bb_\bs_\bt_\bi_\bm_\be arguments were added in OpenBSD 4.9. The functions
+ were renamed to _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() and the _\ba_\bb_\bo_\br_\bt argument was
+ added in OpenBSD 5.1
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The t\bth\bhr\brs\bsl\ble\bee\bep\bp() and t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() syscalls were created by Ted Unangst
+ <_\bt_\be_\bd_\bu_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>. This manual page was written by Philip Guenther
+ <_\bg_\bu_\be_\bn_\bt_\bh_\be_\br_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+N\bNA\bAM\bME\bE
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp, _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp - userspace thread sleep and wakeup
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bl_\ba_\bt_\bi_\bl_\be _\bv_\bo_\bi_\bd _\b*_\bi_\bd, _\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\ba_\bb_\bs_\bt_\bi_\bm_\be, _\bv_\bo_\bi_\bd _\b*_\bl_\bo_\bc_\bk, _\bc_\bo_\bn_\bs_\bt _\bi_\bn_\bt _\b*_\ba_\bb_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bl_\ba_\bt_\bi_\bl_\be _\bv_\bo_\bi_\bd _\b*_\bi_\bd, _\bi_\bn_\bt _\bc_\bo_\bu_\bn_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() functions provide thread sleep and
+ wakeup primitives with which synchronization primitives such as mutexes
+ and condition variables can be implemented. _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() blocks the
+ calling thread on the abstract ``wait channel'' identified by the _\bi_\bd
+ argument until another thread calls _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() with the same _\bi_\bd value.
+ If the _\ba_\bb_\bs_\bt_\bi_\bm_\be argument is not NULL, then it specifies an absolute time,
+ measured against the _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd clock, after which _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() should time
+ out and return. If the specified time is in the past then _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp()
+ will return immediately without blocking.
+
+ The _\bl_\bo_\bc_\bk argument, if not NULL, points to a locked spinlock that will be
+ unlocked by _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() atomically with respect to calls to
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(), such that if another thread locks the spinlock before
+ calling _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() with the same _\bi_\bd, then the thread that called
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will be eligible for being woken up and unblocked.
+
+ The _\ba_\bb_\bo_\br_\bt argument, if not NULL, points to an _\bi_\bn_\bt that will be examined
+ after unlocking the spinlock pointed to by _\bl_\bo_\bc_\bk and immediately before
+ blocking. If that _\bi_\bn_\bt is non-zero then _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will immediately
+ return EINTR without blocking. This provides a mechanism for a signal
+ handler to keep a call to _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() from blocking, even if the signal
+ is delivered immediately before the call.
+
+ The _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() function unblocks one or more threads that are sleeping
+ on the wait channel identified by _\bi_\bd. The number of threads unblocked is
+ specified by the _\bc_\bo_\bu_\bn_\bt argument, except that if zero is specified then
+ all threads sleeping on that _\bi_\bd are unblocked.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() will return zero if woken by a matching call to
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp(), otherwise an error number will be returned to indicate the
+ error.
+
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() will return zero if at least one matching call to
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() was unblocked, otherwise an error number will be returned to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() will fail if:
+
+ [EINVAL] The _\bi_\bd_\be_\bn_\bt argument is NULL.
+
+ In addition, _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() may return one of the following errors:
+
+ [EWOULDBLOCK] The time specified by the _\ba_\bb_\bs_\bt_\bi_\bm_\be and _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd
+ arguments was reached.
+
+ [EINTR] A signal arrived or the _\ba_\bb_\bo_\br_\bt argument pointed to a
+ non-zero value.
+
+ [EINVAL] The _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd argument is neither CLOCK_REALTIME nor
+ CLOCK_MONOTONIC.
+
+ _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() may return the following error:
+
+ [ESRCH] No threads calling _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() with the same _\bi_\bd were
+ found.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ pthread_cond_wait(3), pthread_mutex_lock(3), tsleep(9)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() functions are specific to OpenBSD and
+ should not be used in portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The t\bth\bhr\brs\bsl\ble\bee\bep\bp() and t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() syscalls appeared in OpenBSD 3.9. The
+ _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd and _\ba_\bb_\bs_\bt_\bi_\bm_\be arguments were added in OpenBSD 4.9. The functions
+ were renamed to _\b__\b_t\bth\bhr\brs\bsl\ble\bee\bep\bp() and _\b__\b_t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() and the _\ba_\bb_\bo_\br_\bt argument was
+ added in OpenBSD 5.1
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The t\bth\bhr\brs\bsl\ble\bee\bep\bp() and t\bth\bhr\brw\bwa\bak\bke\beu\bup\bp() syscalls were created by Ted Unangst
+ <_\bt_\be_\bd_\bu_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>. This manual page was written by Philip Guenther
+ <_\bg_\bu_\be_\bn_\bt_\bh_\be_\br_\b@_\bO_\bp_\be_\bn_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+N\bNA\bAM\bME\bE
+ _\b_e\bex\bxi\bit\bt, _\b_E\bEx\bxi\bit\bt - terminate the calling process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd
+ _\b_e\bex\bxi\bit\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\bt_\bu_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdl\bli\bib\bb.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd
+ _\b_E\bEx\bxi\bit\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\bt_\bu_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\b_e\bex\bxi\bit\bt() and _\b_E\bEx\bxi\bit\bt() functions terminate a process with the following
+ consequences:
+
+ +\b+\bo\bo All threads in the process are terminated.
+
+ +\b+\bo\bo All open file descriptors in the calling process are closed. This
+ may entail delays; for example, waiting for output to drain. A
+ process in this state may not be killed, as it is already dying.
+
+ +\b+\bo\bo If the parent process of the calling process has an outstanding
+ wait(2) call or catches the SIGCHLD signal, it is notified of the
+ calling process's termination and _\bs_\bt_\ba_\bt_\bu_\bs is set as defined by
+ wait(2). (Note that typically only the lower 8 bits of _\bs_\bt_\ba_\bt_\bu_\bs are
+ passed on to the parent, thus negative values have less meaning.)
+
+ +\b+\bo\bo The parent process ID of all of the calling process's existing child
+ processes are set to 1; the initialization process (see the
+ DEFINITIONS section of intro(2)) inherits each of these processes.
+
+ +\b+\bo\bo If the termination of the process causes any process group to become
+ orphaned (usually because the parents of all members of the group
+ have now exited; see Orphaned Process Group in intro(2)), and if any
+ member of the orphaned group is stopped, the SIGHUP and SIGCONT
+ signals are sent to all members of the newly orphaned process group.
+
+ +\b+\bo\bo If the process is a controlling process (see intro(2)), the SIGHUP
+ signal is sent to the foreground process group of the controlling
+ terminal, and all current access to the controlling terminal is
+ revoked.
+
+ Most C programs call the library routine exit(3), which flushes buffers,
+ closes streams, unlinks temporary files, etc., and then calls _\b_e\bex\bxi\bit\bt().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ _\b_e\bex\bxi\bit\bt() and _\b_E\bEx\bxi\bit\bt() can never return.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fork(2), intro(2), sigaction(2), wait(2), exit(3), sysexits(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The _\b_e\bex\bxi\bit\bt() function conform to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ _\b_E\bEx\bxi\bit\bt() function conforms to ISO/IEC 9899:1999 (``ISO C99'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An e\bex\bxi\bit\bt() system call first appeared in Version 1 AT&T UNIX. It accepts
+ the _\bs_\bt_\ba_\bt_\bu_\bs argument since Version 2 AT&T UNIX. An _\b_e\bex\bxi\bit\bt() variant first
+ appeared in Version 7 AT&T UNIX. The _\b_E\bEx\bxi\bit\bt() function appeared in
+ OpenBSD 3.6.
+
+N\bNA\bAM\bME\bE
+ a\bac\bcc\bce\bep\bpt\bt, a\bac\bcc\bce\bep\bpt\bt4\b4 - accept a connection on a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bep\bpt\bt(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\ba_\bd_\bd_\br, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\ba_\bd_\bd_\br_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bep\bpt\bt4\b4(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\ba_\bd_\bd_\br, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\ba_\bd_\bd_\br_\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The argument _\bs is a socket that has been created with socket(2), bound to
+ an address with bind(2), and is listening for connections after a
+ listen(2). The a\bac\bcc\bce\bep\bpt\bt() call extracts the first connection request on
+ the queue of pending connections, creates a new socket with the same non-
+ blocking I/O mode as _\bs, and allocates a new file descriptor for the
+ socket with the close-on-exec flag clear.
+
+ The a\bac\bcc\bce\bep\bpt\bt4\b4() system call is similar, however the non-blocking I/O mode
+ of the new socket is determined by the SOCK_NONBLOCK flag in the _\bf_\bl_\ba_\bg_\bs
+ argument and the close-on-exec flag on the new file descriptor is
+ determined by the SOCK_CLOEXEC flag in the _\bf_\bl_\ba_\bg_\bs argument.
+
+ If no pending connections are present on the queue, and the socket is not
+ marked as non-blocking, a\bac\bcc\bce\bep\bpt\bt() blocks the caller until a connection is
+ present. If the socket is marked non-blocking and no pending connections
+ are present on the queue, a\bac\bcc\bce\bep\bpt\bt() returns an error as described below.
+ The accepted socket may not be used to accept more connections. The
+ original socket _\bs remains open.
+
+ The argument _\ba_\bd_\bd_\br is a result parameter that is filled in with the
+ address of the connecting entity as known to the communications layer.
+ The exact format of the _\ba_\bd_\bd_\br parameter is determined by the domain in
+ which the communication is occurring. The structure sockaddr_storage
+ exists for greater portability. It is large enough to hold any of the
+ types that may be returned in the _\ba_\bd_\bd_\br parameter.
+
+ The _\ba_\bd_\bd_\br_\bl_\be_\bn is a value-result parameter; it should initially contain the
+ amount of space pointed to by _\ba_\bd_\bd_\br; on return it will contain the actual
+ length (in bytes) of the address returned. If _\ba_\bd_\bd_\br_\bl_\be_\bn does not point to
+ enough space to hold the entire socket address, the result will be
+ truncated to the initial value of _\ba_\bd_\bd_\br_\bl_\be_\bn (in bytes). This call is used
+ with connection-based socket types, currently with SOCK_STREAM.
+
+ It is possible to select(2) or poll(2) a socket for the purposes of doing
+ an a\bac\bcc\bce\bep\bpt\bt() by selecting it for read.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns -1 on error. If it succeeds, it returns a non-negative
+ integer that is a descriptor for the accepted socket.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+ The following code uses struct sockaddr_storage to allocate enough space
+ for the returned address:
+
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
+ struct sockaddr_storage addr;
+ socklen_t len = sizeof(addr);
+ int retcode;
+
+ retcode = accept(s, (struct sockaddr *)&addr, &len);
+ if (retcode == -1)
+ err(1, "accept");
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bac\bcc\bce\bep\bpt\bt() and a\bac\bcc\bce\bep\bpt\bt4\b4() will fail if:
+
+ [EBADF] The descriptor is invalid.
+
+ [ENOTSOCK] The descriptor doesn't reference a socket.
+
+ [EOPNOTSUPP] The referenced socket is not of type SOCK_STREAM.
+
+ [EINTR] A signal was caught before a connection arrived.
+
+ [EINVAL] The referenced socket is not listening for connections
+ (that is, listen(2) has not yet been called).
+
+ [EFAULT] The _\ba_\bd_\bd_\br or _\ba_\bd_\bd_\br_\bl_\be_\bn parameter is not in a valid part
+ of the process address space.
+
+ [EWOULDBLOCK] The socket is marked non-blocking and no connections
+ are present to be accepted.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ [ECONNABORTED] A connection has been aborted.
+
+ In addition, a\bac\bcc\bce\bep\bpt\bt4\b4() will fail if
+
+ [EINVAL] _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ bind(2), connect(2), listen(2), poll(2), select(2), socket(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The a\bac\bcc\bce\bep\bpt\bt() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+ The a\bac\bcc\bce\bep\bpt\bt4\b4() function is expected to conform to a future revision of
+ that standard.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The a\bac\bcc\bce\bep\bpt\bt() system call first appeared in 4.1cBSD and a\bac\bcc\bce\bep\bpt\bt4\b4() in
+ OpenBSD 5.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ When EMFILE or ENFILE is returned, new connections are neither dequeued
+ nor discarded. Thus considerable care is required in select(2) and
+ poll(2) loops.
+
+N\bNA\bAM\bME\bE
+ a\bac\bcc\bce\bep\bpt\bt, a\bac\bcc\bce\bep\bpt\bt4\b4 - accept a connection on a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bep\bpt\bt(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\ba_\bd_\bd_\br, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\ba_\bd_\bd_\br_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bep\bpt\bt4\b4(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\ba_\bd_\bd_\br, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\ba_\bd_\bd_\br_\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The argument _\bs is a socket that has been created with socket(2), bound to
+ an address with bind(2), and is listening for connections after a
+ listen(2). The a\bac\bcc\bce\bep\bpt\bt() call extracts the first connection request on
+ the queue of pending connections, creates a new socket with the same non-
+ blocking I/O mode as _\bs, and allocates a new file descriptor for the
+ socket with the close-on-exec flag clear.
+
+ The a\bac\bcc\bce\bep\bpt\bt4\b4() system call is similar, however the non-blocking I/O mode
+ of the new socket is determined by the SOCK_NONBLOCK flag in the _\bf_\bl_\ba_\bg_\bs
+ argument and the close-on-exec flag on the new file descriptor is
+ determined by the SOCK_CLOEXEC flag in the _\bf_\bl_\ba_\bg_\bs argument.
+
+ If no pending connections are present on the queue, and the socket is not
+ marked as non-blocking, a\bac\bcc\bce\bep\bpt\bt() blocks the caller until a connection is
+ present. If the socket is marked non-blocking and no pending connections
+ are present on the queue, a\bac\bcc\bce\bep\bpt\bt() returns an error as described below.
+ The accepted socket may not be used to accept more connections. The
+ original socket _\bs remains open.
+
+ The argument _\ba_\bd_\bd_\br is a result parameter that is filled in with the
+ address of the connecting entity as known to the communications layer.
+ The exact format of the _\ba_\bd_\bd_\br parameter is determined by the domain in
+ which the communication is occurring. The structure sockaddr_storage
+ exists for greater portability. It is large enough to hold any of the
+ types that may be returned in the _\ba_\bd_\bd_\br parameter.
+
+ The _\ba_\bd_\bd_\br_\bl_\be_\bn is a value-result parameter; it should initially contain the
+ amount of space pointed to by _\ba_\bd_\bd_\br; on return it will contain the actual
+ length (in bytes) of the address returned. If _\ba_\bd_\bd_\br_\bl_\be_\bn does not point to
+ enough space to hold the entire socket address, the result will be
+ truncated to the initial value of _\ba_\bd_\bd_\br_\bl_\be_\bn (in bytes). This call is used
+ with connection-based socket types, currently with SOCK_STREAM.
+
+ It is possible to select(2) or poll(2) a socket for the purposes of doing
+ an a\bac\bcc\bce\bep\bpt\bt() by selecting it for read.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns -1 on error. If it succeeds, it returns a non-negative
+ integer that is a descriptor for the accepted socket.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+ The following code uses struct sockaddr_storage to allocate enough space
+ for the returned address:
+
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
+ struct sockaddr_storage addr;
+ socklen_t len = sizeof(addr);
+ int retcode;
+
+ retcode = accept(s, (struct sockaddr *)&addr, &len);
+ if (retcode == -1)
+ err(1, "accept");
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bac\bcc\bce\bep\bpt\bt() and a\bac\bcc\bce\bep\bpt\bt4\b4() will fail if:
+
+ [EBADF] The descriptor is invalid.
+
+ [ENOTSOCK] The descriptor doesn't reference a socket.
+
+ [EOPNOTSUPP] The referenced socket is not of type SOCK_STREAM.
+
+ [EINTR] A signal was caught before a connection arrived.
+
+ [EINVAL] The referenced socket is not listening for connections
+ (that is, listen(2) has not yet been called).
+
+ [EFAULT] The _\ba_\bd_\bd_\br or _\ba_\bd_\bd_\br_\bl_\be_\bn parameter is not in a valid part
+ of the process address space.
+
+ [EWOULDBLOCK] The socket is marked non-blocking and no connections
+ are present to be accepted.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ [ECONNABORTED] A connection has been aborted.
+
+ In addition, a\bac\bcc\bce\bep\bpt\bt4\b4() will fail if
+
+ [EINVAL] _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ bind(2), connect(2), listen(2), poll(2), select(2), socket(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The a\bac\bcc\bce\bep\bpt\bt() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+ The a\bac\bcc\bce\bep\bpt\bt4\b4() function is expected to conform to a future revision of
+ that standard.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The a\bac\bcc\bce\bep\bpt\bt() system call first appeared in 4.1cBSD and a\bac\bcc\bce\bep\bpt\bt4\b4() in
+ OpenBSD 5.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ When EMFILE or ENFILE is returned, new connections are neither dequeued
+ nor discarded. Thus considerable care is required in select(2) and
+ poll(2) loops.
+
+N\bNA\bAM\bME\bE
+ a\bac\bcc\bce\bes\bss\bs, f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt - check access permissions of a file or pathname
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bes\bss\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\ba_\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\ba_\bm_\bo_\bd_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The a\bac\bcc\bce\bes\bss\bs() function checks the accessibility of the file named by _\bp_\ba_\bt_\bh
+ for the access permissions indicated by _\ba_\bm_\bo_\bd_\be. The _\ba_\bm_\bo_\bd_\be argument is
+ either the bitwise OR of one or more of the access permissions to be
+ checked (R_OK for read permission, W_OK for write permission, and X_OK
+ for execute/search permission) or the existence test, F_OK. All
+ components of the pathname _\bp_\ba_\bt_\bh are checked for access permissions
+ (including F_OK).
+
+ The real user ID is used in place of the effective user ID and the real
+ group access list (including the real group ID) is used in place of the
+ effective ID for verifying permission.
+
+ If the invoking process has superuser privileges, a\bac\bcc\bce\bes\bss\bs() will always
+ indicate success for R_OK and W_OK, regardless of the actual file
+ permission bits. Likewise, for X_OK, if the file has any of the execute
+ bits set and _\bp_\ba_\bt_\bh is not a directory, a\bac\bcc\bce\bes\bss\bs() will indicate success.
+
+ The f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() function is equivalent to a\bac\bcc\bce\bes\bss\bs() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the file whose accessibility is checked is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+ If _\bf_\bl_\ba_\bg is also zero, the behavior is identical to a call to a\bac\bcc\bce\bes\bss\bs().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_EACCESS The checks for accessibility are performed using the
+ effective user and group IDs instead of the real user
+ and group IDs.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If _\bp_\ba_\bt_\bh cannot be found or if any of the desired access modes would not
+ be granted, then a -1 value is returned; otherwise a 0 value is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ Access to the file is denied if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] Write access is requested for a file on a read-only
+ file system.
+
+ [ETXTBSY] Write access is requested for a pure procedure (shared
+ text) file presently being executed.
+
+ [EACCES] Permission bits of the file mode do not permit the
+ requested access, or search permission is denied on a
+ component of the path prefix. The owner of a file has
+ permission checked with respect to the ``owner'' read,
+ write, and execute mode bits, members of the file's
+ group other than the owner have permission checked
+ with respect to the ``group'' mode bits, and all
+ others have permissions checked with respect to the
+ ``other'' mode bits.
+
+ [EPERM] Write access has been requested and the named file has
+ its immutable flag set (see chflags(2)).
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] An invalid value was specified for _\ba_\bm_\bo_\bd_\be.
+
+ Additionally, f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_EACCESS.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The a\bac\bcc\bce\bes\bss\bs() and f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ a\bac\bcc\bce\bes\bss\bs() first appeared as an internal kernel function in Version 1 AT&T
+ UNIX and was reimplemented in C before the release of Version 4 AT&T
+ UNIX. It was first promoted to a system call in the Programmer's
+ Workbench (PWB/UNIX), which was later ported to Version 7 AT&T UNIX and
+ 2BSD.
+
+ The f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() function appeared in OpenBSD 5.0.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ Ken Thompson first implemented the a\bac\bcc\bce\bes\bss\bs() kernel function in C.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ a\bac\bcc\bce\bes\bss\bs() and f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() should never be used for actual access control.
+ Doing so can result in a time of check vs. time of use security hole.
+
+N\bNA\bAM\bME\bE
+ a\bac\bcc\bct\bt - enable or disable process accounting
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bct\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The a\bac\bcc\bct\bt() call enables or disables the collection of system accounting
+ records. If _\bf_\bi_\bl_\be is NULL, accounting is disabled. If _\bf_\bi_\bl_\be is an
+ existing, NUL-terminated pathname, record collection is enabled and for
+ every process initiated which terminates under normal conditions an
+ accounting record is appended to _\bf_\bi_\bl_\be. Abnormal conditions of
+ termination are reboots or other fatal system problems. Records for
+ processes which never terminate cannot be produced by a\bac\bcc\bct\bt(). a\bac\bcc\bct\bt() is
+ only available on kernels compiled with the A\bAC\bCC\bCO\bOU\bUN\bNT\bTI\bIN\bNG\bG option.
+
+ For more information on the record structure used by a\bac\bcc\bct\bt(), see
+ _\b/_\bu_\bs_\br_\b/_\bi_\bn_\bc_\bl_\bu_\bd_\be_\b/_\bs_\by_\bs_\b/_\ba_\bc_\bc_\bt_\b._\bh and acct(5).
+
+ This call is permitted only to the superuser.
+
+N\bNO\bOT\bTE\bES\bS
+ Accounting is automatically disabled when the file system the accounting
+ file resides on runs out of space; it is enabled when space once again
+ becomes available.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bac\bcc\bct\bt() will fail if one of the following is true:
+
+ [EPERM] The caller is not the superuser.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix, or the path name is not a regular file.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bf_\bi_\bl_\be points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ acct(5), accton(8), sa(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An a\bac\bcc\bct\bt() function call appeared in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ a\bad\bdj\bjf\bfr\bre\beq\bq - correct the rate of the system clock
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bad\bdj\bjf\bfr\bre\beq\bq(_\bc_\bo_\bn_\bs_\bt _\bi_\bn_\bt_\b6_\b4_\b__\bt _\b*_\bf_\br_\be_\bq, _\bi_\bn_\bt_\b6_\b4_\b__\bt _\b*_\bo_\bl_\bd_\bf_\br_\be_\bq);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bad\bdj\bjf\bfr\bre\beq\bq() adjusts the rate in which time progresses if _\bf_\br_\be_\bq is non-null.
+ The unit of the rate of adjustment is nanoseconds per second, shifted
+ left 32 bits to allow for fractional values.
+
+ If _\bo_\bl_\bd_\bf_\br_\be_\bq is non-null, the current value is returned.
+
+ Only the superuser may adjust the frequency.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bad\bdj\bjf\bfr\bre\beq\bq() will fail if:
+
+ [EFAULT] Either of the arguments point outside the process's
+ allocated address space.
+
+ [EPERM] The _\bf_\br_\be_\bq argument is non-null and the process's
+ effective user ID is not that of the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), gettimeofday(2), ntpd(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The a\bad\bdj\bjf\bfr\bre\beq\bq() function call first appeared in OpenBSD 4.0.
+
+N\bNA\bAM\bME\bE
+ a\bad\bdj\bjt\bti\bim\bme\be - correct the time to allow synchronization of the system clock
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bad\bdj\bjt\bti\bim\bme\be(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bd_\be_\bl_\bt_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bo_\bl_\bd_\bd_\be_\bl_\bt_\ba);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bad\bdj\bjt\bti\bim\bme\be() makes small adjustments to the system time, as returned by
+ gettimeofday(2), advancing or retarding it by the time specified by the
+ timeval _\bd_\be_\bl_\bt_\ba. If _\bd_\be_\bl_\bt_\ba is negative, the clock is slowed down by
+ incrementing it more slowly than normal until the correction is complete.
+ If _\bd_\be_\bl_\bt_\ba is positive, a larger increment than normal is used. The skew
+ used to perform the correction is generally a fraction of one percent.
+ Thus, the time is always a monotonically increasing function. A time
+ correction from an earlier call to a\bad\bdj\bjt\bti\bim\bme\be() may not be finished when
+ a\bad\bdj\bjt\bti\bim\bme\be() is called again. If _\bd_\be_\bl_\bt_\ba is null, no adjustment is done. If
+ _\bo_\bl_\bd_\bd_\be_\bl_\bt_\ba is non-null, the structure pointed to will contain, upon return,
+ the number of microseconds still to be corrected from the earlier call.
+ Setting the time with settimeofday(2) will cancel any in-progress time
+ adjustment.
+
+ This call may be used by time servers that synchronize the clocks of
+ computers in a local area network. Such time servers would slow down the
+ clocks of some machines and speed up the clocks of others to bring them
+ to the average network time.
+
+ Only the superuser may adjust the time using the a\bad\bdj\bjt\bti\bim\bme\be() function.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bad\bdj\bjt\bti\bim\bme\be() will fail if:
+
+ [EFAULT] Either of the arguments point outside the process's
+ allocated address space.
+
+ [EPERM] The d\bde\bel\blt\bta\ba() argument is non-null and the process's
+ effective user ID is not that of the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjfreq(2), gettimeofday(2), ntpd(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The a\bad\bdj\bjt\bti\bim\bme\be() function call appeared in 4.3BSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Other operating systems restrict calling k\bkq\bqu\bue\beu\bue\be to the superuser and
+ might not allow requesting the current correction without specifying a
+ new value.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be, i\bin\bnb\bb, i\bin\bnl\bl, i\bin\bnw\bw, i\bio\bop\bpe\ber\brm\bm, m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, o\bou\but\btb\bb, o\bou\but\btl\bl, o\bou\but\btw\bw, r\bre\bea\bad\bdb\bb,
+ r\bre\bea\bad\bdl\bl, r\bre\bea\bad\bdw\bw, u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by, w\bwr\bri\bit\bte\beb\bb, w\bwr\bri\bit\bte\bel\bl, w\bwr\bri\bit\bte\bew\bw - Alpha devices I/O
+ ports and memory access functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ _\bu_\b__\bi_\bn_\bt_\b6_\b4_\b__\bt
+ d\bde\ben\bns\bse\be_\b_b\bba\bas\bse\be(_\bv_\bo_\bi_\bd);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ i\bin\bnb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ i\bin\bnl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ i\bin\bnw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt);
+
+ _\bi_\bn_\bt
+ i\bio\bop\bpe\ber\brm\bm(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bf_\br_\bo_\bm, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\bn_\bu_\bm, _\bi_\bn_\bt _\bo_\bn);
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\ba_\bd_\bd_\br_\be_\bs_\bs, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btb\bb(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btl\bl(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ o\bou\but\btw\bw(_\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bp_\bo_\br_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+ _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt
+ r\bre\bea\bad\bdb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt
+ r\bre\bea\bad\bdl\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt
+ r\bre\bea\bad\bdw\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ _\bv_\bo_\bi_\bd
+ u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bs_\bi_\bz_\be);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\beb\bb(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b8_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bel\bl(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bv_\ba_\bl);
+
+ _\bv_\bo_\bi_\bd
+ w\bwr\bri\bit\bte\bew\bw(_\bv_\bo_\bi_\bd _\b*_\bh_\ba_\bn_\bd_\bl_\be, _\bu_\b__\bi_\bn_\bt_\b3_\b2_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt_\b1_\b6_\b__\bt _\bv_\ba_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The functions in libalpha give userland programs access to the I/O ports
+ on the OpenBSD/alpha platform.
+
+ The i\bin\bn*\b*() functions return data read from the specified I/O port.
+
+ The o\bou\but\bt*\b*() functions write data to the specified I/O port.
+
+ i\bio\bop\bpe\ber\brm\bm() enables access to the specified port numbers if _\bo_\bn is TRUE and
+ disables access if _\bo_\bn is FALSE.
+
+ The m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function allows a user program to map part of a device
+ memory.
+
+ The u\bun\bnm\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by() function unmaps memory that was previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The r\bre\bea\bad\bd*\b*() functions read data from device memory previously mapped by
+ m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ The w\bwr\bri\bit\bte\be*\b*() functions write data to the device memory previously mapped
+ by m\bma\bap\bp_\b_m\bme\bem\bmo\bor\bry\by().
+
+ N\bNo\bot\bte\be: Code using these functions must be compiled using -\b-l\bla\bal\blp\bph\bha\ba.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions originally appeared in FreeBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Only BWX bus access method is supported for now. Machines requiring swiz
+ type access are not supported.
+
+ Root credentials are needed to use these functions.
+
+N\bNA\bAM\bME\bE
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be, a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be - manage amd64 per-thread %fs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() copies the current base address of the %fs segment
+ into the memory referenced by _\bb_\ba_\bs_\be.
+
+ a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() sets the base address of the %fs segment to the
+ address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bla\bam\bmd\bd6\b64\b4.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ The ELF Thread-Local Storage ABI reserves %fs for its own use and
+ requires that the dynamic linker and thread library set it to reference
+ data-structures internal to and shared between them. Programs should use
+ the __thread storage class keyword instead of using these calls. To be
+ maximally portable, programs that require per-thread data should use the
+ p\bpt\bth\bhr\bre\bea\bad\bd_\b_k\bke\bey\by_\b_c\bcr\bre\bea\bat\bte\be() interface.
+
+N\bNA\bAM\bME\bE
+ a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl - change the amd64 I/O privilege level
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl(_\bi_\bn_\bt _\bi_\bo_\bp_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl() sets the amd64 I/O privilege level to the value specified by
+ _\bi_\bo_\bp_\bl.
+
+ This call may only be made by the superuser. Additionally, it is only
+ permitted when the securelevel(7) is less than or equal to 0 or the
+ _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be sysctl has been set to a non-zero value.
+
+ N\bNo\bot\bte\be:\b: Code using the a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl() function must be compiled using
+ -\b-l\bla\bam\bmd\bd6\b64\b4.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl() returns 0. Otherwise, a value
+ of -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bam\bmd\bd6\b64\b4_\b_i\bio\bop\bpl\bl() will fail if:
+
+ [EPERM] The caller was not the superuser, or the securelevel is greater
+ than zero and _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be has not been set to a non-
+ zero value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ securelevel(7)
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ Intel, _\bA_\bM_\bD_\b6_\b4 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your machine if you enable user-level I/O and write
+ to hardware ports without care.
+
+N\bNA\bAM\bME\bE
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be, a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be - manage amd64 per-thread %fs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() copies the current base address of the %fs segment
+ into the memory referenced by _\bb_\ba_\bs_\be.
+
+ a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() sets the base address of the %fs segment to the
+ address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bla\bam\bmd\bd6\b64\b4.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and a\bam\bmd\bd6\b64\b4_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bam\bmd\bd6\b64\b4_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ The ELF Thread-Local Storage ABI reserves %fs for its own use and
+ requires that the dynamic linker and thread library set it to reference
+ data-structures internal to and shared between them. Programs should use
+ the __thread storage class keyword instead of using these calls. To be
+ maximally portable, programs that require per-thread data should use the
+ p\bpt\bth\bhr\bre\bea\bad\bd_\b_k\bke\bey\by_\b_c\bcr\bre\bea\bat\bte\be() interface.
+
+N\bNA\bAM\bME\bE
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf - drains the CPU write buffer
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf();
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf() will make sure that all the entries in the processor
+ write buffer are written out to memory.
+
+ Not all processors support this operation (currently only the SA110
+ does). Those processes that do not, treat this function as a null-op.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf() will never fail so will always return 0.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ StrongARM Data Sheet
+
+N\bNA\bAM\bME\bE
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be - clean the CPU data cache and flush the CPU instruction
+ cache
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be(_\bu_\b__\bi_\bn_\bt _\ba_\bd_\bd_\br, _\bi_\bn_\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will make sure that all the entries in the processor
+ instruction cache are synchronized with main memory and that any data in
+ a write back cache has been cleaned. Some ARM processors (e.g. SA110)
+ have separate instruction and data caches, thus any dynamically generated
+ or modified code needs to be written back from any data caches to main
+ memory and the instruction cache needs to be synchronized with main
+ memory.
+
+ On such processors, a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will clean the data cache and
+ invalidate the processor instruction cache to force reloading from main
+ memory. On processors that have a shared instruction and data cache and
+ have a write through cache (e.g. ARM6), no action needs to be taken.
+
+ The routine takes a start address _\ba_\bd_\bd_\br and a length _\bl_\be_\bn to describe the
+ area of memory that needs to be cleaned and synchronized.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will never fail so will always return 0.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ StrongARM Data Sheet
+
+N\bNA\bAM\bME\bE
+ b\bbi\bin\bnd\bd - bind a name to a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ b\bbi\bin\bnd\bd(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ b\bbi\bin\bnd\bd() assigns a name to an unnamed socket. When a socket is created
+ with socket(2) it exists in a name space (address family) but has no name
+ assigned. b\bbi\bin\bnd\bd() requests that _\bn_\ba_\bm_\be be assigned to the socket. _\bn_\ba_\bm_\be_\bl_\be_\bn
+ indicates the amount of space pointed to by _\bn_\ba_\bm_\be, in bytes.
+
+N\bNO\bOT\bTE\bES\bS
+ Binding a name in the UNIX-domain creates a socket in the file system
+ that must be deleted by the caller when it is no longer needed (using
+ unlink(2)).
+
+ The rules used in name binding vary between communication domains.
+ Consult the manual entries in section 4 for detailed information.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The b\bbi\bin\bnd\bd() function will fail if:
+
+ [EBADF] _\bs is not a valid descriptor.
+
+ [ENOTSOCK] _\bs is not a socket.
+
+ [EADDRNOTAVAIL] The specified address is not available from the local
+ machine.
+
+ [EADDRINUSE] The specified address is already in use.
+
+ [EINVAL] The socket is already bound to an address, or _\bn_\ba_\bm_\be_\bl_\be_\bn
+ is not a valid length for the supplied address.
+
+ [EAFNOSUPPORT] The family of the socket and that requested in
+ _\bn_\ba_\bm_\be_\b-_\b>_\bs_\ba_\b__\bf_\ba_\bm_\bi_\bl_\by are not equivalent.
+
+ [ENOBUFS] Insufficient buffer space is available.
+
+ [EACCES] The requested address is protected, and the current
+ user has inadequate permission to access it.
+
+ [EFAULT] The _\bn_\ba_\bm_\be parameter is not in a valid part of the user
+ address space.
+
+ The following errors are specific to binding names in the UNIX-domain.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A prefix component of the path name does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EROFS] The name would reside on a read-only file system.
+
+ [EISDIR] An empty pathname was specified.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), getsockname(2), listen(2), socket(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The b\bbi\bin\bnd\bd() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The b\bbi\bin\bnd\bd() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ b\bbr\brk\bk, s\bsb\bbr\brk\bk - change data segment size
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ b\bbr\brk\bk(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br);
+
+ _\bv_\bo_\bi_\bd _\b*
+ s\bsb\bbr\brk\bk(_\bi_\bn_\bt _\bi_\bn_\bc_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ T\bTh\bhe\be b\bbr\brk\bk(\b()\b) a\ban\bnd\bd s\bsb\bbr\brk\bk(\b()\b) f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs a\bar\bre\be h\bhi\bis\bst\bto\bor\bri\bic\bca\bal\bl c\bcu\bur\bri\bio\bos\bsi\bit\bti\bie\bes\bs l\ble\bef\bft\bt o\bov\bve\ber\br f\bfr\bro\bom\bm
+ e\bea\bar\brl\bli\bie\ber\br d\bda\bay\bys\bs b\bbe\bef\bfo\bor\bre\be t\bth\bhe\be a\bad\bdv\bve\ben\bnt\bt o\bof\bf v\bvi\bir\brt\btu\bua\bal\bl m\bme\bem\bmo\bor\bry\by m\bma\ban\bna\bag\bge\bem\bme\ben\bnt\bt.\b. The b\bbr\brk\bk()
+ function sets the break or lowest address of a process's data segment
+ (uninitialized data) to _\ba_\bd_\bd_\br (immediately above bss). Data addressing is
+ restricted between _\ba_\bd_\bd_\br and the lowest stack pointer to the stack
+ segment. Memory is allocated by b\bbr\brk\bk() in page size pieces; if _\ba_\bd_\bd_\br is
+ not evenly divisible by the system page size, it is increased to the next
+ page boundary.
+
+ The current value of the program break is reliably returned by
+ ``sbrk(0)'' (see also end(3)). The getrlimit(2) system call may be used
+ to determine the maximum permissible size of the _\bd_\ba_\bt_\ba segment; it will
+ not be possible to set the break beyond the _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx value returned from
+ a call to getrlimit(2), e.g., ``etext + rlp->rlim_max'' (see end(3) for
+ the definition of _\be_\bt_\be_\bx_\bt).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The b\bbr\brk\bk() function returns the value 0 if successful; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+ The s\bsb\bbr\brk\bk() function returns a pointer to the base of the new storage if
+ successful; otherwise -1 with _\be_\br_\br_\bn_\bo set to indicate why the allocation
+ failed.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsb\bbr\brk\bk() will fail and no additional memory will be allocated if one of the
+ following are true:
+
+ [ENOMEM] The limit, as set by setrlimit(2), was exceeded.
+
+ [ENOMEM] The maximum possible size of a data segment (compiled
+ into the system) was exceeded.
+
+ [ENOMEM] Insufficient space existed in the swap area to support
+ the expansion.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ execve(2), getrlimit(2), mmap(2), end(3), malloc(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A b\bbr\brk\bk() function call appeared in Version 7 AT&T UNIX.
+
+B\bBU\bUG\bGS\bS
+ Setting the break may fail due to a temporary lack of swap space. It is
+ not possible to distinguish this from a failure caused by exceeding the
+ maximum size of the data segment without consulting getrlimit(2).
+
+N\bNA\bAM\bME\bE
+ c\bch\bhd\bdi\bir\br, f\bfc\bch\bhd\bdi\bir\br - change current working directory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhd\bdi\bir\br(_\bi_\bn_\bt _\bf_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\bp_\ba_\bt_\bh argument points to the pathname of a directory. The c\bch\bhd\bdi\bir\br()
+ function causes the named directory to become the current working
+ directory, that is, the starting point for path searches of pathnames not
+ beginning with a slash (`/').
+
+ The f\bfc\bch\bhd\bdi\bir\br() function causes the directory referenced by _\bf_\bd to become the
+ current working directory, the starting point for path searches of
+ pathnames not beginning with a slash (`/').
+
+ In order for a directory to become the current directory, a process must
+ have execute (search) access to the directory.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhd\bdi\bir\br() will fail and the current working directory will be unchanged if
+ one or more of the following are true:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named directory does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EACCES] Search permission is denied for any component of the
+ pathname.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ f\bfc\bch\bhd\bdi\bir\br() will fail and the current working directory will be unchanged if
+ one or more of the following are true:
+
+ [EACCES] Search permission is denied for the directory
+ referenced by the file descriptor.
+
+ [ENOTDIR] The file descriptor does not reference a directory.
+
+ [EBADF] The argument _\bf_\bd is not a valid file descriptor.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chroot(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bhd\bdi\bir\br() and f\bfc\bch\bhd\bdi\bir\br() functions are expected to conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhd\bdi\bir\br() system call first appeared in Version 1 AT&T UNIX, and
+ f\bfc\bch\bhd\bdi\bir\br() in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhf\bfl\bla\bag\bgs\bs, c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt, f\bfc\bch\bhf\bfl\bla\bag\bgs\bs - set file flags
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs(_\bi_\bn_\bt _\bf_\bd, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bi_\bn_\bt _\ba_\bt_\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The file whose name is given by _\bp_\ba_\bt_\bh or referenced by the descriptor _\bf_\bd
+ has its flags changed to _\bf_\bl_\ba_\bg_\bs.
+
+ The flags are the bitwise OR of zero or more of the following values:
+
+ UF_NODUMP Do not dump the file.
+ UF_IMMUTABLE The file may not be changed.
+ UF_APPEND The file may only be appended to.
+ SF_ARCHIVED The file may be archived.
+ SF_IMMUTABLE The file may not be changed.
+ SF_APPEND The file may only be appended to.
+
+ The UF_IMMUTABLE and UF_APPEND flags may be set or unset by either the
+ owner of a file or the superuser.
+
+ The SF_ARCHIVED, SF_IMMUTABLE and SF_APPEND flags may only be set or
+ unset by the superuser. They may be set at any time, but normally may
+ only be unset when the system is in single-user mode. (See init(8) for
+ details.)
+
+ The c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except in the case
+ where _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be
+ changed is determined relative to the directory associated with the file
+ descriptor _\bf_\bd instead of the current working directory.
+
+ If c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+ If _\bf_\bl_\ba_\bg is also zero, the behavior is identical to a call to c\bch\bhf\bfl\bla\bag\bgs\bs().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the flags
+ of the symbolic link are changed.
+
+ The f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except that the file
+ whose flags are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chflags(1), init(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhf\bfl\bla\bag\bgs\bs() and f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() functions first appeared in 4.4BSD. The
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function first appeared in FreeBSD 10.0. It was added to
+ OpenBSD in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhf\bfl\bla\bag\bgs\bs, c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt, f\bfc\bch\bhf\bfl\bla\bag\bgs\bs - set file flags
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs(_\bi_\bn_\bt _\bf_\bd, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bi_\bn_\bt _\ba_\bt_\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The file whose name is given by _\bp_\ba_\bt_\bh or referenced by the descriptor _\bf_\bd
+ has its flags changed to _\bf_\bl_\ba_\bg_\bs.
+
+ The flags are the bitwise OR of zero or more of the following values:
+
+ UF_NODUMP Do not dump the file.
+ UF_IMMUTABLE The file may not be changed.
+ UF_APPEND The file may only be appended to.
+ SF_ARCHIVED The file may be archived.
+ SF_IMMUTABLE The file may not be changed.
+ SF_APPEND The file may only be appended to.
+
+ The UF_IMMUTABLE and UF_APPEND flags may be set or unset by either the
+ owner of a file or the superuser.
+
+ The SF_ARCHIVED, SF_IMMUTABLE and SF_APPEND flags may only be set or
+ unset by the superuser. They may be set at any time, but normally may
+ only be unset when the system is in single-user mode. (See init(8) for
+ details.)
+
+ The c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except in the case
+ where _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be
+ changed is determined relative to the directory associated with the file
+ descriptor _\bf_\bd instead of the current working directory.
+
+ If c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+ If _\bf_\bl_\ba_\bg is also zero, the behavior is identical to a call to c\bch\bhf\bfl\bla\bag\bgs\bs().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the flags
+ of the symbolic link are changed.
+
+ The f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except that the file
+ whose flags are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chflags(1), init(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhf\bfl\bla\bag\bgs\bs() and f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() functions first appeared in 4.4BSD. The
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function first appeared in FreeBSD 10.0. It was added to
+ OpenBSD in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhm\bmo\bod\bd, f\bfc\bch\bhm\bmo\bod\bda\bat\bt, f\bfc\bch\bhm\bmo\bod\bd - change mode of file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhm\bmo\bod\bd(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bd(_\bi_\bn_\bt _\bf_\bd, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bda\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bch\bhm\bmo\bod\bd() function sets the file permission bits of the file specified
+ by the pathname _\bp_\ba_\bt_\bh to _\bm_\bo_\bd_\be. c\bch\bhm\bmo\bod\bd() verifies that the process owner
+ (user) either owns the specified file or is the superuser.
+
+ The _\bm_\bo_\bd_\be argument is the bitwise OR of zero or more of the permission bit
+ masks from the following list:
+
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ #define S_ISUID 0004000 /* set user id on execution */
+ #define S_ISGID 0002000 /* set group id on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a file, it is ignored.
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a directory, an unprivileged
+ user may not delete or rename files of other users in that directory.
+ The sticky bit may be set by any user on a directory which the user owns
+ or has appropriate permissions. For more details of the properties of
+ the sticky bit, see sticky(8).
+
+ Writing or changing the owner of a file turns off the set-user-ID and
+ set-group-ID bits unless the user is the superuser. This makes the
+ system somewhat more secure by protecting set-user-ID (set-group-ID)
+ files from remaining set-user-ID (set-group-ID) if they are modified, at
+ the expense of a degree of compatibility.
+
+ The f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function is equivalent to c\bch\bhm\bmo\bod\bd() except in the case where
+ _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be changed is
+ determined relative to the directory associated with the file descriptor
+ _\bf_\bd instead of the current working directory.
+
+ If f\bfc\bch\bhm\bmo\bod\bda\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used. If _\bf_\bl_\ba_\bg is
+ also zero, the behavior is identical to a call to c\bch\bhm\bmo\bod\bd().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the mode
+ of the symbolic link is changed.
+
+ The f\bfc\bch\bhm\bmo\bod\bd() function is equivalent to c\bch\bhm\bmo\bod\bd() except that the file whose
+ permissions are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The c\bch\bhm\bmo\bod\bd() and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions will fail and the file mode will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, the f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EOPNOTSUPP] The _\bf_\bl_\ba_\bg argument specifies AT_SYMLINK_NOFOLLOW on a
+ symbolic link and the file system does not support
+ that operation.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bhm\bmo\bod\bd() will fail and the file mode will be unchanged if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(1), chown(2), open(2), stat(2), sticky(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bhm\bmo\bod\bd(), f\bfc\bch\bhm\bmo\bod\bd(), and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions are expected to conform
+ to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhm\bmo\bod\bd() system call first appeared in Version 1 AT&T UNIX; f\bfc\bch\bhm\bmo\bod\bd()
+ in 4.1cBSD; and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ c\bch\bho\bow\bwn\bn, l\blc\bch\bho\bow\bwn\bn, f\bfc\bch\bho\bow\bwn\bna\bat\bt, f\bfc\bch\bho\bow\bwn\bn - change owner and group of a file or
+ link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ l\blc\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bn(_\bi_\bn_\bt _\bf_\bd, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The owner ID and group ID of the file (or link) named by _\bp_\ba_\bt_\bh or
+ referenced by _\bf_\bd is changed as specified by the arguments _\bo_\bw_\bn_\be_\br and
+ _\bg_\br_\bo_\bu_\bp. The owner of a file may change the _\bg_\br_\bo_\bu_\bp to a group of which he
+ or she is a member, but the change _\bo_\bw_\bn_\be_\br capability is restricted to the
+ superuser.
+
+ By default, c\bch\bho\bow\bwn\bn() clears the set-user-ID and set-group-ID bits on the
+ file to prevent accidental or mischievous creation of set-user-ID and
+ set-group-ID programs. This behaviour can be overridden by setting the
+ sysctl(8) variable _\bf_\bs_\b._\bp_\bo_\bs_\bi_\bx_\b._\bs_\be_\bt_\bu_\bi_\bd to zero.
+
+ l\blc\bch\bho\bow\bwn\bn() operates similarly to how c\bch\bho\bow\bwn\bn() operated on older systems, and
+ does not follow symbolic links. It allows the owner and group of a
+ symbolic link to be set.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() function is equivalent to either the c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose ownership is changed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfc\bch\bho\bow\bwn\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ ownership of the symbolic link is changed.
+
+ f\bfc\bch\bho\bow\bwn\bn() is particularly useful when used in conjunction with the file
+ locking primitives (see flock(2)).
+
+ One of the owner or group IDs may be left unchanged by specifying it as
+ -1.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bho\bow\bwn\bn(), l\blc\bch\bho\bow\bwn\bn(), and f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail and the file or link will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bho\bow\bwn\bn() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EINVAL] _\bf_\bd refers to a socket, not a file.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chgrp(1), chmod(2), flock(2), chown(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bna\bat\bt(), and l\blc\bch\bho\bow\bwn\bn() functions are expected to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bho\bow\bwn\bn() system call first appeared in Version 1 AT&T UNIX. Since
+ Version 6 AT&T UNIX it supports changing the group as well, and in
+ Version 7 AT&T UNIX _\bg_\br_\bo_\bu_\bp was made a separate argument.
+
+ The f\bfc\bch\bho\bow\bwn\bn() system call first appeared in 4.1cBSD.
+
+ The c\bch\bho\bow\bwn\bn() and f\bfc\bch\bho\bow\bwn\bn() system calls were changed to follow symbolic
+ links in 4.4BSD; therefore, and for compatibility with AT&T System V
+ Release 4 UNIX, the l\blc\bch\bho\bow\bwn\bn() system call was added to OpenBSD 2.1.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhr\bro\boo\bot\bt - change root directory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhr\bro\boo\bot\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br_\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ _\bd_\bi_\br_\bn_\ba_\bm_\be is the address of the pathname of a directory, terminated by an
+ ASCII NUL. c\bch\bhr\bro\boo\bot\bt() causes _\bd_\bi_\br_\bn_\ba_\bm_\be to become the root directory, that
+ is, the starting point for path searches of pathnames beginning with `/'.
+
+ In order for a directory to become the root directory a process must have
+ execute (search) access for that directory.
+
+ If the program is not currently running with an altered root directory,
+ it should be noted that c\bch\bhr\bro\boo\bot\bt() has no effect on the process's current
+ directory.
+
+ If the program is already running with an altered root directory, the
+ process's current directory is changed to the same new root directory.
+ This prevents the current directory from being further up the directory
+ tree than the altered root directory.
+
+ This call is restricted to the superuser.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+ The following example changes the root directory to _\bn_\be_\bw_\br_\bo_\bo_\bt, sets the
+ current directory to the new root, and drops some setuid privileges.
+ There may be other privileges which need to be dropped as well.
+
+ #include <err.h>
+ #include <unistd.h>
+
+ if (chroot(newroot) != 0 || chdir("/") != 0)
+ err(1, "%s", newroot);
+ setresuid(getuid(), getuid(), getuid());
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhr\bro\boo\bot\bt() will fail and the root directory will be unchanged if:
+
+ [ENOTDIR] A component of the path name is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named directory does not exist.
+
+ [EACCES] Search permission is denied for any component of the
+ path name.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bd_\bi_\br_\bn_\ba_\bm_\be points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EPERM] The caller is not the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chdir(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhr\bro\boo\bot\bt() system call first appeared in Version 7 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ There are ways for a root process to escape from the chroot jail.
+ Changes to the directory hierarchy made from outside the chroot jail may
+ allow a restricted process to escape, even if it is unprivileged.
+ Passing directory file descriptors via recvmsg(2) from outside the chroot
+ jail may also allow a process to escape.
+
+N\bNA\bAM\bME\bE
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs - get/set/calibrate date and
+ time
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be() and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions allow the calling
+ process to retrieve or set the value used by a clock which is specified
+ by _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd.
+
+ _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd can be a value from clock_getcpuclockid(3) or
+ pthread_getcpuclockid(3) or one of five predefined values:
+
+ CLOCK_REALTIME time that increments as a wall clock should
+
+ CLOCK_PROCESS_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling process
+
+ CLOCK_THREAD_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling thread
+
+ CLOCK_MONOTONIC time that increments as a wall clock should but whose
+ absolute value is meaningless and cannot jump, providing
+ accurate realtime interval measurement, even across
+ suspend and resume
+
+ CLOCK_UPTIME time whose absolute value is the time the system has
+ been running and not suspended, providing accurate
+ uptime measurement, both absolute and interval
+
+ The structure pointed to by _\bt_\bp is defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh> as:
+
+ struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+ };
+
+ Only the CLOCK_REALTIME clock can be set, and only the superuser may do
+ so. If the system securelevel is greater than 1 (see init(8)), the time
+ may only be advanced. This limitation is imposed to prevent a malicious
+ superuser from setting arbitrary time stamps on files. The system time
+ can still be adjusted backwards using the adjtime(2) system call even
+ when the system is secure.
+
+ The resolution (granularity) of a clock is returned by the c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs()
+ call. This value is placed in a (non-null) _\b*_\bt_\bp.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs() will fail if:
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd is not a valid value.
+
+ [EFAULT] The _\bt_\bp argument address referenced invalid memory.
+
+ In addition, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() may return the following errors:
+
+ [EPERM] A user other than the superuser attempted to set the
+ time.
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd specifies a clock that isn't settable, _\bt_\bp
+ specifies a nanosecond value less than zero or greater
+ than 1000 million, or a value outside the range of the
+ specified clock.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), getitimer(2), gettimeofday(2),
+ clock_getcpuclockid(3), ctime(3), pthread_getcpuclockid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(), c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+ The CLOCK_UPTIME clock is an extension to that.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clocks appeared
+ in OpenBSD 5.4. The CLOCK_UPTIME clock first appeared in FreeBSD 7.0 and
+ was added to OpenBSD in OpenBSD 5.5.
+
+N\bNA\bAM\bME\bE
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs - get/set/calibrate date and
+ time
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be() and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions allow the calling
+ process to retrieve or set the value used by a clock which is specified
+ by _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd.
+
+ _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd can be a value from clock_getcpuclockid(3) or
+ pthread_getcpuclockid(3) or one of five predefined values:
+
+ CLOCK_REALTIME time that increments as a wall clock should
+
+ CLOCK_PROCESS_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling process
+
+ CLOCK_THREAD_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling thread
+
+ CLOCK_MONOTONIC time that increments as a wall clock should but whose
+ absolute value is meaningless and cannot jump, providing
+ accurate realtime interval measurement, even across
+ suspend and resume
+
+ CLOCK_UPTIME time whose absolute value is the time the system has
+ been running and not suspended, providing accurate
+ uptime measurement, both absolute and interval
+
+ The structure pointed to by _\bt_\bp is defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh> as:
+
+ struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+ };
+
+ Only the CLOCK_REALTIME clock can be set, and only the superuser may do
+ so. If the system securelevel is greater than 1 (see init(8)), the time
+ may only be advanced. This limitation is imposed to prevent a malicious
+ superuser from setting arbitrary time stamps on files. The system time
+ can still be adjusted backwards using the adjtime(2) system call even
+ when the system is secure.
+
+ The resolution (granularity) of a clock is returned by the c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs()
+ call. This value is placed in a (non-null) _\b*_\bt_\bp.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs() will fail if:
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd is not a valid value.
+
+ [EFAULT] The _\bt_\bp argument address referenced invalid memory.
+
+ In addition, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() may return the following errors:
+
+ [EPERM] A user other than the superuser attempted to set the
+ time.
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd specifies a clock that isn't settable, _\bt_\bp
+ specifies a nanosecond value less than zero or greater
+ than 1000 million, or a value outside the range of the
+ specified clock.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), getitimer(2), gettimeofday(2),
+ clock_getcpuclockid(3), ctime(3), pthread_getcpuclockid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(), c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+ The CLOCK_UPTIME clock is an extension to that.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clocks appeared
+ in OpenBSD 5.4. The CLOCK_UPTIME clock first appeared in FreeBSD 7.0 and
+ was added to OpenBSD in OpenBSD 5.5.
+
+N\bNA\bAM\bME\bE
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be, c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs - get/set/calibrate date and
+ time
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+ _\bi_\bn_\bt
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(_\bc_\bl_\bo_\bc_\bk_\bi_\bd_\b__\bt _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be() and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions allow the calling
+ process to retrieve or set the value used by a clock which is specified
+ by _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd.
+
+ _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd can be a value from clock_getcpuclockid(3) or
+ pthread_getcpuclockid(3) or one of five predefined values:
+
+ CLOCK_REALTIME time that increments as a wall clock should
+
+ CLOCK_PROCESS_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling process
+
+ CLOCK_THREAD_CPUTIME_ID
+ time that increments when the CPU is running in user or
+ kernel mode on behalf of the calling thread
+
+ CLOCK_MONOTONIC time that increments as a wall clock should but whose
+ absolute value is meaningless and cannot jump, providing
+ accurate realtime interval measurement, even across
+ suspend and resume
+
+ CLOCK_UPTIME time whose absolute value is the time the system has
+ been running and not suspended, providing accurate
+ uptime measurement, both absolute and interval
+
+ The structure pointed to by _\bt_\bp is defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh> as:
+
+ struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+ };
+
+ Only the CLOCK_REALTIME clock can be set, and only the superuser may do
+ so. If the system securelevel is greater than 1 (see init(8)), the time
+ may only be advanced. This limitation is imposed to prevent a malicious
+ superuser from setting arbitrary time stamps on files. The system time
+ can still be adjusted backwards using the adjtime(2) system call even
+ when the system is secure.
+
+ The resolution (granularity) of a clock is returned by the c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs()
+ call. This value is placed in a (non-null) _\b*_\bt_\bp.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs() will fail if:
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd is not a valid value.
+
+ [EFAULT] The _\bt_\bp argument address referenced invalid memory.
+
+ In addition, c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() may return the following errors:
+
+ [EPERM] A user other than the superuser attempted to set the
+ time.
+
+ [EINVAL] _\bc_\bl_\bo_\bc_\bk_\b__\bi_\bd specifies a clock that isn't settable, _\bt_\bp
+ specifies a nanosecond value less than zero or greater
+ than 1000 million, or a value outside the range of the
+ specified clock.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), getitimer(2), gettimeofday(2),
+ clock_getcpuclockid(3), ctime(3), pthread_getcpuclockid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btr\bre\bes\bs(), c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), and c\bcl\blo\boc\bck\bk_\b_s\bse\bet\btt\bti\bim\bme\be() functions
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+ The CLOCK_UPTIME clock is an extension to that.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clocks appeared
+ in OpenBSD 5.4. The CLOCK_UPTIME clock first appeared in FreeBSD 7.0 and
+ was added to OpenBSD in OpenBSD 5.5.
+
+N\bNA\bAM\bME\bE
+ c\bcl\blo\bos\bse\be - delete a descriptor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bcl\blo\bos\bse\be(_\bi_\bn_\bt _\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcl\blo\bos\bse\be() call deletes a descriptor _\bd from the per-process object
+ reference table. If this is the last reference to the underlying object,
+ the object will be deactivated. For example, on the last close of a
+ file, the current _\bs_\be_\be_\bk pointer associated with the file is lost; on the
+ last close of a socket(2), associated naming information and queued data
+ are discarded; and on the last close of a file holding an advisory lock,
+ the lock is released (see flock(2)). However, the semantics of System V
+ and IEEE Std 1003.1-1988 (``POSIX.1'') dictate that all fcntl(2) advisory
+ record locks associated with a file for a given process are removed when
+ _\ba_\bn_\by file descriptor for that file is closed by that process.
+
+ When a process exits, all associated file descriptors are freed, but
+ since there is a limit on active descriptors per process, the c\bcl\blo\bos\bse\be()
+ function call is useful when a large quantity of file descriptors are
+ being handled.
+
+ When a process forks (see fork(2)), all descriptors for the new child
+ process reference the same objects as they did in the parent before the
+ fork. If a new process image is to then be run using execve(2), the
+ process would normally inherit these descriptors. Most of the
+ descriptors can be rearranged with dup2(2) or deleted with c\bcl\blo\bos\bse\be() before
+ the execve(2) is attempted, but since some of these descriptors may still
+ be needed should the execve(2) fail, it is necessary to arrange for them
+ to be closed when the execve(2) succeeds. For this reason, the call
+ f\bfc\bcn\bnt\btl\bl(_\bd, _\bF_\b__\bS_\bE_\bT_\bF_\bD, _\bF_\bD_\b__\bC_\bL_\bO_\bE_\bX_\bE_\bC) is provided, which arranges that a
+ descriptor will be closed after a successful execve(2); the call f\bfc\bcn\bnt\btl\bl(_\bd,
+ _\bF_\b__\bS_\bE_\bT_\bF_\bD, _\b0) restores the default, which is to not close the descriptor.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bcl\blo\bos\bse\be() will fail if:
+
+ [EBADF] _\bd is not an active descriptor.
+
+ [EINTR] An interrupt was received.
+
+ [EIO] An I/O error occurred while writing to the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), closefrom(2), dup2(2), execve(2), fcntl(2), flock(2), open(2),
+ pipe(2), socket(2), socketpair(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ c\bcl\blo\bos\bse\be() conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bcl\blo\bos\bse\be() system call first appeared in Version 1 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ c\bcl\blo\bos\bse\bef\bfr\bro\bom\bm - delete many descriptors
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bcl\blo\bos\bse\bef\bfr\bro\bom\bm(_\bi_\bn_\bt _\bf_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcl\blo\bos\bse\bef\bfr\bro\bom\bm() call deletes all descriptors numbered _\bf_\bd and higher from
+ the per-process file descriptor table. It is effectively the same as
+ calling close(2) on each descriptor.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bcl\blo\bos\bse\bef\bfr\bro\bom\bm() will fail if:
+
+ [EBADF] _\bf_\bd is greater than all open file descriptors.
+
+ [EINTR] An interrupt was received.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ close(2)
+
+N\bNA\bAM\bME\bE
+ c\bco\bon\bnn\bne\bec\bct\bt - initiate a connection on a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bco\bon\bnn\bne\bec\bct\bt(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The parameter _\bs is a socket. If it is of type SOCK_DGRAM, this call
+ specifies the peer with which the socket is to be associated; this
+ address is that to which datagrams are to be sent, and the only address
+ from which datagrams are to be received. If the socket is of type
+ SOCK_STREAM, this call attempts to make a connection to another socket.
+ The other socket is specified by _\bn_\ba_\bm_\be, which is an address in the
+ communications space of the socket. _\bn_\ba_\bm_\be_\bl_\be_\bn indicates the amount of
+ space pointed to by _\bn_\ba_\bm_\be, in bytes. Each communications space interprets
+ the _\bn_\ba_\bm_\be parameter in its own way. Generally, stream sockets may use
+ c\bco\bon\bnn\bne\bec\bct\bt() only once; datagram sockets may use c\bco\bon\bnn\bne\bec\bct\bt() multiple times to
+ change their association. Datagram sockets may dissolve the association
+ by connecting to an invalid address, such as a null address.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the connection or binding succeeds, 0 is returned. Otherwise a -1 is
+ returned, and a more specific error code is stored in _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The c\bco\bon\bnn\bne\bec\bct\bt() call fails if:
+
+ [EBADF] _\bs is not a valid descriptor.
+
+ [ENOTSOCK] _\bs is not a socket.
+
+ [EADDRNOTAVAIL] The specified address is not available on this
+ machine.
+
+ [EAFNOSUPPORT] Addresses in the specified address family cannot be
+ used with this socket.
+
+ [EISCONN] The socket is already connected.
+
+ [ETIMEDOUT] Connection establishment timed out without
+ establishing a connection.
+
+ [EINVAL] A TCP connection with a local broadcast, the all-ones
+ or a multicast address as the peer was attempted.
+
+ [ECONNREFUSED] The attempt to connect was forcefully rejected.
+
+ [EHOSTUNREACH] The destination address specified an unreachable host.
+
+ [EINTR] A connect was interrupted before it succeeded by the
+ delivery of a signal.
+
+ [ENETUNREACH] The network isn't reachable from this host.
+
+ [EADDRINUSE] The address is already in use.
+
+ [EFAULT] The _\bn_\ba_\bm_\be parameter specifies an area outside the
+ process address space.
+
+ [EINPROGRESS] The socket is non-blocking and the connection cannot
+ be completed immediately. It is possible to select(2)
+ or poll(2) for completion by selecting the socket for
+ writing, and also use getsockopt(2) with SO_ERROR to
+ check for error conditions.
+
+ [EALREADY] The socket is non-blocking and a previous connection
+ attempt has not yet been completed.
+
+ The following errors are specific to connecting names in the UNIX-domain.
+ These errors may not apply in future versions of the UNIX IPC domain.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named socket does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] Write access to the named socket is denied.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPROTOTYPE] The file described by _\bn_\ba_\bm_\be is of a different type than
+ _\bs. E.g., _\bs may be of type SOCK_STREAM whereas _\bn_\ba_\bm_\be
+ may refer to a socket of type SOCK_DGRAM.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), getsockname(2), getsockopt(2), poll(2), select(2), socket(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bco\bon\bnn\bne\bec\bct\bt() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bco\bon\bnn\bne\bec\bct\bt() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ d\bdu\bup\bp, d\bdu\bup\bp2\b2, d\bdu\bup\bp3\b3 - duplicate an existing file descriptor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp(_\bi_\bn_\bt _\bo_\bl_\bd_\bd);
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp2\b2(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp3\b3(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ d\bdu\bup\bp() duplicates an existing object descriptor and returns its value to
+ the calling process (_\bn_\be_\bw_\bd = d\bdu\bup\bp(_\bo_\bl_\bd_\bd)). The argument _\bo_\bl_\bd_\bd is a small
+ non-negative integer index in the per-process descriptor table. The
+ value must be less than the size of the table, which is returned by
+ getdtablesize(3). The new descriptor returned by the call is the lowest
+ numbered descriptor currently not in use by the process.
+
+ The object referenced by the descriptor does not distinguish between _\bo_\bl_\bd_\bd
+ and _\bn_\be_\bw_\bd in any way. Thus if _\bn_\be_\bw_\bd and _\bo_\bl_\bd_\bd are duplicate references to
+ an open file, read(2), write(2) and lseek(2) calls all move a single
+ pointer into the file, and append mode, non-blocking I/O and asynchronous
+ I/O options are shared between the references. If a separate pointer
+ into the file is desired, a different object reference to the file must
+ be obtained by issuing an additional open(2) call. The close-on-exec
+ flag on the new file descriptor is unset.
+
+ In d\bdu\bup\bp2\b2(), the value of the new descriptor _\bn_\be_\bw_\bd is specified. If this
+ descriptor is already in use, it is first deallocated as if a close(2)
+ call had been done first. When _\bn_\be_\bw_\bd equals _\bo_\bl_\bd_\bd, d\bdu\bup\bp2\b2() just returns
+ without affecting the close-on-exec flag.
+
+ In d\bdu\bup\bp3\b3(), both the value of the new descriptor and the close-on-exec
+ flag on the new file descriptor are specified: _\bn_\be_\bw_\bd specifies the value
+ and the O_CLOEXEC bit in _\bf_\bl_\ba_\bg_\bs specifies the close-on-exec flag. Unlike
+ d\bdu\bup\bp2\b2(), if _\bo_\bl_\bd_\bd and _\bn_\be_\bw_\bd are equal then d\bdu\bup\bp3\b3() fails. Otherwise, if
+ _\bf_\bl_\ba_\bg_\bs is zero then d\bdu\bup\bp3\b3() is identical to a call to d\bdu\bup\bp2\b2().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value of the new descriptor is returned.
+ The value -1 is returned if an error occurs in either call. The external
+ variable _\be_\br_\br_\bn_\bo indicates the cause of the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ d\bdu\bup\bp() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor.
+
+ [EMFILE] Too many descriptors are active.
+
+ d\bdu\bup\bp2\b2() and d\bdu\bup\bp3\b3() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor or _\bn_\be_\bw_\bd is
+ negative or greater than or equal to the process's
+ RLIMIT_NOFILE limit.
+
+ [EINTR] An interrupt was received.
+
+ [EIO] An I/O error occurred while writing to the file
+ system.
+
+ In addition, d\bdu\bup\bp3\b3() will return the following error:
+
+ [EINVAL] _\bo_\bl_\bd_\bd is equal to _\bn_\be_\bw_\bd or _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), close(2), fcntl(2), getrlimit(2), open(2), pipe(2), socket(2),
+ socketpair(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ d\bdu\bup\bp() and d\bdu\bup\bp2\b2() conform to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ d\bdu\bup\bp3\b3() function is expected to conform to a future revision of that
+ standard.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The d\bdu\bup\bp() system call first appeared in Version 3 AT&T UNIX, d\bdu\bup\bp2\b2() in
+ Version 7 AT&T UNIX, and d\bdu\bup\bp3\b3() in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ d\bdu\bup\bp, d\bdu\bup\bp2\b2, d\bdu\bup\bp3\b3 - duplicate an existing file descriptor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp(_\bi_\bn_\bt _\bo_\bl_\bd_\bd);
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp2\b2(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp3\b3(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ d\bdu\bup\bp() duplicates an existing object descriptor and returns its value to
+ the calling process (_\bn_\be_\bw_\bd = d\bdu\bup\bp(_\bo_\bl_\bd_\bd)). The argument _\bo_\bl_\bd_\bd is a small
+ non-negative integer index in the per-process descriptor table. The
+ value must be less than the size of the table, which is returned by
+ getdtablesize(3). The new descriptor returned by the call is the lowest
+ numbered descriptor currently not in use by the process.
+
+ The object referenced by the descriptor does not distinguish between _\bo_\bl_\bd_\bd
+ and _\bn_\be_\bw_\bd in any way. Thus if _\bn_\be_\bw_\bd and _\bo_\bl_\bd_\bd are duplicate references to
+ an open file, read(2), write(2) and lseek(2) calls all move a single
+ pointer into the file, and append mode, non-blocking I/O and asynchronous
+ I/O options are shared between the references. If a separate pointer
+ into the file is desired, a different object reference to the file must
+ be obtained by issuing an additional open(2) call. The close-on-exec
+ flag on the new file descriptor is unset.
+
+ In d\bdu\bup\bp2\b2(), the value of the new descriptor _\bn_\be_\bw_\bd is specified. If this
+ descriptor is already in use, it is first deallocated as if a close(2)
+ call had been done first. When _\bn_\be_\bw_\bd equals _\bo_\bl_\bd_\bd, d\bdu\bup\bp2\b2() just returns
+ without affecting the close-on-exec flag.
+
+ In d\bdu\bup\bp3\b3(), both the value of the new descriptor and the close-on-exec
+ flag on the new file descriptor are specified: _\bn_\be_\bw_\bd specifies the value
+ and the O_CLOEXEC bit in _\bf_\bl_\ba_\bg_\bs specifies the close-on-exec flag. Unlike
+ d\bdu\bup\bp2\b2(), if _\bo_\bl_\bd_\bd and _\bn_\be_\bw_\bd are equal then d\bdu\bup\bp3\b3() fails. Otherwise, if
+ _\bf_\bl_\ba_\bg_\bs is zero then d\bdu\bup\bp3\b3() is identical to a call to d\bdu\bup\bp2\b2().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value of the new descriptor is returned.
+ The value -1 is returned if an error occurs in either call. The external
+ variable _\be_\br_\br_\bn_\bo indicates the cause of the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ d\bdu\bup\bp() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor.
+
+ [EMFILE] Too many descriptors are active.
+
+ d\bdu\bup\bp2\b2() and d\bdu\bup\bp3\b3() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor or _\bn_\be_\bw_\bd is
+ negative or greater than or equal to the process's
+ RLIMIT_NOFILE limit.
+
+ [EINTR] An interrupt was received.
+
+ [EIO] An I/O error occurred while writing to the file
+ system.
+
+ In addition, d\bdu\bup\bp3\b3() will return the following error:
+
+ [EINVAL] _\bo_\bl_\bd_\bd is equal to _\bn_\be_\bw_\bd or _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), close(2), fcntl(2), getrlimit(2), open(2), pipe(2), socket(2),
+ socketpair(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ d\bdu\bup\bp() and d\bdu\bup\bp2\b2() conform to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ d\bdu\bup\bp3\b3() function is expected to conform to a future revision of that
+ standard.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The d\bdu\bup\bp() system call first appeared in Version 3 AT&T UNIX, d\bdu\bup\bp2\b2() in
+ Version 7 AT&T UNIX, and d\bdu\bup\bp3\b3() in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ d\bdu\bup\bp, d\bdu\bup\bp2\b2, d\bdu\bup\bp3\b3 - duplicate an existing file descriptor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp(_\bi_\bn_\bt _\bo_\bl_\bd_\bd);
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp2\b2(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ d\bdu\bup\bp3\b3(_\bi_\bn_\bt _\bo_\bl_\bd_\bd, _\bi_\bn_\bt _\bn_\be_\bw_\bd, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ d\bdu\bup\bp() duplicates an existing object descriptor and returns its value to
+ the calling process (_\bn_\be_\bw_\bd = d\bdu\bup\bp(_\bo_\bl_\bd_\bd)). The argument _\bo_\bl_\bd_\bd is a small
+ non-negative integer index in the per-process descriptor table. The
+ value must be less than the size of the table, which is returned by
+ getdtablesize(3). The new descriptor returned by the call is the lowest
+ numbered descriptor currently not in use by the process.
+
+ The object referenced by the descriptor does not distinguish between _\bo_\bl_\bd_\bd
+ and _\bn_\be_\bw_\bd in any way. Thus if _\bn_\be_\bw_\bd and _\bo_\bl_\bd_\bd are duplicate references to
+ an open file, read(2), write(2) and lseek(2) calls all move a single
+ pointer into the file, and append mode, non-blocking I/O and asynchronous
+ I/O options are shared between the references. If a separate pointer
+ into the file is desired, a different object reference to the file must
+ be obtained by issuing an additional open(2) call. The close-on-exec
+ flag on the new file descriptor is unset.
+
+ In d\bdu\bup\bp2\b2(), the value of the new descriptor _\bn_\be_\bw_\bd is specified. If this
+ descriptor is already in use, it is first deallocated as if a close(2)
+ call had been done first. When _\bn_\be_\bw_\bd equals _\bo_\bl_\bd_\bd, d\bdu\bup\bp2\b2() just returns
+ without affecting the close-on-exec flag.
+
+ In d\bdu\bup\bp3\b3(), both the value of the new descriptor and the close-on-exec
+ flag on the new file descriptor are specified: _\bn_\be_\bw_\bd specifies the value
+ and the O_CLOEXEC bit in _\bf_\bl_\ba_\bg_\bs specifies the close-on-exec flag. Unlike
+ d\bdu\bup\bp2\b2(), if _\bo_\bl_\bd_\bd and _\bn_\be_\bw_\bd are equal then d\bdu\bup\bp3\b3() fails. Otherwise, if
+ _\bf_\bl_\ba_\bg_\bs is zero then d\bdu\bup\bp3\b3() is identical to a call to d\bdu\bup\bp2\b2().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value of the new descriptor is returned.
+ The value -1 is returned if an error occurs in either call. The external
+ variable _\be_\br_\br_\bn_\bo indicates the cause of the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ d\bdu\bup\bp() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor.
+
+ [EMFILE] Too many descriptors are active.
+
+ d\bdu\bup\bp2\b2() and d\bdu\bup\bp3\b3() will fail if:
+
+ [EBADF] _\bo_\bl_\bd_\bd is not a valid active descriptor or _\bn_\be_\bw_\bd is
+ negative or greater than or equal to the process's
+ RLIMIT_NOFILE limit.
+
+ [EINTR] An interrupt was received.
+
+ [EIO] An I/O error occurred while writing to the file
+ system.
+
+ In addition, d\bdu\bup\bp3\b3() will return the following error:
+
+ [EINVAL] _\bo_\bl_\bd_\bd is equal to _\bn_\be_\bw_\bd or _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), close(2), fcntl(2), getrlimit(2), open(2), pipe(2), socket(2),
+ socketpair(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ d\bdu\bup\bp() and d\bdu\bup\bp2\b2() conform to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ d\bdu\bup\bp3\b3() function is expected to conform to a future revision of that
+ standard.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The d\bdu\bup\bp() system call first appeared in Version 3 AT&T UNIX, d\bdu\bup\bp2\b2() in
+ Version 7 AT&T UNIX, and d\bdu\bup\bp3\b3() in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ i\bin\bnt\btr\bro\bo - introduction to system calls and error numbers
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<e\ber\brr\brn\bno\bo.\b.h\bh>\b>
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The manual pages in section 2 provide an overview of the system calls,
+ their error returns, and other common definitions and concepts.
+
+D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
+ Nearly all of the system calls provide an error number via the identifier
+ errno, which expands to an addressable location of type _\bi_\bn_\bt. The address
+ of _\be_\br_\br_\bn_\bo in each thread is guaranteed to be unique for the lifetime of
+ the thread. Applications must use _\be_\br_\br_\bn_\bo as defined in <_\be_\br_\br_\bn_\bo_\b._\bh> and not
+ attempt to use a custom definition.
+
+ When a system call detects an error, it returns an integer value
+ indicating failure (usually -1) and sets the variable _\be_\br_\br_\bn_\bo accordingly.
+ (This allows interpretation of the failure on receiving a -1 and to take
+ action accordingly.) Successful calls never set _\be_\br_\br_\bn_\bo; once set, it
+ remains until another error occurs. It should only be examined after an
+ error. Note that a number of system calls overload the meanings of these
+ error numbers, and that the meanings must be interpreted according to the
+ type and circumstances of the call.
+
+ The following is a complete list of the errors and their names as given
+ in <_\bs_\by_\bs_\b/_\be_\br_\br_\bn_\bo_\b._\bh>.
+
+ 0 _\bU_\bn_\bd_\be_\bf_\bi_\bn_\be_\bd _\be_\br_\br_\bo_\br_\b: _\b0. Not used.
+
+ 1 EPERM _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bp_\be_\br_\bm_\bi_\bt_\bt_\be_\bd. An attempt was made to perform an
+ operation limited to processes with appropriate privileges or to
+ the owner of a file or other resources.
+
+ 2 ENOENT _\bN_\bo _\bs_\bu_\bc_\bh _\bf_\bi_\bl_\be _\bo_\br _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. A component of a specified pathname
+ did not exist, or the pathname was an empty string.
+
+ 3 ESRCH _\bN_\bo _\bs_\bu_\bc_\bh _\bp_\br_\bo_\bc_\be_\bs_\bs. No process could be found which corresponds to
+ the given process ID.
+
+ 4 EINTR _\bI_\bn_\bt_\be_\br_\br_\bu_\bp_\bt_\be_\bd _\bs_\by_\bs_\bt_\be_\bm _\bc_\ba_\bl_\bl. An asynchronous signal (such as SIGINT
+ or SIGQUIT) was caught by the thread during the execution of an
+ interruptible function. If the signal handler performs a normal
+ return, the interrupted function call will seem to have returned
+ the error condition.
+
+ 5 EIO _\bI_\bn_\bp_\bu_\bt_\b/_\bo_\bu_\bt_\bp_\bu_\bt _\be_\br_\br_\bo_\br. Some physical input or output error occurred.
+ This error will not be reported until a subsequent operation on
+ the same file descriptor and may be lost (overwritten) by any
+ subsequent errors.
+
+ 6 ENXIO _\bD_\be_\bv_\bi_\bc_\be _\bn_\bo_\bt _\bc_\bo_\bn_\bf_\bi_\bg_\bu_\br_\be_\bd. Input or output on a special file referred
+ to a device that did not exist, or made a request beyond the
+ limits of the device. This error may also occur when, for
+ example, a tape drive is not online or no disk pack is loaded on
+ a drive.
+
+ 7 E2BIG _\bA_\br_\bg_\bu_\bm_\be_\bn_\bt _\bl_\bi_\bs_\bt _\bt_\bo_\bo _\bl_\bo_\bn_\bg. The number of bytes used for the argument
+ and environment list of the new process exceeded the limit NCARGS
+ (specified in <_\bs_\by_\bs_\b/_\bp_\ba_\br_\ba_\bm_\b._\bh>).
+
+ 8 ENOEXEC _\bE_\bx_\be_\bc _\bf_\bo_\br_\bm_\ba_\bt _\be_\br_\br_\bo_\br. A request was made to execute a file that,
+ although it has the appropriate permissions, was not in the
+ format required for an executable file.
+
+ 9 EBADF _\bB_\ba_\bd _\bf_\bi_\bl_\be _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br. A file descriptor argument was out of range,
+ referred to no open file, or a read (write) request was made to a
+ file that was only open for writing (reading).
+
+ 10 ECHILD _\bN_\bo _\bc_\bh_\bi_\bl_\bd _\bp_\br_\bo_\bc_\be_\bs_\bs_\be_\bs. A wait(2) or waitpid(2) function was
+ executed by a process that had no existing or unwaited-for child
+ processes.
+
+ 11 EDEADLK _\bR_\be_\bs_\bo_\bu_\br_\bc_\be _\bd_\be_\ba_\bd_\bl_\bo_\bc_\bk _\ba_\bv_\bo_\bi_\bd_\be_\bd. An attempt was made to lock a
+ system resource that would have resulted in a deadlock situation.
+
+ 12 ENOMEM _\bC_\ba_\bn_\bn_\bo_\bt _\ba_\bl_\bl_\bo_\bc_\ba_\bt_\be _\bm_\be_\bm_\bo_\br_\by. The new process image required more
+ memory than was allowed by the hardware or by system-imposed
+ memory management constraints. A lack of swap space is normally
+ temporary; however, a lack of core is not. Soft limits may be
+ increased to their corresponding hard limits.
+
+ 13 EACCES _\bP_\be_\br_\bm_\bi_\bs_\bs_\bi_\bo_\bn _\bd_\be_\bn_\bi_\be_\bd. An attempt was made to access a file in a
+ way forbidden by its file access permissions.
+
+ 14 EFAULT _\bB_\ba_\bd _\ba_\bd_\bd_\br_\be_\bs_\bs. The system detected an invalid address in
+ attempting to use an argument of a call.
+
+ 15 ENOTBLK _\bB_\bl_\bo_\bc_\bk _\bd_\be_\bv_\bi_\bc_\be _\br_\be_\bq_\bu_\bi_\br_\be_\bd. A block device operation was attempted
+ on a non-block device or file.
+
+ 16 EBUSY _\bD_\be_\bv_\bi_\bc_\be _\bb_\bu_\bs_\by. An attempt to use a system resource which was in
+ use at the time in a manner which would have conflicted with the
+ request.
+
+ 17 EEXIST _\bF_\bi_\bl_\be _\be_\bx_\bi_\bs_\bt_\bs. An existing file was mentioned in an inappropriate
+ context, for instance, as the new link name in a link(2)
+ function.
+
+ 18 EXDEV _\bC_\br_\bo_\bs_\bs_\b-_\bd_\be_\bv_\bi_\bc_\be _\bl_\bi_\bn_\bk. A hard link to a file on another file system
+ was attempted.
+
+ 19 ENODEV _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd _\bb_\by _\bd_\be_\bv_\bi_\bc_\be. An attempt was made to apply
+ an inappropriate function to a device, for example, trying to
+ read a write-only device such as a printer.
+
+ 20 ENOTDIR _\bN_\bo_\bt _\ba _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. A component of the specified pathname
+ existed, but it was not a directory, when a directory was
+ expected.
+
+ 21 EISDIR _\bI_\bs _\ba _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. An attempt was made to open a directory with
+ write mode specified.
+
+ 22 EINVAL _\bI_\bn_\bv_\ba_\bl_\bi_\bd _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt. Some invalid argument was supplied. (For
+ example, specifying an undefined signal to a signal(3) or kill(2)
+ function).
+
+ 23 ENFILE _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bo_\bp_\be_\bn _\bf_\bi_\bl_\be_\bs _\bi_\bn _\bs_\by_\bs_\bt_\be_\bm. Maximum number of file
+ descriptors allowable on the system has been reached and a
+ request for an open cannot be satisfied until at least one has
+ been closed. The sysctl(3) variable _\bk_\be_\br_\bn_\b._\bm_\ba_\bx_\bf_\bi_\bl_\be_\bs contains the
+ current limit.
+
+ 24 EMFILE _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bo_\bp_\be_\bn _\bf_\bi_\bl_\be_\bs. The maximum number of file descriptors
+ allowable for this process has been reached and a request for an
+ open cannot be satisfied until at least one has been closed.
+ getdtablesize(3) will obtain the current limit.
+
+ 25 ENOTTY _\bI_\bn_\ba_\bp_\bp_\br_\bo_\bp_\br_\bi_\ba_\bt_\be _\bi_\bo_\bc_\bt_\bl _\bf_\bo_\br _\bd_\be_\bv_\bi_\bc_\be. A control function (see
+ ioctl(2)) was attempted for a file or special device for which
+ the operation was inappropriate.
+
+ 26 ETXTBSY _\bT_\be_\bx_\bt _\bf_\bi_\bl_\be _\bb_\bu_\bs_\by. An attempt was made either to execute a pure
+ procedure (shared text) file which was open for writing by
+ another process, or to open with write access a pure procedure
+ file that is currently being executed.
+
+ 27 EFBIG _\bF_\bi_\bl_\be _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be. The size of a file exceeded the maximum. (The
+ system-wide maximum file size is 2**63 bytes. Each file system
+ may impose a lower limit for files contained within it.)
+
+ 28 ENOSPC _\bN_\bo _\bs_\bp_\ba_\bc_\be _\bl_\be_\bf_\bt _\bo_\bn _\bd_\be_\bv_\bi_\bc_\be. A write(2) to an ordinary file, the
+ creation of a directory or symbolic link, or the creation of a
+ directory entry failed because no more disk blocks were available
+ on the file system, or the allocation of an inode for a newly
+ created file failed because no more inodes were available on the
+ file system.
+
+ 29 ESPIPE _\bI_\bl_\bl_\be_\bg_\ba_\bl _\bs_\be_\be_\bk. An lseek(2) function was issued on a socket, pipe
+ or FIFO.
+
+ 30 EROFS _\bR_\be_\ba_\bd_\b-_\bo_\bn_\bl_\by _\bf_\bi_\bl_\be _\bs_\by_\bs_\bt_\be_\bm. An attempt was made to modify a file or
+ create a directory on a file system that was read-only at the
+ time.
+
+ 31 EMLINK _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bl_\bi_\bn_\bk_\bs. The maximum allowable number of hard links to a
+ single file has been exceeded (see pathconf(2) for how to obtain
+ this value).
+
+ 32 EPIPE _\bB_\br_\bo_\bk_\be_\bn _\bp_\bi_\bp_\be. A write on a pipe, socket or FIFO for which there
+ is no process to read the data.
+
+ 33 EDOM _\bN_\bu_\bm_\be_\br_\bi_\bc_\ba_\bl _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt _\bo_\bu_\bt _\bo_\bf _\bd_\bo_\bm_\ba_\bi_\bn. A numerical input argument was
+ outside the defined domain of the mathematical function.
+
+ 34 ERANGE _\bR_\be_\bs_\bu_\bl_\bt _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be. A result of the function was too large to fit
+ in the available space (perhaps exceeded precision).
+
+ 35 EAGAIN _\bR_\be_\bs_\bo_\bu_\br_\bc_\be _\bt_\be_\bm_\bp_\bo_\br_\ba_\br_\bi_\bl_\by _\bu_\bn_\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. This is a temporary condition
+ and later calls to the same routine may complete normally.
+
+ 36 EINPROGRESS _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bw _\bi_\bn _\bp_\br_\bo_\bg_\br_\be_\bs_\bs. An operation that takes a long
+ time to complete (such as a connect(2)) was attempted on a non-
+ blocking object (see fcntl(2)).
+
+ 37 EALREADY _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\ba_\bl_\br_\be_\ba_\bd_\by _\bi_\bn _\bp_\br_\bo_\bg_\br_\be_\bs_\bs. An operation was attempted on
+ a non-blocking object that already had an operation in progress.
+
+ 38 ENOTSOCK _\bS_\bo_\bc_\bk_\be_\bt _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bo_\bn _\bn_\bo_\bn_\b-_\bs_\bo_\bc_\bk_\be_\bt. Self-explanatory.
+
+ 39 EDESTADDRREQ _\bD_\be_\bs_\bt_\bi_\bn_\ba_\bt_\bi_\bo_\bn _\ba_\bd_\bd_\br_\be_\bs_\bs _\br_\be_\bq_\bu_\bi_\br_\be_\bd. A required address was
+ omitted from an operation on a socket.
+
+ 40 EMSGSIZE _\bM_\be_\bs_\bs_\ba_\bg_\be _\bt_\bo_\bo _\bl_\bo_\bn_\bg. A message sent on a socket was larger than
+ the internal message buffer or some other network limit.
+
+ 41 EPROTOTYPE _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bw_\br_\bo_\bn_\bg _\bt_\by_\bp_\be _\bf_\bo_\br _\bs_\bo_\bc_\bk_\be_\bt. A protocol was specified
+ that does not support the semantics of the socket type requested.
+ For example, you cannot use the Internet UDP protocol with type
+ SOCK_STREAM.
+
+ 42 ENOPROTOOPT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bn_\bo_\bt _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. A bad option or level was
+ specified in a getsockopt(2) or setsockopt(2) call.
+
+ 43 EPROTONOSUPPORT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The protocol has not been
+ configured into the system or no implementation for it exists.
+
+ 44 ESOCKTNOSUPPORT _\bS_\bo_\bc_\bk_\be_\bt _\bt_\by_\bp_\be _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The support for the socket
+ type has not been configured into the system or no implementation
+ for it exists.
+
+ 45 EOPNOTSUPP _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The attempted operation is not
+ supported for the type of object referenced. Usually this occurs
+ when a file descriptor refers to a file or socket that cannot
+ support this operation, for example, trying to _\ba_\bc_\bc_\be_\bp_\bt a
+ connection on a datagram socket.
+
+ 46 EPFNOSUPPORT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bf_\ba_\bm_\bi_\bl_\by _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The protocol family has
+ not been configured into the system or no implementation for it
+ exists.
+
+ 47 EAFNOSUPPORT _\bA_\bd_\bd_\br_\be_\bs_\bs _\bf_\ba_\bm_\bi_\bl_\by _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd _\bb_\by _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bf_\ba_\bm_\bi_\bl_\by. An
+ address incompatible with the requested protocol was used. For
+ example, you shouldn't necessarily expect to be able to use NS
+ addresses with Internet protocols.
+
+ 48 EADDRINUSE _\bA_\bd_\bd_\br_\be_\bs_\bs _\ba_\bl_\br_\be_\ba_\bd_\by _\bi_\bn _\bu_\bs_\be. Only one usage of each address is
+ normally permitted.
+
+ 49 EADDRNOTAVAIL _\bC_\ba_\bn_\b'_\bt _\ba_\bs_\bs_\bi_\bg_\bn _\br_\be_\bq_\bu_\be_\bs_\bt_\be_\bd _\ba_\bd_\bd_\br_\be_\bs_\bs. Normally results from an
+ attempt to create a socket with an address not on this machine.
+
+ 50 ENETDOWN _\bN_\be_\bt_\bw_\bo_\br_\bk _\bi_\bs _\bd_\bo_\bw_\bn. A socket operation encountered a dead
+ network.
+
+ 51 ENETUNREACH _\bN_\be_\bt_\bw_\bo_\br_\bk _\bi_\bs _\bu_\bn_\br_\be_\ba_\bc_\bh_\ba_\bb_\bl_\be. A socket operation was attempted
+ to an unreachable network.
+
+ 52 ENETRESET _\bN_\be_\bt_\bw_\bo_\br_\bk _\bd_\br_\bo_\bp_\bp_\be_\bd _\bc_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\bo_\bn _\br_\be_\bs_\be_\bt. The host you were
+ connected to crashed and rebooted.
+
+ 53 ECONNABORTED _\bS_\bo_\bf_\bt_\bw_\ba_\br_\be _\bc_\ba_\bu_\bs_\be_\bd _\bc_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\ba_\bb_\bo_\br_\bt. A connection abort was
+ caused internal to your host machine.
+
+ 54 ECONNRESET _\bC_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\br_\be_\bs_\be_\bt _\bb_\by _\bp_\be_\be_\br. A connection was forcibly closed
+ by a peer. This normally results from a loss of the connection
+ on the remote socket due to a timeout or a reboot.
+
+ 55 ENOBUFS _\bN_\bo _\bb_\bu_\bf_\bf_\be_\br _\bs_\bp_\ba_\bc_\be _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. An operation on a socket or pipe
+ was not performed because the system lacked sufficient buffer
+ space or because a queue was full.
+
+ 56 EISCONN _\bS_\bo_\bc_\bk_\be_\bt _\bi_\bs _\ba_\bl_\br_\be_\ba_\bd_\by _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd. A connect(2) request was made on
+ an already connected socket; or, a sendto(2) or sendmsg(2)
+ request on a connected socket specified a destination when
+ already connected.
+
+ 57 ENOTCONN _\bS_\bo_\bc_\bk_\be_\bt _\bi_\bs _\bn_\bo_\bt _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd. A request to send or receive data
+ was disallowed because the socket was not connected and (when
+ sending on a datagram socket) no address was supplied.
+
+ 58 ESHUTDOWN _\bC_\ba_\bn_\b'_\bt _\bs_\be_\bn_\bd _\ba_\bf_\bt_\be_\br _\bs_\bo_\bc_\bk_\be_\bt _\bs_\bh_\bu_\bt_\bd_\bo_\bw_\bn. A request to send data was
+ disallowed because the socket had already been shut down with a
+ previous shutdown(2) call.
+
+ 59 ETOOMANYREFS _\bT_\bo_\bo _\bm_\ba_\bn_\by _\br_\be_\bf_\be_\br_\be_\bn_\bc_\be_\bs_\b: _\bc_\ba_\bn_\b'_\bt _\bs_\bp_\bl_\bi_\bc_\be. Not used in OpenBSD.
+
+ 60 ETIMEDOUT _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bt_\bi_\bm_\be_\bd _\bo_\bu_\bt. A connect(2) or send(2) request failed
+ because the connected party did not properly respond after a
+ period of time. (The timeout period is dependent on the
+ communication protocol.)
+
+ 61 ECONNREFUSED _\bC_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\br_\be_\bf_\bu_\bs_\be_\bd. No connection could be made because
+ the target machine actively refused it. This usually results
+ from trying to connect to a service that is inactive on the
+ foreign host.
+
+ 62 ELOOP _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bl_\be_\bv_\be_\bl_\bs _\bo_\bf _\bs_\by_\bm_\bb_\bo_\bl_\bi_\bc _\bl_\bi_\bn_\bk_\bs. A path name lookup involved
+ more than 32 (SYMLOOP_MAX) symbolic links.
+
+ 63 ENAMETOOLONG _\bF_\bi_\bl_\be _\bn_\ba_\bm_\be _\bt_\bo_\bo _\bl_\bo_\bn_\bg. A component of a pathname exceeded
+ 255 (NAME_MAX) characters, or an entire pathname (including the
+ terminating NUL) exceeded 1024 (PATH_MAX) bytes.
+
+ 64 EHOSTDOWN _\bH_\bo_\bs_\bt _\bi_\bs _\bd_\bo_\bw_\bn. A socket operation failed because the
+ destination host was down.
+
+ 65 EHOSTUNREACH _\bN_\bo _\br_\bo_\bu_\bt_\be _\bt_\bo _\bh_\bo_\bs_\bt. A socket operation was attempted to an
+ unreachable host.
+
+ 66 ENOTEMPTY _\bD_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bn_\bo_\bt _\be_\bm_\bp_\bt_\by. A directory with entries other than `.'
+ and `..' was supplied to a remove directory or rename call.
+
+ 67 EPROCLIM _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bp_\br_\bo_\bc_\be_\bs_\bs_\be_\bs.
+
+ 68 EUSERS _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bu_\bs_\be_\br_\bs. The quota system ran out of table entries.
+
+ 69 EDQUOT _\bD_\bi_\bs_\bc _\bq_\bu_\bo_\bt_\ba _\be_\bx_\bc_\be_\be_\bd_\be_\bd. A write(2) to an ordinary file, the
+ creation of a directory or symbolic link, or the creation of a
+ directory entry failed because the user's quota of disk blocks
+ was exhausted, or the allocation of an inode for a newly created
+ file failed because the user's quota of inodes was exhausted.
+
+ 70 ESTALE _\bS_\bt_\ba_\bl_\be _\bN_\bF_\bS _\bf_\bi_\bl_\be _\bh_\ba_\bn_\bd_\bl_\be. An attempt was made to access an open
+ file on an NFS filesystem which is now unavailable as referenced
+ by the file descriptor. This may indicate the file was deleted
+ on the NFS server or some other catastrophic event occurred.
+
+ 72 EBADRPC _\bR_\bP_\bC _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bs _\bb_\ba_\bd. Exchange of rpc(3) information was
+ unsuccessful.
+
+ 73 ERPCMISMATCH _\bR_\bP_\bC _\bv_\be_\br_\bs_\bi_\bo_\bn _\bw_\br_\bo_\bn_\bg. The version of rpc(3) on the remote
+ peer is not compatible with the local version.
+
+ 74 EPROGUNAVAIL _\bR_\bP_\bC _\bp_\br_\bo_\bg_\b. _\bn_\bo_\bt _\ba_\bv_\ba_\bi_\bl. The requested rpc(3) program is not
+ registered on the remote host.
+
+ 75 EPROGMISMATCH _\bP_\br_\bo_\bg_\br_\ba_\bm _\bv_\be_\br_\bs_\bi_\bo_\bn _\bw_\br_\bo_\bn_\bg. The requested version of the
+ rpc(3) program is not available on the remote host.
+
+ 76 EPROCUNAVAIL _\bB_\ba_\bd _\bp_\br_\bo_\bc_\be_\bd_\bu_\br_\be _\bf_\bo_\br _\bp_\br_\bo_\bg_\br_\ba_\bm. An rpc(3) call was attempted
+ for a procedure which doesn't exist in the remote program.
+
+ 77 ENOLCK _\bN_\bo _\bl_\bo_\bc_\bk_\bs _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. A system-imposed limit on the number of
+ simultaneous file locks was reached.
+
+ 78 ENOSYS _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd. Attempted a system call that is not
+ available on this system.
+
+ 79 EFTYPE _\bI_\bn_\ba_\bp_\bp_\br_\bo_\bp_\br_\bi_\ba_\bt_\be _\bf_\bi_\bl_\be _\bt_\by_\bp_\be _\bo_\br _\bf_\bo_\br_\bm_\ba_\bt. The file contains invalid
+ data or set to invalid modes.
+
+ 80 EAUTH _\bA_\bu_\bt_\bh_\be_\bn_\bt_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\be_\br_\br_\bo_\br. Attempted to use an invalid authentication
+ ticket to mount a NFS filesystem.
+
+ 81 ENEEDAUTH _\bN_\be_\be_\bd _\ba_\bu_\bt_\bh_\be_\bn_\bt_\bi_\bc_\ba_\bt_\bo_\br. An authentication ticket must be
+ obtained before the given NFS filesystem may be mounted.
+
+ 82 EIPSEC _\bI_\bP_\bs_\be_\bc _\bp_\br_\bo_\bc_\be_\bs_\bs_\bi_\bn_\bg _\bf_\ba_\bi_\bl_\bu_\br_\be. IPsec subsystem error. Not used in
+ OpenBSD.
+
+ 83 ENOATTR _\bA_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be _\bn_\bo_\bt _\bf_\bo_\bu_\bn_\bd. A UFS Extended Attribute is not found for
+ the specified pathname.
+
+ 84 EILSEQ _\bI_\bl_\bl_\be_\bg_\ba_\bl _\bb_\by_\bt_\be _\bs_\be_\bq_\bu_\be_\bn_\bc_\be. An illegal sequence of bytes was used
+ when using wide characters.
+
+ 85 ENOMEDIUM _\bN_\bo _\bm_\be_\bd_\bi_\bu_\bm _\bf_\bo_\bu_\bn_\bd. Attempted to use a removable media device
+ with no medium present.
+
+ 86 EMEDIUMTYPE _\bW_\br_\bo_\bn_\bg _\bm_\be_\bd_\bi_\bu_\bm _\bt_\by_\bp_\be. Attempted to use a removable media
+ device with incorrect or incompatible medium.
+
+ 87 EOVERFLOW _\bV_\ba_\bl_\bu_\be _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be _\bt_\bo _\bb_\be _\bs_\bt_\bo_\br_\be_\bd _\bi_\bn _\bd_\ba_\bt_\ba _\bt_\by_\bp_\be. A numerical
+ result of the function was too large to be stored in the caller
+ provided space.
+
+ 88 ECANCELED _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bc_\ba_\bn_\bc_\be_\bl_\be_\bd. The requested operation was canceled.
+
+ 89 EIDRM _\bI_\bd_\be_\bn_\bt_\bi_\bf_\bi_\be_\br _\br_\be_\bm_\bo_\bv_\be_\bd. An IPC identifier was removed while the
+ current thread was waiting on it.
+
+ 90 ENOMSG _\bN_\bo _\bm_\be_\bs_\bs_\ba_\bg_\be _\bo_\bf _\bd_\be_\bs_\bi_\br_\be_\bd _\bt_\by_\bp_\be. An IPC message queue does not
+ contain a message of the desired type, or a message catalog does
+ not contain the requested message.
+
+ 91 ENOTSUP _\bN_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The operation has requested an unsupported
+ value.
+
+D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS
+ Process
+ A process is a collection of one or more threads, plus the
+ resources shared by those threads such as process ID, address
+ space, user IDs and group IDs, and root directory and current
+ working directory.
+
+ Process ID
+ Each active process in the system is uniquely identified by a
+ non-negative integer called a process ID. The range of this ID
+ is from 1 to 32766.
+
+ Parent Process ID
+ A new process is created by a currently active process; (see
+ fork(2)). The parent process ID of a process is initially the
+ process ID of its creator. If the creating process exits, the
+ parent process ID of each child is set to the ID of a system
+ process, init(8).
+
+ Process Group
+ Each active process is a member of a process group that is
+ identified by a non-negative integer called the process group ID.
+ This is the process ID of the group leader. This grouping
+ permits the signaling of related processes (see termios(4)) and
+ the job control mechanisms of csh(1).
+
+ Session
+ A session is a set of one or more process groups. A session is
+ created by a successful call to setsid(2), which causes the
+ caller to become the only member of the only process group in the
+ new session.
+
+ Session Leader
+ A process that has created a new session by a successful call to
+ setsid(2), is known as a session leader. Only a session leader
+ may acquire a terminal as its controlling terminal (see
+ termios(4)).
+
+ Controlling Process
+ A session leader with a controlling terminal is a controlling
+ process.
+
+ Controlling Terminal
+ A terminal that is associated with a session is known as the
+ controlling terminal for that session and its members.
+
+ Terminal Process Group ID
+ A terminal may be acquired by a session leader as its controlling
+ terminal. Once a terminal is associated with a session, any of
+ the process groups within the session may be placed into the
+ foreground by setting the terminal process group ID to the ID of
+ the process group. This facility is used to arbitrate between
+ multiple jobs contending for the same terminal; (see csh(1) and
+ tty(4)).
+
+ Orphaned Process Group
+ A process group is considered to be _\bo_\br_\bp_\bh_\ba_\bn_\be_\bd if it is not under
+ the control of a job control shell. More precisely, a process
+ group is orphaned when none of its members has a parent process
+ that is in the same session as the group, but is in a different
+ process group. Note that when a process exits, the parent
+ process for its children is changed to be init(8), which is in a
+ separate session. Not all members of an orphaned process group
+ are necessarily orphaned processes (those whose creating process
+ has exited). The process group of a session leader is orphaned
+ by definition.
+
+ Thread A thread is a preemptively scheduled flow of control within a
+ process, with its own set of register values, floating point
+ environment, thread ID, signal mask, pending signal set,
+ alternate signal stack, thread control block address, resource
+ utilization, errno variable location, and values for thread-
+ specific keys. A process initially has just one thread, a
+ duplicate of the thread in the parent process that created this
+ process.
+
+ Real User ID and Real Group ID
+ Each user on the system is identified by a positive integer
+ termed the real user ID.
+
+ Each user is also a member of one or more groups. One of these
+ groups is distinguished from others and used in implementing
+ accounting facilities. The positive integer corresponding to
+ this distinguished group is termed the real group ID.
+
+ All processes have a real user ID and real group ID. These are
+ initialized from the equivalent attributes of the process that
+ created it.
+
+ Effective User ID, Effective Group ID, and Group Access List
+ Access to system resources is governed by two values: the
+ effective user ID, and the group access list. The first member
+ of the group access list is also known as the effective group ID.
+ (In POSIX.1, the group access list is known as the set of
+ supplementary group IDs, and it is unspecified whether the
+ effective group ID is a member of the list.)
+
+ The effective user ID and effective group ID are initially the
+ process's real user ID and real group ID respectively. Either
+ may be modified through execution of a set-user-ID or set-group-
+ ID file (possibly by one of its ancestors) (see execve(2)). By
+ convention, the effective group ID (the first member of the group
+ access list) is duplicated, so that the execution of a set-group-
+ ID program does not result in the loss of the original (real)
+ group ID.
+
+ The group access list is a set of group IDs used only in
+ determining resource accessibility. Access checks are performed
+ as described below in ``File Access Permissions''.
+
+ Saved Set User ID and Saved Set Group ID
+ When a process executes a new file, the effective user ID is set
+ to the owner of the file if the file is set-user-ID, and the
+ effective group ID (first element of the group access list) is
+ set to the group of the file if the file is set-group-ID. The
+ effective user ID of the process is then recorded as the saved
+ set-user-ID, and the effective group ID of the process is
+ recorded as the saved set-group-ID. These values may be used to
+ regain those values as the effective user or group ID after
+ reverting to the real ID (see setuid(2)). (In POSIX.1, the saved
+ set-user-ID and saved set-group-ID are optional, and are used in
+ setuid and setgid, but this does not work as desired for the
+ superuser.)
+
+ Superuser
+ A process is recognized as a _\bs_\bu_\bp_\be_\br_\bu_\bs_\be_\br process and is granted
+ special privileges if its effective user ID is 0.
+
+ Special Processes
+ The processes with process IDs of 0 and 1 are special. Process 0
+ is the scheduler. Process 1 is the initialization process
+ init(8), and is the ancestor of every other process in the
+ system. It is used to control the process structure.
+
+ Descriptor
+ An integer assigned by the system when a file is referenced by
+ open(2) or dup(2), or when a socket is created by pipe(2),
+ socket(2) or socketpair(2), which uniquely identifies an access
+ path to that file or socket from a given process or any of its
+ children.
+
+ File Name
+ Names consisting of up to 255 (NAME_MAX) characters may be used
+ to name an ordinary file, special file, or directory.
+
+ These characters may be arbitrary eight-bit values, excluding 0
+ (NUL) and the ASCII code for `/' (slash).
+
+ Note that it is generally unwise to use `*', `?', `[' or `]' as
+ part of file names because of the special meaning attached to
+ these characters by the shell.
+
+ Note also that NAME_MAX is an upper limit fixed by the kernel,
+ meant to be used for sizing buffers. Some filesystems may have
+ additional restrictions. These can be queried using pathconf(2)
+ and fpathconf(2).
+
+ Path Name
+ A path name is a NUL-terminated character string starting with an
+ optional slash `/', followed by zero or more directory names
+ separated by slashes, optionally followed by a file name. The
+ total length of a path name must be less than 1024 (PATH_MAX)
+ characters. Additional restrictions may apply, depending upon
+ the filesystem, to be queried with pathconf(2) or fpathconf(2) if
+ needed.
+
+ If a path name begins with a slash, the path search begins at the
+ _\br_\bo_\bo_\bt directory. Otherwise, the search begins from the current
+ working directory. A slash by itself names the root directory.
+ An empty pathname is invalid.
+
+ Directory
+ A directory is a special type of file that contains entries that
+ are references to other files. Directory entries are called
+ links. By convention, a directory contains at least two links,
+ `.' and `..', referred to as _\bd_\bo_\bt and _\bd_\bo_\bt_\b-_\bd_\bo_\bt respectively. Dot
+ refers to the directory itself and dot-dot refers to its parent
+ directory.
+
+ Root Directory and Current Working Directory
+ Each process has associated with it a concept of a root directory
+ and a current working directory for the purpose of resolving path
+ name searches. A process's root directory need not be the root
+ directory of the root file system.
+
+ File Access Permissions
+ Every file in the file system has a set of access permissions.
+ These permissions are used in determining whether a process may
+ perform a requested operation on the file (such as opening a file
+ for writing). Access permissions are established at the time a
+ file is created. They may be changed at some later time through
+ the chmod(2) call.
+
+ File access is broken down according to whether a file may be:
+ read, written, or executed. Directory files use the execute
+ permission to control if the directory may be searched.
+
+ File access permissions are interpreted by the system as they
+ apply to three different classes of users: the owner of the file,
+ those users in the file's group, anyone else. Every file has an
+ independent set of access permissions for each of these classes.
+ When an access check is made, the system decides if permission
+ should be granted by checking the access information applicable
+ to the caller.
+
+ Read, write, and execute/search permissions on a file are granted
+ to a process if:
+
+ The process's effective user ID is that of the superuser. (Note:
+ even the superuser cannot execute a non-executable file.)
+
+ The process's effective user ID matches the user ID of the owner
+ of the file and the owner permissions allow the access.
+
+ The process's effective user ID does not match the user ID of the
+ owner of the file, and either the process's effective group ID
+ matches the group ID of the file, or the group ID of the file is
+ in the process's group access list, and the group permissions
+ allow the access.
+
+ Neither the effective user ID nor effective group ID and group
+ access list of the process match the corresponding user ID and
+ group ID of the file, but the permissions for ``other users''
+ allow access.
+
+ Otherwise, permission is denied.
+
+ Sockets and Address Families
+ A socket is an endpoint for communication between processes.
+ Each socket has queues for sending and receiving data.
+
+ Sockets are typed according to their communications properties.
+ These properties include whether messages sent and received at a
+ socket require the name of the partner, whether communication is
+ reliable, the format used in naming message recipients, etc.
+
+ Each instance of the system supports some collection of socket
+ types; consult socket(2) for more information about the types
+ available and their properties.
+
+ Each instance of the system supports some number of sets of
+ communications protocols. Each protocol set supports addresses
+ of a certain format. An Address Family is the set of addresses
+ for a specific group of protocols. Each socket has an address
+ chosen from the address family in which the socket was created.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ intro(3), perror(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An k\bkq\bqu\bue\beu\bue\be manual page appeared in Version 6 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ e\bex\bxe\bec\bcv\bve\be, e\bex\bxe\bec\bct\bt - execute a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ e\bex\bxe\bec\bcv\bve\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\ba_\br_\bg_\bv_\b[_\b], _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\be_\bn_\bv_\bp_\b[_\b]);
+
+ _\bi_\bn_\bt
+ e\bex\bxe\bec\bct\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\ba_\br_\bg_\bv_\b[_\b], _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\be_\bn_\bv_\bp_\b[_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ e\bex\bxe\bec\bcv\bve\be() transforms the calling process into a new process. The new
+ process is constructed from an ordinary file, whose name is pointed to by
+ _\bp_\ba_\bt_\bh, called the _\bn_\be_\bw _\bp_\br_\bo_\bc_\be_\bs_\bs _\bf_\bi_\bl_\be. This file is either an executable
+ object file, or a file of data for an interpreter. An executable object
+ file consists of an identifying header, followed by pages of data
+ representing the initial program (text) and initialized data pages.
+ Additional pages may be specified by the header to be initialized with
+ zero data; see elf(5).
+
+ An interpreter file begins with a line of the form:
+
+ #\b#!\b! _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br [_\ba_\br_\bg]
+
+ When an interpreter file is passed to e\bex\bxe\bec\bcv\bve\be() the system instead calls
+ e\bex\bxe\bec\bcv\bve\be() with the specified _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br. If the optional _\ba_\br_\bg is
+ specified, it becomes the first argument to the _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br, and the
+ original _\bp_\ba_\bt_\bh becomes the second argument; otherwise, _\bp_\ba_\bt_\bh becomes the
+ first argument. The original arguments are shifted over to become the
+ subsequent arguments. The zeroth argument, normally the name of the file
+ being executed, is left unchanged.
+
+ The argument _\ba_\br_\bg_\bv is a pointer to a null-terminated array of character
+ pointers to NUL-terminated character strings. These strings construct
+ the argument list to be made available to the new process. At least one
+ non-null argument must be present in the array; by custom, the first
+ element should be the name of the executed program (for example, the last
+ component of _\bp_\ba_\bt_\bh).
+
+ The argument _\be_\bn_\bv_\bp is also a pointer to a null-terminated array of
+ character pointers to NUL-terminated strings. A pointer to this array is
+ normally stored in the global variable _\be_\bn_\bv_\bi_\br_\bo_\bn. These strings pass
+ information to the new process that is not directly an argument to the
+ command (see environ(7)).
+
+ File descriptors open in the calling process image remain open in the new
+ process image, except for those for which the close-on-exec flag is set
+ (see close(2) and fcntl(2)). Descriptors that remain open are unaffected
+ by e\bex\bxe\bec\bcv\bve\be(). In the case of a new setuid or setgid executable being
+ executed, if file descriptors 0, 1, or 2 (representing stdin, stdout, and
+ stderr) are currently unallocated, these descriptors will be opened to
+ point to some system file like _\b/_\bd_\be_\bv_\b/_\bn_\bu_\bl_\bl. The intent is to ensure these
+ descriptors are not unallocated, since many libraries make assumptions
+ about the use of these 3 file descriptors.
+
+ Signals set to be ignored in the calling process are set to be ignored in
+ the new process. Signals which are set to be caught in the calling
+ process image are set to default action in the new process image.
+ Blocked signals remain blocked regardless of changes to the signal
+ action. The signal stack is reset to be undefined (see sigaction(2) for
+ more information).
+
+ If the set-user-ID mode bit of the new process image file is set (see
+ chmod(2)), the effective user ID of the new process image is set to the
+ owner ID of the new process image file. If the set-group-ID mode bit of
+ the new process image file is set, the effective group ID of the new
+ process image is set to the group ID of the new process image file. (The
+ effective group ID is the first element of the group list.) The real
+ user ID, real group ID and other group IDs of the new process image
+ remain the same as the calling process image. After any set-user-ID and
+ set-group-ID processing, the effective user ID is recorded as the saved
+ set-user-ID, and the effective group ID is recorded as the saved set-
+ group-ID. These values may be used in changing the effective IDs later
+ (see setuid(2)). The set-user-ID and set-group-ID bits have no effect if
+ the new process image file is located on a file system mounted with the
+ nosuid flag. The process will be started without the new permissions.
+
+ The new process also inherits the following attributes from the calling
+ process:
+
+ process ID see getpid(2)
+ parent process ID see getppid(2)
+ process group ID see getpgrp(2)
+ session ID see getsid(2)
+ access groups see getgroups(2)
+ working directory see chdir(2)
+ root directory see chroot(2)
+ control terminal see termios(4)
+ resource usages see getrusage(2)
+ interval timers see getitimer(2) (unless process image file is
+ setuid or setgid, in which case all timers are
+ disabled)
+ resource limits see getrlimit(2)
+ file mode mask see umask(2)
+ signal mask see sigaction(2), sigsetmask(3)
+
+ When a program is executed as a result of an e\bex\bxe\bec\bcv\bve\be() call, it is entered
+ as follows:
+
+ main(int argc, char **argv, char **envp)
+
+ where _\ba_\br_\bg_\bc is the number of elements in _\ba_\br_\bg_\bv (the ``arg count'') and _\ba_\br_\bg_\bv
+ points to the array of character pointers to the arguments themselves.
+
+ The e\bex\bxe\bec\bct\bt() function is equivalent to e\bex\bxe\bec\bcv\bve\be() with the additional
+ property that it executes the file with the process tracing facilities
+ enabled (see ptrace(2)).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ As the e\bex\bxe\bec\bcv\bve\be() function overlays the current process image with a new
+ process image the successful call has no process to return to. If
+ e\bex\bxe\bec\bcv\bve\be() does return to the calling process an error has occurred; the
+ return value will be -1 and the global variable _\be_\br_\br_\bn_\bo is set to indicate
+ the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ e\bex\bxe\bec\bcv\bve\be() will fail and return to the calling process if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The new process file does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The new process file is not an ordinary file.
+
+ [EACCES] The new process file mode denies execute permission.
+
+ [EACCES] The new process file is on a filesystem mounted with
+ execution disabled (MNT_NOEXEC in <_\bs_\by_\bs_\b/_\bm_\bo_\bu_\bn_\bt_\b._\bh>).
+
+ [ENOEXEC] The new process file has the appropriate access
+ permission, but has an invalid magic number in its
+ header.
+
+ [ETXTBSY] The new process file is a pure procedure (shared text)
+ file that is currently open for writing or reading by
+ some process.
+
+ [ENOMEM] The new process requires more virtual memory than is
+ allowed by the imposed maximum (getrlimit(2)).
+
+ [E2BIG] The number of bytes in the new process's argument list
+ is larger than the system-imposed limit. The limit in
+ the system as released is 262144 bytes (NCARGS in
+ <_\bs_\by_\bs_\b/_\bp_\ba_\br_\ba_\bm_\b._\bh>).
+
+ [EFAULT] The new process file is not as long as indicated by
+ the size values in its header.
+
+ [EFAULT] _\bp_\ba_\bt_\bh, _\ba_\br_\bg_\bv, or _\be_\bn_\bv_\bp point to an illegal address.
+
+ [EINVAL] _\ba_\br_\bg_\bv did not contain at least one element.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [ENFILE] During startup of an _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br, the system file
+ table was found to be full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), fork(2), execl(3), exit(3), elf(5), environ(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The e\bex\bxe\bec\bcv\bve\be() function is expected to conform to IEEE Std 1003.1-2008
+ (``POSIX.1''). The e\bex\bxe\bec\bct\bt() function should not be used in portable
+ applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former e\bex\bxe\bec\bc() system call, first
+ appeared in Version 1 AT&T UNIX. The e\bex\bxe\bec\bcv\bve\be() function first appeared in
+ Version 7 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ If a program is _\bs_\be_\bt_\bu_\bi_\bd to a non-superuser, but is executed when the real
+ _\bu_\bi_\bd is ``root'', then the process has some of the powers of a superuser
+ as well.
+
+N\bNA\bAM\bME\bE
+ e\bex\bxe\bec\bcv\bve\be, e\bex\bxe\bec\bct\bt - execute a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ e\bex\bxe\bec\bcv\bve\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\ba_\br_\bg_\bv_\b[_\b], _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\be_\bn_\bv_\bp_\b[_\b]);
+
+ _\bi_\bn_\bt
+ e\bex\bxe\bec\bct\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\ba_\br_\bg_\bv_\b[_\b], _\bc_\bh_\ba_\br _\b*_\bc_\bo_\bn_\bs_\bt _\be_\bn_\bv_\bp_\b[_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ e\bex\bxe\bec\bcv\bve\be() transforms the calling process into a new process. The new
+ process is constructed from an ordinary file, whose name is pointed to by
+ _\bp_\ba_\bt_\bh, called the _\bn_\be_\bw _\bp_\br_\bo_\bc_\be_\bs_\bs _\bf_\bi_\bl_\be. This file is either an executable
+ object file, or a file of data for an interpreter. An executable object
+ file consists of an identifying header, followed by pages of data
+ representing the initial program (text) and initialized data pages.
+ Additional pages may be specified by the header to be initialized with
+ zero data; see elf(5).
+
+ An interpreter file begins with a line of the form:
+
+ #\b#!\b! _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br [_\ba_\br_\bg]
+
+ When an interpreter file is passed to e\bex\bxe\bec\bcv\bve\be() the system instead calls
+ e\bex\bxe\bec\bcv\bve\be() with the specified _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br. If the optional _\ba_\br_\bg is
+ specified, it becomes the first argument to the _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br, and the
+ original _\bp_\ba_\bt_\bh becomes the second argument; otherwise, _\bp_\ba_\bt_\bh becomes the
+ first argument. The original arguments are shifted over to become the
+ subsequent arguments. The zeroth argument, normally the name of the file
+ being executed, is left unchanged.
+
+ The argument _\ba_\br_\bg_\bv is a pointer to a null-terminated array of character
+ pointers to NUL-terminated character strings. These strings construct
+ the argument list to be made available to the new process. At least one
+ non-null argument must be present in the array; by custom, the first
+ element should be the name of the executed program (for example, the last
+ component of _\bp_\ba_\bt_\bh).
+
+ The argument _\be_\bn_\bv_\bp is also a pointer to a null-terminated array of
+ character pointers to NUL-terminated strings. A pointer to this array is
+ normally stored in the global variable _\be_\bn_\bv_\bi_\br_\bo_\bn. These strings pass
+ information to the new process that is not directly an argument to the
+ command (see environ(7)).
+
+ File descriptors open in the calling process image remain open in the new
+ process image, except for those for which the close-on-exec flag is set
+ (see close(2) and fcntl(2)). Descriptors that remain open are unaffected
+ by e\bex\bxe\bec\bcv\bve\be(). In the case of a new setuid or setgid executable being
+ executed, if file descriptors 0, 1, or 2 (representing stdin, stdout, and
+ stderr) are currently unallocated, these descriptors will be opened to
+ point to some system file like _\b/_\bd_\be_\bv_\b/_\bn_\bu_\bl_\bl. The intent is to ensure these
+ descriptors are not unallocated, since many libraries make assumptions
+ about the use of these 3 file descriptors.
+
+ Signals set to be ignored in the calling process are set to be ignored in
+ the new process. Signals which are set to be caught in the calling
+ process image are set to default action in the new process image.
+ Blocked signals remain blocked regardless of changes to the signal
+ action. The signal stack is reset to be undefined (see sigaction(2) for
+ more information).
+
+ If the set-user-ID mode bit of the new process image file is set (see
+ chmod(2)), the effective user ID of the new process image is set to the
+ owner ID of the new process image file. If the set-group-ID mode bit of
+ the new process image file is set, the effective group ID of the new
+ process image is set to the group ID of the new process image file. (The
+ effective group ID is the first element of the group list.) The real
+ user ID, real group ID and other group IDs of the new process image
+ remain the same as the calling process image. After any set-user-ID and
+ set-group-ID processing, the effective user ID is recorded as the saved
+ set-user-ID, and the effective group ID is recorded as the saved set-
+ group-ID. These values may be used in changing the effective IDs later
+ (see setuid(2)). The set-user-ID and set-group-ID bits have no effect if
+ the new process image file is located on a file system mounted with the
+ nosuid flag. The process will be started without the new permissions.
+
+ The new process also inherits the following attributes from the calling
+ process:
+
+ process ID see getpid(2)
+ parent process ID see getppid(2)
+ process group ID see getpgrp(2)
+ session ID see getsid(2)
+ access groups see getgroups(2)
+ working directory see chdir(2)
+ root directory see chroot(2)
+ control terminal see termios(4)
+ resource usages see getrusage(2)
+ interval timers see getitimer(2) (unless process image file is
+ setuid or setgid, in which case all timers are
+ disabled)
+ resource limits see getrlimit(2)
+ file mode mask see umask(2)
+ signal mask see sigaction(2), sigsetmask(3)
+
+ When a program is executed as a result of an e\bex\bxe\bec\bcv\bve\be() call, it is entered
+ as follows:
+
+ main(int argc, char **argv, char **envp)
+
+ where _\ba_\br_\bg_\bc is the number of elements in _\ba_\br_\bg_\bv (the ``arg count'') and _\ba_\br_\bg_\bv
+ points to the array of character pointers to the arguments themselves.
+
+ The e\bex\bxe\bec\bct\bt() function is equivalent to e\bex\bxe\bec\bcv\bve\be() with the additional
+ property that it executes the file with the process tracing facilities
+ enabled (see ptrace(2)).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ As the e\bex\bxe\bec\bcv\bve\be() function overlays the current process image with a new
+ process image the successful call has no process to return to. If
+ e\bex\bxe\bec\bcv\bve\be() does return to the calling process an error has occurred; the
+ return value will be -1 and the global variable _\be_\br_\br_\bn_\bo is set to indicate
+ the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ e\bex\bxe\bec\bcv\bve\be() will fail and return to the calling process if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The new process file does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The new process file is not an ordinary file.
+
+ [EACCES] The new process file mode denies execute permission.
+
+ [EACCES] The new process file is on a filesystem mounted with
+ execution disabled (MNT_NOEXEC in <_\bs_\by_\bs_\b/_\bm_\bo_\bu_\bn_\bt_\b._\bh>).
+
+ [ENOEXEC] The new process file has the appropriate access
+ permission, but has an invalid magic number in its
+ header.
+
+ [ETXTBSY] The new process file is a pure procedure (shared text)
+ file that is currently open for writing or reading by
+ some process.
+
+ [ENOMEM] The new process requires more virtual memory than is
+ allowed by the imposed maximum (getrlimit(2)).
+
+ [E2BIG] The number of bytes in the new process's argument list
+ is larger than the system-imposed limit. The limit in
+ the system as released is 262144 bytes (NCARGS in
+ <_\bs_\by_\bs_\b/_\bp_\ba_\br_\ba_\bm_\b._\bh>).
+
+ [EFAULT] The new process file is not as long as indicated by
+ the size values in its header.
+
+ [EFAULT] _\bp_\ba_\bt_\bh, _\ba_\br_\bg_\bv, or _\be_\bn_\bv_\bp point to an illegal address.
+
+ [EINVAL] _\ba_\br_\bg_\bv did not contain at least one element.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [ENFILE] During startup of an _\bi_\bn_\bt_\be_\br_\bp_\br_\be_\bt_\be_\br, the system file
+ table was found to be full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), fork(2), execl(3), exit(3), elf(5), environ(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The e\bex\bxe\bec\bcv\bve\be() function is expected to conform to IEEE Std 1003.1-2008
+ (``POSIX.1''). The e\bex\bxe\bec\bct\bt() function should not be used in portable
+ applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former e\bex\bxe\bec\bc() system call, first
+ appeared in Version 1 AT&T UNIX. The e\bex\bxe\bec\bcv\bve\be() function first appeared in
+ Version 7 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ If a program is _\bs_\be_\bt_\bu_\bi_\bd to a non-superuser, but is executed when the real
+ _\bu_\bi_\bd is ``root'', then the process has some of the powers of a superuser
+ as well.
+
+N\bNA\bAM\bME\bE
+ a\bac\bcc\bce\bes\bss\bs, f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt - check access permissions of a file or pathname
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bac\bcc\bce\bes\bss\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\ba_\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\ba_\bm_\bo_\bd_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The a\bac\bcc\bce\bes\bss\bs() function checks the accessibility of the file named by _\bp_\ba_\bt_\bh
+ for the access permissions indicated by _\ba_\bm_\bo_\bd_\be. The _\ba_\bm_\bo_\bd_\be argument is
+ either the bitwise OR of one or more of the access permissions to be
+ checked (R_OK for read permission, W_OK for write permission, and X_OK
+ for execute/search permission) or the existence test, F_OK. All
+ components of the pathname _\bp_\ba_\bt_\bh are checked for access permissions
+ (including F_OK).
+
+ The real user ID is used in place of the effective user ID and the real
+ group access list (including the real group ID) is used in place of the
+ effective ID for verifying permission.
+
+ If the invoking process has superuser privileges, a\bac\bcc\bce\bes\bss\bs() will always
+ indicate success for R_OK and W_OK, regardless of the actual file
+ permission bits. Likewise, for X_OK, if the file has any of the execute
+ bits set and _\bp_\ba_\bt_\bh is not a directory, a\bac\bcc\bce\bes\bss\bs() will indicate success.
+
+ The f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() function is equivalent to a\bac\bcc\bce\bes\bss\bs() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the file whose accessibility is checked is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+ If _\bf_\bl_\ba_\bg is also zero, the behavior is identical to a call to a\bac\bcc\bce\bes\bss\bs().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_EACCESS The checks for accessibility are performed using the
+ effective user and group IDs instead of the real user
+ and group IDs.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If _\bp_\ba_\bt_\bh cannot be found or if any of the desired access modes would not
+ be granted, then a -1 value is returned; otherwise a 0 value is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ Access to the file is denied if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] Write access is requested for a file on a read-only
+ file system.
+
+ [ETXTBSY] Write access is requested for a pure procedure (shared
+ text) file presently being executed.
+
+ [EACCES] Permission bits of the file mode do not permit the
+ requested access, or search permission is denied on a
+ component of the path prefix. The owner of a file has
+ permission checked with respect to the ``owner'' read,
+ write, and execute mode bits, members of the file's
+ group other than the owner have permission checked
+ with respect to the ``group'' mode bits, and all
+ others have permissions checked with respect to the
+ ``other'' mode bits.
+
+ [EPERM] Write access has been requested and the named file has
+ its immutable flag set (see chflags(2)).
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] An invalid value was specified for _\ba_\bm_\bo_\bd_\be.
+
+ Additionally, f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_EACCESS.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The a\bac\bcc\bce\bes\bss\bs() and f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ a\bac\bcc\bce\bes\bss\bs() first appeared as an internal kernel function in Version 1 AT&T
+ UNIX and was reimplemented in C before the release of Version 4 AT&T
+ UNIX. It was first promoted to a system call in the Programmer's
+ Workbench (PWB/UNIX), which was later ported to Version 7 AT&T UNIX and
+ 2BSD.
+
+ The f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() function appeared in OpenBSD 5.0.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ Ken Thompson first implemented the a\bac\bcc\bce\bes\bss\bs() kernel function in C.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ a\bac\bcc\bce\bes\bss\bs() and f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt() should never be used for actual access control.
+ Doing so can result in a time of check vs. time of use security hole.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhd\bdi\bir\br, f\bfc\bch\bhd\bdi\bir\br - change current working directory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhd\bdi\bir\br(_\bi_\bn_\bt _\bf_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The _\bp_\ba_\bt_\bh argument points to the pathname of a directory. The c\bch\bhd\bdi\bir\br()
+ function causes the named directory to become the current working
+ directory, that is, the starting point for path searches of pathnames not
+ beginning with a slash (`/').
+
+ The f\bfc\bch\bhd\bdi\bir\br() function causes the directory referenced by _\bf_\bd to become the
+ current working directory, the starting point for path searches of
+ pathnames not beginning with a slash (`/').
+
+ In order for a directory to become the current directory, a process must
+ have execute (search) access to the directory.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhd\bdi\bir\br() will fail and the current working directory will be unchanged if
+ one or more of the following are true:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named directory does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EACCES] Search permission is denied for any component of the
+ pathname.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ f\bfc\bch\bhd\bdi\bir\br() will fail and the current working directory will be unchanged if
+ one or more of the following are true:
+
+ [EACCES] Search permission is denied for the directory
+ referenced by the file descriptor.
+
+ [ENOTDIR] The file descriptor does not reference a directory.
+
+ [EBADF] The argument _\bf_\bd is not a valid file descriptor.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chroot(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bhd\bdi\bir\br() and f\bfc\bch\bhd\bdi\bir\br() functions are expected to conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhd\bdi\bir\br() system call first appeared in Version 1 AT&T UNIX, and
+ f\bfc\bch\bhd\bdi\bir\br() in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhf\bfl\bla\bag\bgs\bs, c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt, f\bfc\bch\bhf\bfl\bla\bag\bgs\bs - set file flags
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs(_\bi_\bn_\bt _\bf_\bd, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bi_\bn_\bt _\ba_\bt_\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The file whose name is given by _\bp_\ba_\bt_\bh or referenced by the descriptor _\bf_\bd
+ has its flags changed to _\bf_\bl_\ba_\bg_\bs.
+
+ The flags are the bitwise OR of zero or more of the following values:
+
+ UF_NODUMP Do not dump the file.
+ UF_IMMUTABLE The file may not be changed.
+ UF_APPEND The file may only be appended to.
+ SF_ARCHIVED The file may be archived.
+ SF_IMMUTABLE The file may not be changed.
+ SF_APPEND The file may only be appended to.
+
+ The UF_IMMUTABLE and UF_APPEND flags may be set or unset by either the
+ owner of a file or the superuser.
+
+ The SF_ARCHIVED, SF_IMMUTABLE and SF_APPEND flags may only be set or
+ unset by the superuser. They may be set at any time, but normally may
+ only be unset when the system is in single-user mode. (See init(8) for
+ details.)
+
+ The c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except in the case
+ where _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be
+ changed is determined relative to the directory associated with the file
+ descriptor _\bf_\bd instead of the current working directory.
+
+ If c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+ If _\bf_\bl_\ba_\bg is also zero, the behavior is identical to a call to c\bch\bhf\bfl\bla\bag\bgs\bs().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the flags
+ of the symbolic link are changed.
+
+ The f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() function is equivalent to c\bch\bhf\bfl\bla\bag\bgs\bs() except that the file
+ whose flags are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() will fail if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] The descriptor references a block or character device
+ and the effective user ID is not the superuser.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs value is invalid.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser,
+ or the effective user ID is not the superuser and at
+ least one of the super-user-only flags for the named
+ file would be changed.
+
+ [EOPNOTSUPP] The named file resides on a file system that does not
+ support file flags.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chflags(1), init(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhf\bfl\bla\bag\bgs\bs() and f\bfc\bch\bhf\bfl\bla\bag\bgs\bs() functions first appeared in 4.4BSD. The
+ c\bch\bhf\bfl\bla\bag\bgs\bsa\bat\bt() function first appeared in FreeBSD 10.0. It was added to
+ OpenBSD in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhm\bmo\bod\bd, f\bfc\bch\bhm\bmo\bod\bda\bat\bt, f\bfc\bch\bhm\bmo\bod\bd - change mode of file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhm\bmo\bod\bd(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bd(_\bi_\bn_\bt _\bf_\bd, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bda\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bch\bhm\bmo\bod\bd() function sets the file permission bits of the file specified
+ by the pathname _\bp_\ba_\bt_\bh to _\bm_\bo_\bd_\be. c\bch\bhm\bmo\bod\bd() verifies that the process owner
+ (user) either owns the specified file or is the superuser.
+
+ The _\bm_\bo_\bd_\be argument is the bitwise OR of zero or more of the permission bit
+ masks from the following list:
+
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ #define S_ISUID 0004000 /* set user id on execution */
+ #define S_ISGID 0002000 /* set group id on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a file, it is ignored.
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a directory, an unprivileged
+ user may not delete or rename files of other users in that directory.
+ The sticky bit may be set by any user on a directory which the user owns
+ or has appropriate permissions. For more details of the properties of
+ the sticky bit, see sticky(8).
+
+ Writing or changing the owner of a file turns off the set-user-ID and
+ set-group-ID bits unless the user is the superuser. This makes the
+ system somewhat more secure by protecting set-user-ID (set-group-ID)
+ files from remaining set-user-ID (set-group-ID) if they are modified, at
+ the expense of a degree of compatibility.
+
+ The f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function is equivalent to c\bch\bhm\bmo\bod\bd() except in the case where
+ _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be changed is
+ determined relative to the directory associated with the file descriptor
+ _\bf_\bd instead of the current working directory.
+
+ If f\bfc\bch\bhm\bmo\bod\bda\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used. If _\bf_\bl_\ba_\bg is
+ also zero, the behavior is identical to a call to c\bch\bhm\bmo\bod\bd().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the mode
+ of the symbolic link is changed.
+
+ The f\bfc\bch\bhm\bmo\bod\bd() function is equivalent to c\bch\bhm\bmo\bod\bd() except that the file whose
+ permissions are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The c\bch\bhm\bmo\bod\bd() and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions will fail and the file mode will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, the f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EOPNOTSUPP] The _\bf_\bl_\ba_\bg argument specifies AT_SYMLINK_NOFOLLOW on a
+ symbolic link and the file system does not support
+ that operation.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bhm\bmo\bod\bd() will fail and the file mode will be unchanged if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(1), chown(2), open(2), stat(2), sticky(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bhm\bmo\bod\bd(), f\bfc\bch\bhm\bmo\bod\bd(), and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions are expected to conform
+ to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhm\bmo\bod\bd() system call first appeared in Version 1 AT&T UNIX; f\bfc\bch\bhm\bmo\bod\bd()
+ in 4.1cBSD; and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ c\bch\bhm\bmo\bod\bd, f\bfc\bch\bhm\bmo\bod\bda\bat\bt, f\bfc\bch\bhm\bmo\bod\bd - change mode of file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bhm\bmo\bod\bd(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bd(_\bi_\bn_\bt _\bf_\bd, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bhm\bmo\bod\bda\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bch\bhm\bmo\bod\bd() function sets the file permission bits of the file specified
+ by the pathname _\bp_\ba_\bt_\bh to _\bm_\bo_\bd_\be. c\bch\bhm\bmo\bod\bd() verifies that the process owner
+ (user) either owns the specified file or is the superuser.
+
+ The _\bm_\bo_\bd_\be argument is the bitwise OR of zero or more of the permission bit
+ masks from the following list:
+
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ #define S_ISUID 0004000 /* set user id on execution */
+ #define S_ISGID 0002000 /* set group id on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a file, it is ignored.
+
+ If mode ISVTX (the _\bs_\bt_\bi_\bc_\bk_\by _\bb_\bi_\bt) is set on a directory, an unprivileged
+ user may not delete or rename files of other users in that directory.
+ The sticky bit may be set by any user on a directory which the user owns
+ or has appropriate permissions. For more details of the properties of
+ the sticky bit, see sticky(8).
+
+ Writing or changing the owner of a file turns off the set-user-ID and
+ set-group-ID bits unless the user is the superuser. This makes the
+ system somewhat more secure by protecting set-user-ID (set-group-ID)
+ files from remaining set-user-ID (set-group-ID) if they are modified, at
+ the expense of a degree of compatibility.
+
+ The f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function is equivalent to c\bch\bhm\bmo\bod\bd() except in the case where
+ _\bp_\ba_\bt_\bh specifies a relative path. In this case the file to be changed is
+ determined relative to the directory associated with the file descriptor
+ _\bf_\bd instead of the current working directory.
+
+ If f\bfc\bch\bhm\bmo\bod\bda\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used. If _\bf_\bl_\ba_\bg is
+ also zero, the behavior is identical to a call to c\bch\bhm\bmo\bod\bd().
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the mode
+ of the symbolic link is changed.
+
+ The f\bfc\bch\bhm\bmo\bod\bd() function is equivalent to c\bch\bhm\bmo\bod\bd() except that the file whose
+ permissions are changed is specified by the file descriptor _\bf_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The c\bch\bhm\bmo\bod\bd() and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions will fail and the file mode will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, the f\bfc\bch\bhm\bmo\bod\bda\bat\bt() function will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EOPNOTSUPP] The _\bf_\bl_\ba_\bg argument specifies AT_SYMLINK_NOFOLLOW on a
+ symbolic link and the file system does not support
+ that operation.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bhm\bmo\bod\bd() will fail and the file mode will be unchanged if:
+
+ [EBADF] The descriptor is not valid.
+
+ [EINVAL] _\bf_\bd refers to a socket, not to a file.
+
+ [EINVAL] _\bm_\bo_\bd_\be contains bits other than the file type and those
+ described above.
+
+ [EPERM] The effective user ID does not match the owner of the
+ file and the effective user ID is not the superuser.
+
+ [EROFS] The file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(1), chown(2), open(2), stat(2), sticky(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bhm\bmo\bod\bd(), f\bfc\bch\bhm\bmo\bod\bd(), and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() functions are expected to conform
+ to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bhm\bmo\bod\bd() system call first appeared in Version 1 AT&T UNIX; f\bfc\bch\bhm\bmo\bod\bd()
+ in 4.1cBSD; and f\bfc\bch\bhm\bmo\bod\bda\bat\bt() has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ c\bch\bho\bow\bwn\bn, l\blc\bch\bho\bow\bwn\bn, f\bfc\bch\bho\bow\bwn\bna\bat\bt, f\bfc\bch\bho\bow\bwn\bn - change owner and group of a file or
+ link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ l\blc\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bn(_\bi_\bn_\bt _\bf_\bd, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The owner ID and group ID of the file (or link) named by _\bp_\ba_\bt_\bh or
+ referenced by _\bf_\bd is changed as specified by the arguments _\bo_\bw_\bn_\be_\br and
+ _\bg_\br_\bo_\bu_\bp. The owner of a file may change the _\bg_\br_\bo_\bu_\bp to a group of which he
+ or she is a member, but the change _\bo_\bw_\bn_\be_\br capability is restricted to the
+ superuser.
+
+ By default, c\bch\bho\bow\bwn\bn() clears the set-user-ID and set-group-ID bits on the
+ file to prevent accidental or mischievous creation of set-user-ID and
+ set-group-ID programs. This behaviour can be overridden by setting the
+ sysctl(8) variable _\bf_\bs_\b._\bp_\bo_\bs_\bi_\bx_\b._\bs_\be_\bt_\bu_\bi_\bd to zero.
+
+ l\blc\bch\bho\bow\bwn\bn() operates similarly to how c\bch\bho\bow\bwn\bn() operated on older systems, and
+ does not follow symbolic links. It allows the owner and group of a
+ symbolic link to be set.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() function is equivalent to either the c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose ownership is changed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfc\bch\bho\bow\bwn\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ ownership of the symbolic link is changed.
+
+ f\bfc\bch\bho\bow\bwn\bn() is particularly useful when used in conjunction with the file
+ locking primitives (see flock(2)).
+
+ One of the owner or group IDs may be left unchanged by specifying it as
+ -1.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bho\bow\bwn\bn(), l\blc\bch\bho\bow\bwn\bn(), and f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail and the file or link will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bho\bow\bwn\bn() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EINVAL] _\bf_\bd refers to a socket, not a file.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chgrp(1), chmod(2), flock(2), chown(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bna\bat\bt(), and l\blc\bch\bho\bow\bwn\bn() functions are expected to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bho\bow\bwn\bn() system call first appeared in Version 1 AT&T UNIX. Since
+ Version 6 AT&T UNIX it supports changing the group as well, and in
+ Version 7 AT&T UNIX _\bg_\br_\bo_\bu_\bp was made a separate argument.
+
+ The f\bfc\bch\bho\bow\bwn\bn() system call first appeared in 4.1cBSD.
+
+ The c\bch\bho\bow\bwn\bn() and f\bfc\bch\bho\bow\bwn\bn() system calls were changed to follow symbolic
+ links in 4.4BSD; therefore, and for compatibility with AT&T System V
+ Release 4 UNIX, the l\blc\bch\bho\bow\bwn\bn() system call was added to OpenBSD 2.1.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ c\bch\bho\bow\bwn\bn, l\blc\bch\bho\bow\bwn\bn, f\bfc\bch\bho\bow\bwn\bna\bat\bt, f\bfc\bch\bho\bow\bwn\bn - change owner and group of a file or
+ link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ l\blc\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bn(_\bi_\bn_\bt _\bf_\bd, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The owner ID and group ID of the file (or link) named by _\bp_\ba_\bt_\bh or
+ referenced by _\bf_\bd is changed as specified by the arguments _\bo_\bw_\bn_\be_\br and
+ _\bg_\br_\bo_\bu_\bp. The owner of a file may change the _\bg_\br_\bo_\bu_\bp to a group of which he
+ or she is a member, but the change _\bo_\bw_\bn_\be_\br capability is restricted to the
+ superuser.
+
+ By default, c\bch\bho\bow\bwn\bn() clears the set-user-ID and set-group-ID bits on the
+ file to prevent accidental or mischievous creation of set-user-ID and
+ set-group-ID programs. This behaviour can be overridden by setting the
+ sysctl(8) variable _\bf_\bs_\b._\bp_\bo_\bs_\bi_\bx_\b._\bs_\be_\bt_\bu_\bi_\bd to zero.
+
+ l\blc\bch\bho\bow\bwn\bn() operates similarly to how c\bch\bho\bow\bwn\bn() operated on older systems, and
+ does not follow symbolic links. It allows the owner and group of a
+ symbolic link to be set.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() function is equivalent to either the c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose ownership is changed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfc\bch\bho\bow\bwn\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ ownership of the symbolic link is changed.
+
+ f\bfc\bch\bho\bow\bwn\bn() is particularly useful when used in conjunction with the file
+ locking primitives (see flock(2)).
+
+ One of the owner or group IDs may be left unchanged by specifying it as
+ -1.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bho\bow\bwn\bn(), l\blc\bch\bho\bow\bwn\bn(), and f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail and the file or link will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bho\bow\bwn\bn() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EINVAL] _\bf_\bd refers to a socket, not a file.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chgrp(1), chmod(2), flock(2), chown(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bna\bat\bt(), and l\blc\bch\bho\bow\bwn\bn() functions are expected to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bho\bow\bwn\bn() system call first appeared in Version 1 AT&T UNIX. Since
+ Version 6 AT&T UNIX it supports changing the group as well, and in
+ Version 7 AT&T UNIX _\bg_\br_\bo_\bu_\bp was made a separate argument.
+
+ The f\bfc\bch\bho\bow\bwn\bn() system call first appeared in 4.1cBSD.
+
+ The c\bch\bho\bow\bwn\bn() and f\bfc\bch\bho\bow\bwn\bn() system calls were changed to follow symbolic
+ links in 4.4BSD; therefore, and for compatibility with AT&T System V
+ Release 4 UNIX, the l\blc\bch\bho\bow\bwn\bn() system call was added to OpenBSD 2.1.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ f\bfc\bcn\bnt\btl\bl - file control
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bcn\bnt\btl\bl(_\bi_\bn_\bt _\bf_\bd, _\bi_\bn_\bt _\bc_\bm_\bd, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The f\bfc\bcn\bnt\btl\bl() provides control over the properties of a file that is
+ already open. The argument _\bf_\bd is a descriptor to be operated on by _\bc_\bm_\bd
+ as described below. The third parameter is called _\ba_\br_\bg and is technically
+ a pointer to _\bv_\bo_\bi_\bd, but is interpreted as an int by some commands, a
+ pointer to a struct flock by others (see below), and ignored by the rest.
+
+ The commands are:
+
+ F_DUPFD Return a new descriptor as follows:
+
+ +\b+\bo\bo Lowest numbered available descriptor greater than or
+ equal to _\ba_\br_\bg (interpreted as an int).
+ +\b+\bo\bo Same object references as the original descriptor.
+ +\b+\bo\bo New descriptor shares the same file offset if the
+ object was a file.
+ +\b+\bo\bo Same access mode (read, write or read/write).
+ +\b+\bo\bo Same file status flags (i.e., both file descriptors
+ share the same file status flags).
+ +\b+\bo\bo The close-on-exec flag associated with the new file
+ descriptor is set to remain open across execve(2)
+ calls.
+
+ F_DUPFD_CLOEXEC Like F_DUPFD, but the FD_CLOEXEC flag associated with
+ the new file descriptor is set, so the file descriptor
+ is closed when execve(2) is called.
+
+ F_GETFD Get the close-on-exec flag associated with the file
+ descriptor _\bf_\bd as FD_CLOEXEC. If the returned value
+ ANDed with FD_CLOEXEC is 0, the file will remain open
+ across e\bex\bxe\bec\bc(), otherwise the file will be closed upon
+ execution of e\bex\bxe\bec\bc() (_\ba_\br_\bg is ignored).
+
+ F_SETFD Set the close-on-exec flag associated with _\bf_\bd to _\ba_\br_\bg,
+ where _\ba_\br_\bg (interpreted as an int) is either 0 or
+ FD_CLOEXEC, as described above.
+
+ F_GETFL Get file status flags associated with the file
+ descriptor _\bf_\bd, as described below (_\ba_\br_\bg is ignored).
+
+ F_SETFL Set file status flags associated with the file
+ descriptor _\bf_\bd to _\ba_\br_\bg (interpreted as an int).
+
+ F_GETOWN Get the process ID or process group currently receiving
+ SIGIO and SIGURG signals; process groups are returned as
+ negative values (_\ba_\br_\bg is ignored).
+
+ F_SETOWN Set the process or process group to receive SIGIO and
+ SIGURG signals; process groups are specified by
+ supplying _\ba_\br_\bg (interpreted as an int) as negative,
+ otherwise _\ba_\br_\bg is taken as a process ID.
+
+ The flags for the F_GETFL and F_SETFL commands are as follows:
+
+ O_NONBLOCK Non-blocking I/O; if no data is available to a read(2) call,
+ or if a write(2) operation would block, the read or write
+ call returns -1 with the error EAGAIN.
+
+ O_APPEND Force each write to append at the end of file; corresponds
+ to the O_APPEND flag of open(2).
+
+ O_ASYNC Enable the SIGIO signal to be sent to the process group when
+ I/O is possible, e.g., upon availability of data to be read.
+
+ O_SYNC Cause writes to be synchronous. Data will be written to the
+ physical device instead of just being stored in the buffer
+ cache; corresponds to the O_SYNC flag of open(2).
+
+ Several commands are available for doing advisory file locking; they all
+ operate on the following structure:
+
+ struct flock {
+ off_t l_start; /* starting offset */
+ off_t l_len; /* len = 0 means until end of file */
+ pid_t l_pid; /* lock owner */
+ short l_type; /* lock type: read/write, etc. */
+ short l_whence; /* type of l_start */
+ };
+
+ The commands available for advisory record locking are as follows:
+
+ F_GETLK Get the first lock that blocks the lock description pointed to
+ by the third argument, _\ba_\br_\bg, taken as a pointer to a _\bs_\bt_\br_\bu_\bc_\bt
+ _\bf_\bl_\bo_\bc_\bk (see above). The information retrieved overwrites the
+ information passed to f\bfc\bcn\bnt\btl\bl() in the _\bf_\bl_\bo_\bc_\bk structure. If no
+ lock is found that would prevent this lock from being created,
+ the structure is left unchanged by this function call except
+ for the lock type which is set to F_UNLCK.
+
+ F_SETLK Set or clear a file segment lock according to the lock
+ description pointed to by the third argument, _\ba_\br_\bg, taken as a
+ pointer to a _\bs_\bt_\br_\bu_\bc_\bt _\bf_\bl_\bo_\bc_\bk (see above). F_SETLK is used to
+ establish shared (or read) locks (F_RDLCK) or exclusive (or
+ write) locks (F_WRLCK), as well as remove either type of lock
+ (F_UNLCK). If a shared or exclusive lock cannot be set,
+ f\bfc\bcn\bnt\btl\bl() returns immediately with EAGAIN.
+
+ F_SETLKW This command is the same as F_SETLK except that if a shared or
+ exclusive lock is blocked by other locks, the process waits
+ until the request can be satisfied. If a signal that is to be
+ caught is received while f\bfc\bcn\bnt\btl\bl() is waiting for a region, the
+ f\bfc\bcn\bnt\btl\bl() will be interrupted if the signal handler has not
+ specified the SA_RESTART (see sigaction(2)).
+
+ When a shared lock has been set on a segment of a file, other processes
+ can set shared locks on that segment or a portion of it. A shared lock
+ prevents any other process from setting an exclusive lock on any portion
+ of the protected area. A request for a shared lock fails if the file
+ descriptor was not opened with read access.
+
+ An exclusive lock prevents any other process from setting a shared lock
+ or an exclusive lock on any portion of the protected area. A request for
+ an exclusive lock fails if the file was not opened with write access.
+
+ The value of _\bl_\b__\bw_\bh_\be_\bn_\bc_\be is SEEK_SET, SEEK_CUR, or SEEK_END to indicate that
+ the relative offset, _\bl_\b__\bs_\bt_\ba_\br_\bt bytes, will be measured from the start of
+ the file, current position, or end of the file, respectively. The value
+ of _\bl_\b__\bl_\be_\bn is the number of consecutive bytes to be locked. If _\bl_\b__\bl_\be_\bn is
+ negative, the result is undefined. The _\bl_\b__\bp_\bi_\bd field is only used with
+ F_GETLK to return the process ID of the process holding a blocking lock.
+ After a successful F_GETLK request, the value of _\bl_\b__\bw_\bh_\be_\bn_\bc_\be is SEEK_SET.
+
+ Locks may start and extend beyond the current end of a file, but may not
+ start or extend before the beginning of the file. A lock is set to
+ extend to the largest possible value of the file offset for that file if
+ _\bl_\b__\bl_\be_\bn is set to zero. If _\bl_\b__\bw_\bh_\be_\bn_\bc_\be and _\bl_\b__\bs_\bt_\ba_\br_\bt point to the beginning of
+ the file, and _\bl_\b__\bl_\be_\bn is zero, the entire file is locked. If an
+ application wishes only to do entire file locking, the flock(2) system
+ call is much more efficient.
+
+ There is at most one type of lock set for each byte in the file. Before
+ a successful return from an F_SETLK or an F_SETLKW request when the
+ calling process has previously existing locks on bytes in the region
+ specified by the request, the previous lock type for each byte in the
+ specified region is replaced by the new lock type. As specified above
+ under the descriptions of shared locks and exclusive locks, an F_SETLK or
+ an F_SETLKW request fails or blocks respectively when another process has
+ existing locks on bytes in the specified region and the type of any of
+ those locks conflicts with the type specified in the request.
+
+ This interface follows the completely stupid semantics of System V and
+ IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks associated
+ with a file for a given process are removed when _\ba_\bn_\by file descriptor for
+ that file is closed by that process. This semantic means that
+ applications must be aware of any files that a subroutine library may
+ access. For example if an application for updating the password file
+ locks the password file database while making the update, and then calls
+ getpwnam(3) to retrieve a record, the lock will be lost because
+ getpwnam(3) opens, reads, and closes the password database. The database
+ close will release all locks that the process has associated with the
+ database, even if the library routine never requested a lock on the
+ database. Another minor semantic problem with this interface is that
+ locks are not inherited by a child process created using the fork(2)
+ function. The flock(2) interface has much more rational last close
+ semantics and allows locks to be inherited by child processes. flock(2)
+ is recommended for applications that want to ensure the integrity of
+ their locks when using library routines or wish to pass locks to their
+ children. Note that flock(2) and f\bfc\bcn\bnt\btl\bl() locks may be safely used
+ concurrently.
+
+ All locks associated with a file for a given process are removed when the
+ process terminates.
+
+ A potential for deadlock occurs if a process controlling a locked region
+ is put to sleep by attempting to lock the locked region of another
+ process. This implementation detects that sleeping until a locked region
+ is unlocked would cause a deadlock and fails with an EDEADLK error.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value returned depends on _\bc_\bm_\bd as follows:
+
+ F_DUPFD A new file descriptor.
+
+ F_DUPFD_CLOEXEC A new file descriptor.
+
+ F_GETFD Value of flag (only the low-order bit is defined).
+
+ F_GETFL Value of flags.
+
+ F_GETOWN Value of file descriptor owner.
+
+ other Value other than -1.
+
+ Otherwise, a value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ f\bfc\bcn\bnt\btl\bl() will fail if:
+
+ [EAGAIN] The argument _\bc_\bm_\bd is F_SETLK, the type of lock (_\bl_\b__\bt_\by_\bp_\be)
+ is a shared lock (F_RDLCK) or exclusive lock
+ (F_WRLCK), and the segment of a file to be locked is
+ already exclusive-locked by another process; or the
+ type is an exclusive lock and some portion of the
+ segment of a file to be locked is already shared-
+ locked or exclusive-locked by another process.
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ The argument _\bc_\bm_\bd is F_SETLK or F_SETLKW, the type of
+ lock (_\bl_\b__\bt_\by_\bp_\be) is a shared lock (F_RDLCK), and _\bf_\bd is
+ not a valid file descriptor open for reading.
+
+ The argument _\bc_\bm_\bd is F_SETLK or F_SETLKW, the type of
+ lock (_\bl_\b__\bt_\by_\bp_\be) is an exclusive lock (F_WRLCK), and _\bf_\bd
+ is not a valid file descriptor open for writing.
+
+ [EDEADLK] The argument _\bc_\bm_\bd is F_SETLKW, and a deadlock condition
+ was detected.
+
+ [EINTR] The argument _\bc_\bm_\bd is invalid.
+
+ The argument _\bc_\bm_\bd is F_SETLKW, and the function was
+ interrupted by a signal.
+
+ [EINVAL] _\bc_\bm_\bd is F_DUPFD and _\ba_\br_\bg is negative or greater than the
+ maximum allowable number (see getdtablesize(3)).
+
+ The argument _\bc_\bm_\bd is F_GETLK, F_SETLK, or F_SETLKW and
+ the data to which _\ba_\br_\bg points is not valid, or _\bf_\bd
+ refers to a file that does not support locking.
+
+ [EMFILE] The argument _\bc_\bm_\bd is F_DUPFD and the maximum number of
+ open file descriptors permitted for the process are
+ already in use, or no file descriptors greater than or
+ equal to _\ba_\br_\bg are available.
+
+ [ENOLCK] The argument _\bc_\bm_\bd is F_SETLK or F_SETLKW, and
+ satisfying the lock or unlock request would result in
+ the number of locked regions in the system exceeding a
+ system-imposed limit.
+
+ [ESRCH] _\bc_\bm_\bd is F_SETOWN and the process ID given in _\ba_\br_\bg is not
+ in use.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ close(2), execve(2), flock(2), open(2), sigaction(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The f\bfc\bcn\bnt\btl\bl() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfc\bcn\bnt\btl\bl() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ f\bfs\bsy\byn\bnc\bc, f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc - synchronize a file's in-core state with that on disk
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bsy\byn\bnc\bc(_\bi_\bn_\bt _\bf_\bd);
+
+ _\bi_\bn_\bt
+ f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc(_\bi_\bn_\bt _\bf_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The f\bfs\bsy\byn\bnc\bc() function causes all modified data and attributes of _\bf_\bd to be
+ moved to a permanent storage device. This normally results in all in-
+ core modified copies of buffers for the associated file to be written to
+ a disk.
+
+ The f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() function is similar to f\bfs\bsy\byn\bnc\bc() except that it only
+ guarantees modified data (and metadata necessary to read that data) is
+ committed to storage. Other file modifications may be left
+ unsynchronized.
+
+ f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() should be used by programs that require a file to
+ be in a known state, for example, in building a simple transaction
+ facility.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions return the value 0 if successful;
+ otherwise the value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions fail if:
+
+ [EBADF] _\bf_\bd is not a valid descriptor.
+
+ [EINVAL] _\bf_\bd does not refer to a file which can be synchronized.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sync(2), sync(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfs\bsy\byn\bnc\bc() system call first appeared in 4.1cBSD, and the f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc()
+ function has been available since OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ The f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() function is currently a wrapper around f\bfs\bsy\byn\bnc\bc(), so it
+ synchronizes more state than necessary.
+
+N\bNA\bAM\bME\bE
+ f\bfh\bho\bop\bpe\ben\bn, f\bfh\bhs\bst\bta\bat\bt, f\bfh\bhs\bst\bta\bat\btf\bfs\bs - access file via file handle
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfh\bho\bop\bpe\ben\bn(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ These functions provide a means to access a file given the file handle
+ _\bf_\bh_\bp. As this method bypasses directory access restrictions, these calls
+ are restricted to the superuser.
+
+ f\bfh\bho\bop\bpe\ben\bn() opens the file referenced by _\bf_\bh_\bp for reading and/or writing as
+ specified by the argument _\bf_\bl_\ba_\bg_\bs and returns the file descriptor to the
+ calling process. The _\bf_\bl_\ba_\bg_\bs are specified by _\bo_\br'ing together the flags
+ used for the open(2) call. All said flags are valid except for O_CREAT.
+
+ f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() provide the functionality of the fstat(2) and
+ fstatfs(2) calls except that they return information for the file
+ referred to by _\bf_\bh_\bp rather than an open file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, f\bfh\bho\bop\bpe\ben\bn() returns the file descriptor for the
+ opened file, while f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() return 0. Otherwise, -1 is
+ returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ In addition to the errors returned by open(2), fstat(2), and fstatfs(2)
+ respectively, f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() will return
+
+ [EINVAL] Calling f\bfh\bho\bop\bpe\ben\bn() with O_CREAT set.
+
+ [ESTALE] The file handle _\bf_\bh_\bp is no longer valid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fstat(2), fstatfs(2), getfh(2), open(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() functions first appeared in
+ NetBSD 1.5.
+
+N\bNA\bAM\bME\bE
+ f\bfh\bho\bop\bpe\ben\bn, f\bfh\bhs\bst\bta\bat\bt, f\bfh\bhs\bst\bta\bat\btf\bfs\bs - access file via file handle
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfh\bho\bop\bpe\ben\bn(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ These functions provide a means to access a file given the file handle
+ _\bf_\bh_\bp. As this method bypasses directory access restrictions, these calls
+ are restricted to the superuser.
+
+ f\bfh\bho\bop\bpe\ben\bn() opens the file referenced by _\bf_\bh_\bp for reading and/or writing as
+ specified by the argument _\bf_\bl_\ba_\bg_\bs and returns the file descriptor to the
+ calling process. The _\bf_\bl_\ba_\bg_\bs are specified by _\bo_\br'ing together the flags
+ used for the open(2) call. All said flags are valid except for O_CREAT.
+
+ f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() provide the functionality of the fstat(2) and
+ fstatfs(2) calls except that they return information for the file
+ referred to by _\bf_\bh_\bp rather than an open file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, f\bfh\bho\bop\bpe\ben\bn() returns the file descriptor for the
+ opened file, while f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() return 0. Otherwise, -1 is
+ returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ In addition to the errors returned by open(2), fstat(2), and fstatfs(2)
+ respectively, f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() will return
+
+ [EINVAL] Calling f\bfh\bho\bop\bpe\ben\bn() with O_CREAT set.
+
+ [ESTALE] The file handle _\bf_\bh_\bp is no longer valid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fstat(2), fstatfs(2), getfh(2), open(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() functions first appeared in
+ NetBSD 1.5.
+
+N\bNA\bAM\bME\bE
+ f\bfh\bho\bop\bpe\ben\bn, f\bfh\bhs\bst\bta\bat\bt, f\bfh\bhs\bst\bta\bat\btf\bfs\bs - access file via file handle
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfh\bho\bop\bpe\ben\bn(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfh\bhs\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ These functions provide a means to access a file given the file handle
+ _\bf_\bh_\bp. As this method bypasses directory access restrictions, these calls
+ are restricted to the superuser.
+
+ f\bfh\bho\bop\bpe\ben\bn() opens the file referenced by _\bf_\bh_\bp for reading and/or writing as
+ specified by the argument _\bf_\bl_\ba_\bg_\bs and returns the file descriptor to the
+ calling process. The _\bf_\bl_\ba_\bg_\bs are specified by _\bo_\br'ing together the flags
+ used for the open(2) call. All said flags are valid except for O_CREAT.
+
+ f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() provide the functionality of the fstat(2) and
+ fstatfs(2) calls except that they return information for the file
+ referred to by _\bf_\bh_\bp rather than an open file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, f\bfh\bho\bop\bpe\ben\bn() returns the file descriptor for the
+ opened file, while f\bfh\bhs\bst\bta\bat\bt() and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() return 0. Otherwise, -1 is
+ returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ In addition to the errors returned by open(2), fstat(2), and fstatfs(2)
+ respectively, f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() will return
+
+ [EINVAL] Calling f\bfh\bho\bop\bpe\ben\bn() with O_CREAT set.
+
+ [ESTALE] The file handle _\bf_\bh_\bp is no longer valid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fstat(2), fstatfs(2), getfh(2), open(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfh\bho\bop\bpe\ben\bn(), f\bfh\bhs\bst\bta\bat\bt(), and f\bfh\bhs\bst\bta\bat\btf\bfs\bs() functions first appeared in
+ NetBSD 1.5.
+
+N\bNA\bAM\bME\bE
+ f\bfl\blo\boc\bck\bk - apply or remove an advisory lock on an open file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfl\blo\boc\bck\bk(_\bi_\bn_\bt _\bf_\bd, _\bi_\bn_\bt _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ f\bfl\blo\boc\bck\bk() applies or removes an _\ba_\bd_\bv_\bi_\bs_\bo_\br_\by lock on the file associated with
+ the file descriptor _\bf_\bd. The _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn argument is one of:
+
+ LOCK_SH Apply a shared lock.
+ LOCK_EX Apply an exclusive lock.
+ LOCK_UN Remove an existing lock.
+
+ LOCK_SH and LOCK_EX may be combined with the optional LOCK_NB for
+ nonblocking mode.
+
+ Advisory locks allow cooperating processes to perform consistent
+ operations on files, but do not guarantee consistency (i.e., processes
+ may still access files without using advisory locks possibly resulting in
+ inconsistencies).
+
+ The locking mechanism allows two types of locks: _\bs_\bh_\ba_\br_\be_\bd locks and
+ _\be_\bx_\bc_\bl_\bu_\bs_\bi_\bv_\be locks. At any time multiple shared locks may be applied to a
+ file, but at no time are multiple exclusive, or both shared and
+ exclusive, locks allowed simultaneously on a file.
+
+ A shared lock may be _\bu_\bp_\bg_\br_\ba_\bd_\be_\bd to an exclusive lock, and vice versa,
+ simply by specifying the appropriate lock type; this results in the
+ previous lock being released and the new lock applied (possibly after
+ other processes have gained and released the lock).
+
+ Requesting a lock on an object that is already locked normally causes the
+ caller to be blocked until the lock may be acquired. If _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn is the
+ bitwise OR of LOCK_NB and LOCK_SH or LOCK_EX, then this will not happen;
+ instead the call will fail and the error EWOULDBLOCK will be returned.
+
+N\bNO\bOT\bTE\bES\bS
+ Locks are on files, not file descriptors. That is, file descriptors
+ duplicated through dup(2) or fork(2) do not result in multiple instances
+ of a lock, but rather multiple references to a single lock. If a process
+ holding a lock on a file forks and the child explicitly unlocks the file,
+ the parent will lose its lock.
+
+ Processes blocked awaiting a lock may be awakened by signals.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The f\bfl\blo\boc\bck\bk() call fails if:
+
+ [EWOULDBLOCK] The file is locked and the LOCK_NB option was
+ specified.
+
+ [EBADF] The argument _\bf_\bd is an invalid descriptor.
+
+ [EINVAL] The argument _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn has an invalid value.
+
+ [EOPNOTSUPP] The referenced descriptor is not of the correct type.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ close(2), dup(2), execve(2), fcntl(2), fork(2), open(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfl\blo\boc\bck\bk() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ f\bfo\bor\brk\bk - create a new process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ f\bfo\bor\brk\bk(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ f\bfo\bor\brk\bk() causes creation of a new process. The new process (child process)
+ is an exact copy of the calling process (parent process) except for the
+ following:
+
+ +\b+\bo\bo The child process has a unique process ID, which also does not
+ match any existing process group ID.
+
+ +\b+\bo\bo The child process has a different parent process ID (i.e., the
+ process ID of the parent process).
+
+ +\b+\bo\bo The child process has a single thread.
+
+ +\b+\bo\bo The child process has its own copy of the parent's descriptors.
+ These descriptors reference the same underlying objects, so
+ that, for instance, file pointers in file objects are shared
+ between the child and the parent, so that an lseek(2) on a
+ descriptor in the child process can affect a subsequent read(2)
+ or write(2) by the parent. This descriptor copying is also
+ used by the shell to establish standard input and output for
+ newly created processes as well as to set up pipes.
+
+ +\b+\bo\bo The child process has no fcntl(2)-style file locks.
+
+ +\b+\bo\bo The child process' resource utilizations are set to 0; see
+ getrusage(2).
+
+ +\b+\bo\bo All interval timers are cleared; see setitimer(2).
+
+ +\b+\bo\bo The child process' semaphore undo values are set to 0; see
+ semop(2).
+
+ +\b+\bo\bo The child process' pending signals set is empty.
+
+ +\b+\bo\bo The child process has no memory locks; see mlock(2) and
+ mlockall(2).
+
+ In general, the child process should call _exit(2) rather than exit(3).
+ Otherwise, any stdio buffers that exist both in the parent and child will
+ be flushed twice. Similarly, _exit(2) should be used to prevent
+ atexit(3) routines from being called twice (once in the parent and once
+ in the child).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, f\bfo\bor\brk\bk() returns a value of 0 to the child
+ process and returns the process ID of the child process to the parent
+ process. Otherwise, a value of -1 is returned to the parent process, no
+ child process is created, and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ f\bfo\bor\brk\bk() will fail and no child process will be created if:
+
+ [EAGAIN] The system-imposed limits on the total number of processes or
+ total number of threads under execution would be exceeded.
+ These limits are configuration dependent.
+
+ [EAGAIN] The limit RLIMIT_NPROC on the total number of processes under
+ execution by the user ID would be exceeded.
+
+ [ENOMEM] There is insufficient swap space for the new process.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ execve(2), getrusage(2), wait(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The f\bfo\bor\brk\bk() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfo\bor\brk\bk() system call first appeared in Version 1 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf, f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf - get configurable pathname variables
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bl_\bo_\bn_\bg
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bn_\ba_\bm_\be);
+
+ _\bl_\bo_\bn_\bg
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf(_\bi_\bn_\bt _\bf_\bd, _\bi_\bn_\bt _\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf() and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf() functions provide a method for
+ applications to determine the current value of a configurable system
+ limit or option variable associated with a pathname or file descriptor.
+
+ For p\bpa\bat\bth\bhc\bco\bon\bnf\bf, the _\bp_\ba_\bt_\bh argument is the name of a file or directory. For
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf, the _\bf_\bd argument is an open file descriptor. The _\bn_\ba_\bm_\be argument
+ specifies the system variable to be queried. Symbolic constants for each
+ name value are found in the include file <_\bu_\bn_\bi_\bs_\bt_\bd_\b._\bh>.
+
+ The available values are as follows:
+
+ _PC_LINK_MAX
+ The maximum file link count.
+
+ _PC_MAX_CANON
+ The maximum number of bytes in a terminal canonical input line.
+
+ _PC_MAX_INPUT
+ The maximum number of bytes for which space is available in a
+ terminal input queue.
+
+ _PC_NAME_MAX
+ The maximum number of bytes in a file name.
+
+ _PC_PATH_MAX
+ The maximum number of bytes in a pathname.
+
+ _PC_PIPE_BUF
+ The maximum number of bytes which will be written atomically to a
+ pipe.
+
+ _PC_CHOWN_RESTRICTED
+ Returns 1 if appropriate privileges are required for the chown(2)
+ system call, otherwise 0. IEEE Std 1003.1-2001 (``POSIX.1'')
+ requires appropriate privilege in all cases, but this behavior
+ was optional in prior editions of the standard.
+
+ _PC_NO_TRUNC
+ Returns 1 if attempts to use pathname components longer than
+ {NAME_MAX} will result in an [ENAMETOOLONG] error; otherwise,
+ such components will be truncated to {NAME_MAX}. IEEE Std
+ 1003.1-2001 (``POSIX.1'') requires the error in all cases, but
+ this behavior was optional in prior editions of the standard, and
+ some non-POSIX-compliant file systems do not support this
+ behavior.
+
+ _PC_VDISABLE
+ Returns the terminal character disabling value.
+
+ _PC_2_SYMLINKS
+ Returns 1 if the filesystem supports the creation of symbolic
+ links within the specified directory; the meaning of
+ _PC_2_SYMLINKS is unspecified for non-directory files.
+
+ _PC_ALLOC_SIZE_MIN
+ Minimum number of bytes of storage allocated for any portion of a
+ file.
+
+ _PC_ASYNC_IO
+ Returns 1 if asynchronous I/O is supported, otherwise 0.
+
+ _PC_FILESIZEBITS
+ Number of bits needed to represent the maximum file size.
+
+ _PC_PRIO_IO
+ Returns 1 if prioritized I/O is supported, otherwise 0.
+
+ _PC_REC_INCR_XFER_SIZE
+ Recommended increment for file transfer sizes between
+ _PC_REC_MIN_XFER_SIZE and _PC_REC_MAX_XFER_SIZE.
+
+ _PC_REC_MAX_XFER_SIZE
+ Maximum recommended file transfer size.
+
+ _PC_REC_MIN_XFER_SIZE
+ Minimum recommended file transfer size.
+
+ _PC_REC_XFER_ALIGN
+ Recommended file transfer buffer alignment.
+
+ _PC_SYMLINK_MAX
+ Maximum number of bytes in a symbolic link.
+
+ _PC_SYNC_IO
+ Returns 1 if synchronized I/O is supported, otherwise 0.
+
+ _PC_TIMESTAMP_RESOLUTION
+ The resolution in nanoseconds of file timestamps.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the call to p\bpa\bat\bth\bhc\bco\bon\bnf\bf or f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf is not successful, -1 is returned
+ and _\be_\br_\br_\bn_\bo is set appropriately. Otherwise, if the variable is associated
+ with functionality that does not have a limit in the system, -1 is
+ returned and _\be_\br_\br_\bn_\bo is not modified. Otherwise, the current variable
+ value is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ If any of the following conditions occur, the p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf
+ functions shall return -1 and set _\be_\br_\br_\bn_\bo to the corresponding value.
+
+ [EINVAL] The value of the _\bn_\ba_\bm_\be argument is invalid.
+
+ [EINVAL] The implementation does not support an association of
+ the variable name with the associated file.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters
+ (but see _PC_NO_TRUNC above), or an entire pathname
+ (including the terminating NUL) exceeded PATH_MAX
+ bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sysconf(3), sysctl(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf functions first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\btf\bfs\bs, f\bfs\bst\bta\bat\btf\bfs\bs - get file system statistics
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\btf\bfs\bs(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bst\bta\bat\btf\bfs\bs() returns information about a mounted file system. _\bp_\ba_\bt_\bh is the
+ path name of any file within the mounted file system. _\bb_\bu_\bf is a pointer
+ to a s\bst\bta\bat\btf\bfs\bs structure defined as follows:
+
+ typedef struct { int32_t val[2]; } fsid_t;
+
+ #define MFSNAMELEN 16 /* length of fs type name, including nul */
+ #define MNAMELEN 90 /* length of buffer for returned name */
+
+ struct statfs {
+ u_int32_t f_flags; /* copy of mount flags */
+ u_int32_t f_bsize; /* file system block size */
+ u_int32_t f_iosize; /* optimal transfer block size */
+
+ /* unit is f_bsize */
+ u_int64_t f_blocks; /* total data blocks in file system */
+ u_int64_t f_bfree; /* free blocks in fs */
+ int64_t f_bavail; /* free blocks avail to non-superuser */
+
+ u_int64_t f_files; /* total file nodes in file system */
+ u_int64_t f_ffree; /* free file nodes in fs */
+ int64_t f_favail; /* free file nodes avail to non-root */
+
+ u_int64_t f_syncwrites; /* count of sync writes since mount */
+ u_int64_t f_syncreads; /* count of sync reads since mount */
+ u_int64_t f_asyncwrites; /* count of async writes since mount */
+ u_int64_t f_asyncreads; /* count of async reads since mount */
+
+ fsid_t f_fsid; /* file system id */
+ u_int32_t f_namemax; /* maximum filename length */
+ uid_t f_owner; /* user that mounted the file system */
+ u_int64_t f_ctime; /* last mount [-u] time */
+
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN]; /* mounted file system */
+ char f_mntfromspec[MNAMELEN]; /* special for mount request */
+ union mount_info mount_info; /* per-filesystem mount options */
+ };
+
+ f\bfs\bst\bta\bat\btf\bfs\bs() returns the same information about an open file referenced by
+ descriptor _\bf_\bd.
+
+ Note that _\bf_\b__\bf_\bs_\bi_\bd will be empty unless the user is the superuser.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\btf\bfs\bs() fails if one or more of the following are true:
+
+ [ENOTDIR] A component of the path prefix of _\bp_\ba_\bt_\bh is not a
+ directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The file referred to by _\bp_\ba_\bt_\bh does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix of _\bp_\ba_\bt_\bh.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating _\bp_\ba_\bt_\bh.
+
+ [EFAULT] _\bb_\bu_\bf or _\bp_\ba_\bt_\bh points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ f\bfs\bst\bta\bat\btf\bfs\bs() fails if one or more of the following are true:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bb_\bu_\bf points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ df(1), getfsstat(2), mount(2), stat(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\btf\bfs\bs() function first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ f\bfs\bsy\byn\bnc\bc, f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc - synchronize a file's in-core state with that on disk
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bsy\byn\bnc\bc(_\bi_\bn_\bt _\bf_\bd);
+
+ _\bi_\bn_\bt
+ f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc(_\bi_\bn_\bt _\bf_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The f\bfs\bsy\byn\bnc\bc() function causes all modified data and attributes of _\bf_\bd to be
+ moved to a permanent storage device. This normally results in all in-
+ core modified copies of buffers for the associated file to be written to
+ a disk.
+
+ The f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() function is similar to f\bfs\bsy\byn\bnc\bc() except that it only
+ guarantees modified data (and metadata necessary to read that data) is
+ committed to storage. Other file modifications may be left
+ unsynchronized.
+
+ f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() should be used by programs that require a file to
+ be in a known state, for example, in building a simple transaction
+ facility.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions return the value 0 if successful;
+ otherwise the value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions fail if:
+
+ [EBADF] _\bf_\bd is not a valid descriptor.
+
+ [EINVAL] _\bf_\bd does not refer to a file which can be synchronized.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sync(2), sync(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The f\bfs\bsy\byn\bnc\bc() and f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The f\bfs\bsy\byn\bnc\bc() system call first appeared in 4.1cBSD, and the f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc()
+ function has been available since OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ The f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc() function is currently a wrapper around f\bfs\bsy\byn\bnc\bc(), so it
+ synchronizes more state than necessary.
+
+N\bNA\bAM\bME\bE
+ t\btr\bru\bun\bnc\bca\bat\bte\be, f\bft\btr\bru\bun\bnc\bca\bat\bte\be - truncate or extend a file to a specified length
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ t\btr\bru\bun\bnc\bca\bat\bte\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bo_\bf_\bf_\b__\bt _\bl_\be_\bn_\bg_\bt_\bh);
+
+ _\bi_\bn_\bt
+ f\bft\btr\bru\bun\bnc\bca\bat\bte\be(_\bi_\bn_\bt _\bf_\bd, _\bo_\bf_\bf_\b__\bt _\bl_\be_\bn_\bg_\bt_\bh);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ t\btr\bru\bun\bnc\bca\bat\bte\be() causes the file named by _\bp_\ba_\bt_\bh or referenced by _\bf_\bd to be
+ truncated or extended to _\bl_\be_\bn_\bg_\bt_\bh bytes in size. If the file was larger
+ than this size, the extra data is lost. If the file was smaller than
+ this size, it will be extended as if by writing bytes with the value
+ zero. With f\bft\btr\bru\bun\bnc\bca\bat\bte\be(), the file must be open for writing.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() will succeed unless:
+
+ [EINVAL] The _\bl_\be_\bn_\bg_\bt_\bh is a negative value.
+
+ [EIO] An I/O error occurred updating the inode.
+
+ In addition, t\btr\bru\bun\bnc\bca\bat\bte\be() may return the following errors:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The named file is not writable by the user.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EISDIR] The named file is a directory.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [ETXTBSY] The file is a pure procedure (shared text) file that
+ is being executed.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ f\bft\btr\bru\bun\bnc\bca\bat\bte\be() may return the following errors:
+
+ [EBADF] The _\bf_\bd is not a valid descriptor.
+
+ [EINVAL] The _\bf_\bd references a socket, not a file.
+
+ [EINVAL] The _\bf_\bd is not open for writing.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ open(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() system calls first appeared in 4.1cBSD.
+
+B\bBU\bUG\bGS\bS
+ These calls should be generalized to allow ranges of bytes in a file to
+ be discarded.
+
+ Use of t\btr\bru\bun\bnc\bca\bat\bte\be() to extend a file is not portable.
+
+N\bNA\bAM\bME\bE
+ u\but\bti\bim\bme\bes\bs, f\bfu\but\bti\bim\bme\bes\bs, u\but\bti\bim\bme\ben\bns\bsa\bat\bt, f\bfu\but\bti\bim\bme\ben\bns\bs - set file access and modification
+ times
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\bes\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\bes\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\ben\bns\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b],
+ _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\ben\bns\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The access and modification times of the file named by _\bp_\ba_\bt_\bh or referenced
+ by _\bf_\bd are changed as specified by the argument _\bt_\bi_\bm_\be_\bs.
+
+ If _\bt_\bi_\bm_\be_\bs is NULL, the access and modification times are set to the
+ current time. The caller must be the owner of the file, have permission
+ to write the file, or be the superuser.
+
+ If _\bt_\bi_\bm_\be_\bs is non-null, it is assumed to point to an array of two timeval
+ structures. The access time is set to the value of the first element,
+ and the modification time is set to the value of the second element. The
+ caller must be the owner of the file or be the superuser.
+
+ In either case, the inode-change-time of the file is set to the current
+ time.
+
+ The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() are equivalent to u\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\bes\bs(),
+ respectively, with the following differences.
+
+ Both u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() take two timespec values instead of two
+ timeval values. Further, either of the _\bt_\bv_\b__\bn_\bs_\be_\bc fields can be set to one
+ of the following special values defined in <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>:
+
+ UTIME_NOW Set the respective timestamp to the greatest value
+ supported that is not greater than the current time.
+ UTIME_OMIT Do not change the respective timestamp.
+
+ Additionally, if the _\bp_\ba_\bt_\bh argument to u\but\bti\bim\bme\ben\bns\bsa\bat\bt() specifies a relative
+ path, the file whose timestamps are changed is determined relative to the
+ directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If u\but\bti\bim\bme\ben\bns\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ timestamps of the symbolic link are changed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ u\but\bti\bim\bme\bes\bs() and u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix; or the _\bt_\bi_\bm_\be_\bs argument is NULL and the
+ effective user ID of the process does not match the
+ owner of the file, and is not the superuser, and write
+ access is denied.
+
+ [EFAULT] _\bf_\bi_\bl_\be or _\bt_\bi_\bm_\be_\bs points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+ Additionally, u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bf_\bi_\bl_\be argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfu\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\ben\bns\bs() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EACCES] The _\bt_\bi_\bm_\be_\bs argument is NULL and the effective user ID
+ of the process does not match the owner of the file,
+ and is not the superuser, and write access is denied.
+
+ [EFAULT] _\bt_\bi_\bm_\be_\bs points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), stat(2), utime(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\but\bti\bim\bme\bes\bs(), u\but\bti\bim\bme\ben\bns\bsa\bat\bt(), and f\bfu\but\bti\bim\bme\ben\bns\bs() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessors of u\but\bti\bim\bme\bes\bs() were s\bsm\bmd\bda\bat\bte\be() in Version 1 AT&T UNIX,
+ m\bmd\bda\bat\bte\be() in Version 3 AT&T UNIX, and u\but\bti\bim\bme\be() in Version 7 AT&T UNIX; the
+ latter first supported the concept of an access time in addition to the
+ modification time.
+
+ The u\but\bti\bim\bme\bes\bs() function call appeared in 4.2BSD. The f\bfu\but\bti\bim\bme\bes\bs() function
+ call appeared in NetBSD 1.2. The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() function
+ calls appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and
+ f\bfu\but\bti\bim\bme\ben\bns\bs() shall mark the last file status change timestamp (i.e.
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm) for update upon successful completion. However, currently some
+ filesystems (e.g. UFS) will not do so if UTIME_OMIT is specified for the
+ modification timestamp argument.
+
+N\bNA\bAM\bME\bE
+ u\but\bti\bim\bme\bes\bs, f\bfu\but\bti\bim\bme\bes\bs, u\but\bti\bim\bme\ben\bns\bsa\bat\bt, f\bfu\but\bti\bim\bme\ben\bns\bs - set file access and modification
+ times
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\bes\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\bes\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\ben\bns\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b],
+ _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\ben\bns\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The access and modification times of the file named by _\bp_\ba_\bt_\bh or referenced
+ by _\bf_\bd are changed as specified by the argument _\bt_\bi_\bm_\be_\bs.
+
+ If _\bt_\bi_\bm_\be_\bs is NULL, the access and modification times are set to the
+ current time. The caller must be the owner of the file, have permission
+ to write the file, or be the superuser.
+
+ If _\bt_\bi_\bm_\be_\bs is non-null, it is assumed to point to an array of two timeval
+ structures. The access time is set to the value of the first element,
+ and the modification time is set to the value of the second element. The
+ caller must be the owner of the file or be the superuser.
+
+ In either case, the inode-change-time of the file is set to the current
+ time.
+
+ The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() are equivalent to u\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\bes\bs(),
+ respectively, with the following differences.
+
+ Both u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() take two timespec values instead of two
+ timeval values. Further, either of the _\bt_\bv_\b__\bn_\bs_\be_\bc fields can be set to one
+ of the following special values defined in <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>:
+
+ UTIME_NOW Set the respective timestamp to the greatest value
+ supported that is not greater than the current time.
+ UTIME_OMIT Do not change the respective timestamp.
+
+ Additionally, if the _\bp_\ba_\bt_\bh argument to u\but\bti\bim\bme\ben\bns\bsa\bat\bt() specifies a relative
+ path, the file whose timestamps are changed is determined relative to the
+ directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If u\but\bti\bim\bme\ben\bns\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ timestamps of the symbolic link are changed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ u\but\bti\bim\bme\bes\bs() and u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix; or the _\bt_\bi_\bm_\be_\bs argument is NULL and the
+ effective user ID of the process does not match the
+ owner of the file, and is not the superuser, and write
+ access is denied.
+
+ [EFAULT] _\bf_\bi_\bl_\be or _\bt_\bi_\bm_\be_\bs points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+ Additionally, u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bf_\bi_\bl_\be argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfu\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\ben\bns\bs() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EACCES] The _\bt_\bi_\bm_\be_\bs argument is NULL and the effective user ID
+ of the process does not match the owner of the file,
+ and is not the superuser, and write access is denied.
+
+ [EFAULT] _\bt_\bi_\bm_\be_\bs points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), stat(2), utime(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\but\bti\bim\bme\bes\bs(), u\but\bti\bim\bme\ben\bns\bsa\bat\bt(), and f\bfu\but\bti\bim\bme\ben\bns\bs() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessors of u\but\bti\bim\bme\bes\bs() were s\bsm\bmd\bda\bat\bte\be() in Version 1 AT&T UNIX,
+ m\bmd\bda\bat\bte\be() in Version 3 AT&T UNIX, and u\but\bti\bim\bme\be() in Version 7 AT&T UNIX; the
+ latter first supported the concept of an access time in addition to the
+ modification time.
+
+ The u\but\bti\bim\bme\bes\bs() function call appeared in 4.2BSD. The f\bfu\but\bti\bim\bme\bes\bs() function
+ call appeared in NetBSD 1.2. The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() function
+ calls appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and
+ f\bfu\but\bti\bim\bme\ben\bns\bs() shall mark the last file status change timestamp (i.e.
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm) for update upon successful completion. However, currently some
+ filesystems (e.g. UFS) will not do so if UTIME_OMIT is specified for the
+ modification timestamp argument.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btd\bde\ben\bnt\bts\bs - get directory entries in a filesystem independent format
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<d\bdi\bir\bre\ben\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btd\bde\ben\bnt\bts\bs(_\bi_\bn_\bt _\bf_\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btd\bde\ben\bnt\bts\bs() reads directory entries from the directory referenced by the
+ file descriptor _\bf_\bd into the buffer pointed to by _\bb_\bu_\bf, in a filesystem
+ independent format. Up to _\bn_\bb_\by_\bt_\be_\bs of data will be transferred. _\bn_\bb_\by_\bt_\be_\bs
+ must be greater than or equal to the block size associated with the file
+ (see stat(2)). Some filesystems may not support g\bge\bet\btd\bde\ben\bnt\bts\bs() with buffers
+ smaller than this size.
+
+ The data in the buffer is a series of _\bd_\bi_\br_\be_\bn_\bt structures each containing
+ at least the following entries:
+
+ ino_t d_fileno;
+ off_t d_off;
+ u_int16_t d_reclen;
+ u_int8_t d_type;
+ u_int8_t d_namlen;
+ char d_name[MAXNAMLEN + 1]; /* see below */
+
+ The _\bd_\b__\bf_\bi_\bl_\be_\bn_\bo entry is a number which is unique for each distinct file in
+ the filesystem. Files that are linked by hard links (see link(2)) have
+ the same _\bd_\b__\bf_\bi_\bl_\be_\bn_\bo. The _\bd_\b__\bo_\bf_\bf entry is the file offset of the next entry.
+ The _\bd_\b__\br_\be_\bc_\bl_\be_\bn entry is the length, in bytes, of the directory record.
+
+ The _\bd_\b__\bt_\by_\bp_\be is the type of file, where the following are possible types:
+ DT_UNKNOWN, DT_FIFO, DT_CHR, DT_DIR, DT_BLK, DT_REG, DT_LNK, and DT_SOCK.
+
+ The _\bd_\b__\bn_\ba_\bm_\bl_\be_\bn entry specifies the length of the file name excluding the
+ NUL byte. Thus the actual size of _\bd_\b__\bn_\ba_\bm_\be may vary from 1 to MAXNAMLEN +
+ 1.
+
+ The _\bd_\b__\bn_\ba_\bm_\be entry contains a NUL-terminated file name.
+
+ Entries may be separated by extra space. The _\bd_\b__\br_\be_\bc_\bl_\be_\bn entry may be used
+ as an offset from the start of a _\bd_\bi_\br_\be_\bn_\bt structure to the next structure,
+ if any.
+
+ Invalid entries with _\bd_\b__\bf_\bi_\bl_\be_\bn_\bo set to 0 may be returned among regular
+ entries.
+
+ The actual number of bytes transferred is returned. The current position
+ pointer associated with _\bf_\bd is set to point to the next block of entries.
+ The pointer may not advance by the number of bytes returned by
+ g\bge\bet\btd\bde\ben\bnt\bts\bs().
+
+ The current position pointer may be set and retrieved by lseek(2). The
+ current position pointer should only be set to a value returned by
+ lseek(2), the value of _\bd_\b__\bo_\bf_\bf from an entry, or zero.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of bytes actually transferred is returned. A
+ value of zero is returned when the end of the directory has been reached.
+ Otherwise, -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btd\bde\ben\bnt\bts\bs() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid file descriptor open for reading.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ [EINVAL] The file referenced by _\bf_\bd is not a directory, or
+ _\bn_\bb_\by_\bt_\be_\bs is too small for returning a directory entry or
+ block of entries, or the current position pointer is
+ invalid.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ lseek(2), open(2), opendir(3), dirent(5)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btd\bde\ben\bnt\bts\bs() call is not a portable interface and should not be used
+ directly by applications. Use readdir(3) instead.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btd\bdi\bir\bre\ben\bnt\btr\bri\bie\bes\bs() function first appeared in 4.4BSD. In OpenBSD 5.5
+ the _\bd_\b__\bo_\bf_\bf entry was added to _\bs_\bt_\br_\bu_\bc_\bt _\bd_\bi_\br_\be_\bn_\bt and g\bge\bet\btd\bdi\bir\bre\ben\bnt\btr\bri\bie\bes\bs() was
+ replaced with g\bge\bet\btd\bde\ben\bnt\bts\bs().
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btd\bdt\bta\bab\bbl\ble\bec\bco\bou\bun\bnt\bt - get descriptor table count
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btd\bdt\bta\bab\bbl\ble\bec\bco\bou\bun\bnt\bt(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ k\bkq\bqu\bue\beu\bue\be returns the number of file descriptors the process currently has
+ open.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getrlimit(2), getdtablesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bkq\bqu\bue\beu\bue\be function appeared in OpenBSD 5.2.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btg\bgi\bid\bd, g\bge\bet\bte\beg\bgi\bid\bd - get group process identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bg_\bi_\bd_\b__\bt
+ g\bge\bet\btg\bgi\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bg_\bi_\bd_\b__\bt
+ g\bge\bet\bte\beg\bgi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btg\bgi\bid\bd() function returns the real group ID of the calling process
+ and the g\bge\bet\bte\beg\bgi\bid\bd() function returns the effective group ID of the calling
+ process.
+
+ The real group ID is specified at login time.
+
+ The real group ID is the group of the user who invoked the program. As
+ the effective group ID gives the process additional permissions during
+ the execution of ``_\bs_\be_\bt_\b-_\bg_\br_\bo_\bu_\bp_\b-_\bI_\bD'' mode processes, g\bge\bet\btg\bgi\bid\bd() is used to
+ determine the real group ID of the calling process.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The g\bge\bet\btg\bgi\bid\bd() and g\bge\bet\bte\beg\bgi\bid\bd() functions are always successful, and no return
+ value is reserved to indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgroups(2), getresgid(2), getuid(2), setgid(2), setregid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btg\bgi\bid\bd() and g\bge\bet\bte\beg\bgi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btg\bgi\bid\bd() system call first appeared in Version 4 AT&T UNIX, and
+ g\bge\bet\bte\beg\bgi\bid\bd() in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by - get entropy
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by(_\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by() fills a buffer with high-quality entropy, which can be used
+ as input for process-context pseudorandom generators like arc4random(3).
+
+ The maximum buffer size permitted is 256 bytes. If _\bb_\bu_\bf_\bl_\be_\bn exceeds this,
+ an error of EIO will be indicated.
+
+ g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by() is not intended for regular code; please use the
+ arc4random(3) family of functions instead.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by() will succeed unless:
+
+ [EFAULT] The _\bb_\bu_\bf parameter points to an invalid address.
+
+ [EIO] Too many bytes requested, or some other fatal error
+ occurred.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ arc4random(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by() function appeared in OpenBSD 5.6.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btu\bui\bid\bd, g\bge\bet\bte\beu\bui\bid\bd - get user identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bu_\bi_\bd_\b__\bt
+ g\bge\bet\btu\bui\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bu_\bi_\bd_\b__\bt
+ g\bge\bet\bte\beu\bui\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btu\bui\bid\bd() function returns the real user ID of the calling process.
+ The g\bge\bet\bte\beu\bui\bid\bd() function returns the effective user ID of the calling
+ process.
+
+ The real user ID is that of the user who has invoked the program. As the
+ effective user ID gives the process additional permissions during
+ execution of ``_\bs_\be_\bt_\b-_\bu_\bs_\be_\br_\b-_\bI_\bD'' mode processes, g\bge\bet\btu\bui\bid\bd() is used to
+ determine the real user ID of the calling process.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The g\bge\bet\btu\bui\bid\bd() and g\bge\bet\bte\beu\bui\bid\bd() functions are always successful, and no return
+ value is reserved to indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getresuid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btu\bui\bid\bd() and g\bge\bet\bte\beu\bui\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX, and
+ g\bge\bet\bte\beu\bui\bid\bd() in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btf\bfh\bh - get file handle
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btf\bfh\bh(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bf_\bh_\ba_\bn_\bd_\bl_\be_\b__\bt _\b*_\bf_\bh_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btf\bfh\bh() returns a file handle for the specified file or directory _\bp_\ba_\bt_\bh in
+ the file handle pointed to by _\bf_\bh_\bp. This system call is restricted to the
+ superuser.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btf\bfh\bh() fails if one or more of the following are true:
+
+ [ENOTDIR] A component of the path prefix of _\bp_\ba_\bt_\bh is not a
+ directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The file referred to by _\bp_\ba_\bt_\bh does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix of _\bp_\ba_\bt_\bh.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating _\bp_\ba_\bt_\bh.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EFAULT] _\bf_\bh_\bp or _\bp_\ba_\bt_\bh points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EINVAL] A portion of _\bp_\ba_\bt_\bh refers to a remote file system.
+
+ [EOPNOTSUPP] A portion of _\bp_\ba_\bt_\bh refers to a remote file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fhstat(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btf\bfh\bh() function first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btf\bfs\bss\bst\bta\bat\bt - get list of all mounted file systems
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btf\bfs\bss\bst\bta\bat\bt(_\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bs_\bi_\bz_\be, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() returns information about all mounted file systems. _\bb_\bu_\bf is a
+ pointer to an array of statfs(2) structures defined as follows:
+
+ typedef struct { int32_t val[2]; } fsid_t;
+
+ #define MFSNAMELEN 16 /* length of fs type name, including nul */
+ #define MNAMELEN 90 /* length of buffer for returned name */
+
+ struct statfs {
+ u_int32_t f_flags; /* copy of mount flags */
+ u_int32_t f_bsize; /* file system block size */
+ u_int32_t f_iosize; /* optimal transfer block size */
+
+ /* unit is f_bsize */
+ u_int64_t f_blocks; /* total data blocks in file system */
+ u_int64_t f_bfree; /* free blocks in fs */
+ int64_t f_bavail; /* free blocks avail to non-superuser */
+
+ u_int64_t f_files; /* total file nodes in file system */
+ u_int64_t f_ffree; /* free file nodes in fs */
+ int64_t f_favail; /* free file nodes avail to non-root */
+
+ u_int64_t f_syncwrites; /* count of sync writes since mount */
+ u_int64_t f_syncreads; /* count of sync reads since mount */
+ u_int64_t f_asyncwrites; /* count of async writes since mount */
+ u_int64_t f_asyncreads; /* count of async reads since mount */
+
+ fsid_t f_fsid; /* file system id */
+ u_int32_t f_namemax; /* maximum filename length */
+ uid_t f_owner; /* user that mounted the file system */
+ u_int64_t f_ctime; /* last mount [-u] time */
+
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN]; /* mounted file system */
+ char f_mntfromspec[MNAMELEN]; /* special for mount request */
+ union mount_info mount_info; /* per-filesystem mount options */
+ };
+
+ The buffer is filled with an array of _\bs_\bt_\ba_\bt_\bf_\bs structures, one for each
+ mounted file system up to the size specified by _\bb_\bu_\bf_\bs_\bi_\bz_\be.
+
+ If _\bb_\bu_\bf is NULL, g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() returns just the number of mounted file
+ systems.
+
+ Normally _\bf_\bl_\ba_\bg_\bs should be specified as MNT_WAIT. If _\bf_\bl_\ba_\bg_\bs is set to
+ MNT_NOWAIT, g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() will return the information it has available
+ without requesting an update from each file system. Thus, some of the
+ information will be out of date, but g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() will not block waiting
+ for information from a file system that is unable to respond. If no
+ flags are provided, MNT_WAIT is assumed.
+
+ Note that _\bf_\b__\bf_\bs_\bi_\bd will be empty unless the user is the superuser.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the number of _\bs_\bt_\ba_\bt_\bf_\bs structures is returned.
+ Otherwise, -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() fails if one or more of the following are true:
+
+ [EFAULT] _\bb_\bu_\bf points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ statfs(2), fstab(5), mount(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btf\bfs\bss\bst\bta\bat\bt() function first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btg\bgi\bid\bd, g\bge\bet\bte\beg\bgi\bid\bd - get group process identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bg_\bi_\bd_\b__\bt
+ g\bge\bet\btg\bgi\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bg_\bi_\bd_\b__\bt
+ g\bge\bet\bte\beg\bgi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btg\bgi\bid\bd() function returns the real group ID of the calling process
+ and the g\bge\bet\bte\beg\bgi\bid\bd() function returns the effective group ID of the calling
+ process.
+
+ The real group ID is specified at login time.
+
+ The real group ID is the group of the user who invoked the program. As
+ the effective group ID gives the process additional permissions during
+ the execution of ``_\bs_\be_\bt_\b-_\bg_\br_\bo_\bu_\bp_\b-_\bI_\bD'' mode processes, g\bge\bet\btg\bgi\bid\bd() is used to
+ determine the real group ID of the calling process.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The g\bge\bet\btg\bgi\bid\bd() and g\bge\bet\bte\beg\bgi\bid\bd() functions are always successful, and no return
+ value is reserved to indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgroups(2), getresgid(2), getuid(2), setgid(2), setregid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btg\bgi\bid\bd() and g\bge\bet\bte\beg\bgi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btg\bgi\bid\bd() system call first appeared in Version 4 AT&T UNIX, and
+ g\bge\bet\bte\beg\bgi\bid\bd() in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btg\bgr\bro\bou\bup\bps\bs - get group access list
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btg\bgr\bro\bou\bup\bps\bs(_\bi_\bn_\bt _\bg_\bi_\bd_\bs_\be_\bt_\bl_\be_\bn, _\bg_\bi_\bd_\b__\bt _\b*_\bg_\bi_\bd_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() gets the current group access list of the current user
+ process and stores it in the array _\bg_\bi_\bd_\bs_\be_\bt. The parameter _\bg_\bi_\bd_\bs_\be_\bt_\bl_\be_\bn
+ indicates the number of entries that may be placed in _\bg_\bi_\bd_\bs_\be_\bt.
+ g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() returns the actual number of groups returned in _\bg_\bi_\bd_\bs_\be_\bt. No
+ more than {NGROUPS_MAX} will ever be returned. If _\bg_\bi_\bd_\bs_\be_\bt_\bl_\be_\bn is 0,
+ g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() returns the number of groups without modifying the _\bg_\bi_\bd_\bs_\be_\bt
+ array.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ A successful call returns the number of groups in the group set. A value
+ of -1 indicates that an error occurred, and the error code is stored in
+ the global variable _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The possible errors for g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() are:
+
+ [EINVAL] The argument _\bg_\bi_\bd_\bs_\be_\bt_\bl_\be_\bn is smaller than the number of
+ groups in the group set.
+
+ [EFAULT] The argument _\bg_\bi_\bd_\bs_\be_\bt specifies an invalid address.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), setgid(2), setgroups(2), initgroups(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btg\bgr\bro\bou\bup\bps\bs() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br, s\bse\bet\bti\bit\bti\bim\bme\ber\br - get/set value of interval timer
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_R\bRE\bEA\bAL\bL 0\b0
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_V\bVI\bIR\bRT\bTU\bUA\bAL\bL 1\b1
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_P\bPR\bRO\bOF\bF 2\b2
+
+ _\bi_\bn_\bt
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bv_\ba_\bl_\bu_\be);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bti\bit\bti\bim\bme\ber\br(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bv_\ba_\bl_\bu_\be,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bo_\bv_\ba_\bl_\bu_\be);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\brc\bcl\ble\bea\bar\br(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*);
+
+ _\bi_\bn_\bt
+ t\bti\bim\bme\ber\bri\bis\bss\bse\bet\bt(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*);
+
+ _\bi_\bn_\bt
+ t\bti\bim\bme\ber\brc\bcm\bmp\bp(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bC_\bM_\bP);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\brs\bsu\bub\bb(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\br_\be_\bs);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\bra\bad\bdd\bd(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\br_\be_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The system provides each process with three interval timers, defined in
+ <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>. The g\bge\bet\bti\bit\bti\bim\bme\ber\br() call returns the current value for the
+ timer specified in _\bw_\bh_\bi_\bc_\bh in the structure at _\bv_\ba_\bl_\bu_\be. The s\bse\bet\bti\bit\bti\bim\bme\ber\br() call
+ sets a timer to the specified _\bv_\ba_\bl_\bu_\be (returning the previous value of the
+ timer if _\bo_\bv_\ba_\bl_\bu_\be is non-null).
+
+ A timer value is defined by the _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl structure:
+
+ struct itimerval {
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+ };
+
+ If _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be is non-zero, it indicates the time to the next timer
+ expiration. If _\bi_\bt_\b__\bi_\bn_\bt_\be_\br_\bv_\ba_\bl is non-zero, it specifies a value to be used
+ in reloading _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be when the timer expires. Setting _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be to 0
+ disables a timer. Setting _\bi_\bt_\b__\bi_\bn_\bt_\be_\br_\bv_\ba_\bl to 0 causes a timer to be disabled
+ after its next expiration (assuming _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be is non-zero).
+
+ Time values smaller than the resolution of the system clock are rounded
+ up to this resolution (typically 10 milliseconds).
+
+ The ITIMER_REAL timer decrements in real time. A SIGALRM signal is
+ delivered when this timer expires.
+
+ The ITIMER_VIRTUAL timer decrements in process virtual time. It runs
+ only when the process is executing. A SIGVTALRM signal is delivered when
+ it expires.
+
+ The ITIMER_PROF timer decrements both in process virtual time and when
+ the system is running on behalf of the process. It is designed to be
+ used by interpreters in statistically profiling the execution of
+ interpreted programs. Each time the ITIMER_PROF timer expires, the
+ SIGPROF signal is delivered. Because this signal may interrupt in-
+ progress system calls, programs using this timer must be prepared to
+ restart interrupted system calls.
+
+ The remaining five functions are in fact macros for manipulating time
+ values, defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>.
+
+ t\bti\bim\bme\ber\brc\bcl\ble\bea\bar\br(_\ba) sets the time value in _\ba to zero.
+
+ t\bti\bim\bme\ber\bri\bis\bss\bse\bet\bt(_\ba) tests if the time value in _\ba is non-zero.
+
+ t\bti\bim\bme\ber\brc\bcm\bmp\bp(_\ba, _\bb, _\bC_\bM_\bP) compares two time values in the form _\ba CMP _\bb, where
+ _\bC_\bM_\bP is <, <=, ==, !=, >=, or > .
+
+ t\bti\bim\bme\ber\brs\bsu\bub\bb(_\ba, _\bb, _\br_\be_\bs) subtracts _\ba - _\bb and stores the result in _\br_\be_\bs.
+
+ t\bti\bim\bme\ber\bra\bad\bdd\bd(_\ba, _\bb, _\br_\be_\bs) adds two timers and stores the result in _\br_\be_\bs.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() will fail if:
+
+ [EFAULT] The _\bv_\ba_\bl_\bu_\be parameter specified a bad address.
+
+ [EINVAL] An unrecognized value for _\bw_\bh_\bi_\bc_\bh was specified.
+
+ In addition, s\bse\bet\bti\bit\bti\bim\bme\ber\br() may return the following error:
+
+ [EINVAL] _\bv_\ba_\bl_\bu_\be or _\bo_\bv_\ba_\bl_\bu_\be specified a time that was too large to
+ be handled.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), gettimeofday(2), poll(2), select(2), sigaction(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() system calls first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btl\blo\bog\bgi\bin\bn, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br, s\bse\bet\btl\blo\bog\bgi\bin\bn - get/set login name
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bc_\bh_\ba_\br _\b*
+ g\bge\bet\btl\blo\bog\bgi\bin\bn(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bi_\bz_\be_\b__\bt _\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btl\blo\bog\bgi\bin\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() routine returns the login name of the user associated with
+ the current session, as previously set by s\bse\bet\btl\blo\bog\bgi\bin\bn(). The name is
+ normally associated with a login shell at the time a session is created,
+ and is inherited by all processes descended from the login shell. (This
+ is true even if some of those processes assume another user ID, for
+ example when su(1) is used.)
+
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() routine is a reentrant version of g\bge\bet\btl\blo\bog\bgi\bin\bn(). It is
+ functionally identical to g\bge\bet\btl\blo\bog\bgi\bin\bn() except that the caller must provide
+ a buffer, _\bn_\ba_\bm_\be, in which to store the user's login name and a
+ corresponding length parameter, _\bn_\ba_\bm_\be_\bl_\be_\bn, that specifies the size of the
+ buffer. The buffer should be large enough to store the login name and a
+ trailing NUL (typically LOGIN_NAME_MAX bytes).
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() sets the login name of the user associated with the current
+ session to _\bn_\ba_\bm_\be. This call is restricted to the superuser, and is
+ normally used only when a new session is being created on behalf of the
+ named user (for example, at login time, or when a remote shell is
+ invoked).
+
+ _\bN_\bO_\bT_\bE: There is only one login name per session.
+
+ It is _\bC_\bR_\bI_\bT_\bI_\bC_\bA_\bL_\bL_\bY important to ensure that s\bse\bet\btl\blo\bog\bgi\bin\bn() is only ever called
+ after the process has taken adequate steps to ensure that it is detached
+ from its parent's session. The _\bO_\bN_\bL_\bY way to do this is via the s\bse\bet\bts\bsi\bid\bd()
+ function. The d\bda\bae\bem\bmo\bon\bn() function calls s\bse\bet\bts\bsi\bid\bd() which is an ideal way of
+ detaching from a controlling terminal and forking into the background.
+
+ In particular, neither i\bio\boc\bct\btl\bl(_\bt_\bt_\by_\bf_\bd, _\bT_\bI_\bO_\bC_\bN_\bO_\bT_\bT_\bY, _\b._\b._\b.) nor s\bse\bet\btp\bpg\bgr\brp\bp(_\b._\b._\b.) is
+ sufficient to create a new session.
+
+ Once a parent process has called s\bse\bet\bts\bsi\bid\bd(), it is acceptable for some
+ child of that process to then call s\bse\bet\btl\blo\bog\bgi\bin\bn(), even though it is not the
+ session leader. Beware, however, that _\bA_\bL_\bL processes in the session will
+ change their login name at the same time, even the parent.
+
+ This is different from traditional UNIX privilege inheritance and as such
+ can be counter-intuitive.
+
+ Since the s\bse\bet\btl\blo\bog\bgi\bin\bn() routine is restricted to the super-user, it is
+ assumed that (like all other privileged programs) the programmer has
+ taken adequate precautions to prevent security violations.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn() succeeds, it returns a pointer to a NUL-
+ terminated string in a static buffer. If the name has not been set, it
+ returns NULL. If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() succeeds, a value of 0 is
+ returned, else the error number is returned. If a call to s\bse\bet\btl\blo\bog\bgi\bin\bn()
+ succeeds, a value of 0 is returned. If s\bse\bet\btl\blo\bog\bgi\bin\bn() fails, a value of -1
+ is returned and an error code is placed in the global location _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() and s\bse\bet\btl\blo\bog\bgi\bin\bn() will succeed unless:
+
+ [EFAULT] The _\bn_\ba_\bm_\be parameter points to an invalid address.
+
+ In addition, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() may return the following error:
+
+ [ERANGE] The value of _\bn_\ba_\bm_\be_\bl_\be_\bn is not large enough to store the
+ user's login name and a trailing NUL.
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() may return the following errors:
+
+ [EINVAL] The _\bn_\ba_\bm_\be parameter pointed to a string that was too
+ long. Login names are limited to LOGIN_NAME_MAX-1
+ characters, currently 31.
+
+ [EPERM] The caller tried to set the login name and was not the
+ superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ setsid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() and g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() function first appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ In earlier versions of the system, g\bge\bet\btl\blo\bog\bgi\bin\bn() failed unless the process
+ was associated with a login terminal. The current implementation (using
+ s\bse\bet\btl\blo\bog\bgi\bin\bn()) allows getlogin to succeed even when the process has no
+ controlling terminal. In earlier versions of the system, the value
+ returned by g\bge\bet\btl\blo\bog\bgi\bin\bn() could not be trusted without checking the user ID.
+ Portable programs should probably still make this check.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btl\blo\bog\bgi\bin\bn, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br, s\bse\bet\btl\blo\bog\bgi\bin\bn - get/set login name
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bc_\bh_\ba_\br _\b*
+ g\bge\bet\btl\blo\bog\bgi\bin\bn(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bi_\bz_\be_\b__\bt _\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btl\blo\bog\bgi\bin\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() routine returns the login name of the user associated with
+ the current session, as previously set by s\bse\bet\btl\blo\bog\bgi\bin\bn(). The name is
+ normally associated with a login shell at the time a session is created,
+ and is inherited by all processes descended from the login shell. (This
+ is true even if some of those processes assume another user ID, for
+ example when su(1) is used.)
+
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() routine is a reentrant version of g\bge\bet\btl\blo\bog\bgi\bin\bn(). It is
+ functionally identical to g\bge\bet\btl\blo\bog\bgi\bin\bn() except that the caller must provide
+ a buffer, _\bn_\ba_\bm_\be, in which to store the user's login name and a
+ corresponding length parameter, _\bn_\ba_\bm_\be_\bl_\be_\bn, that specifies the size of the
+ buffer. The buffer should be large enough to store the login name and a
+ trailing NUL (typically LOGIN_NAME_MAX bytes).
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() sets the login name of the user associated with the current
+ session to _\bn_\ba_\bm_\be. This call is restricted to the superuser, and is
+ normally used only when a new session is being created on behalf of the
+ named user (for example, at login time, or when a remote shell is
+ invoked).
+
+ _\bN_\bO_\bT_\bE: There is only one login name per session.
+
+ It is _\bC_\bR_\bI_\bT_\bI_\bC_\bA_\bL_\bL_\bY important to ensure that s\bse\bet\btl\blo\bog\bgi\bin\bn() is only ever called
+ after the process has taken adequate steps to ensure that it is detached
+ from its parent's session. The _\bO_\bN_\bL_\bY way to do this is via the s\bse\bet\bts\bsi\bid\bd()
+ function. The d\bda\bae\bem\bmo\bon\bn() function calls s\bse\bet\bts\bsi\bid\bd() which is an ideal way of
+ detaching from a controlling terminal and forking into the background.
+
+ In particular, neither i\bio\boc\bct\btl\bl(_\bt_\bt_\by_\bf_\bd, _\bT_\bI_\bO_\bC_\bN_\bO_\bT_\bT_\bY, _\b._\b._\b.) nor s\bse\bet\btp\bpg\bgr\brp\bp(_\b._\b._\b.) is
+ sufficient to create a new session.
+
+ Once a parent process has called s\bse\bet\bts\bsi\bid\bd(), it is acceptable for some
+ child of that process to then call s\bse\bet\btl\blo\bog\bgi\bin\bn(), even though it is not the
+ session leader. Beware, however, that _\bA_\bL_\bL processes in the session will
+ change their login name at the same time, even the parent.
+
+ This is different from traditional UNIX privilege inheritance and as such
+ can be counter-intuitive.
+
+ Since the s\bse\bet\btl\blo\bog\bgi\bin\bn() routine is restricted to the super-user, it is
+ assumed that (like all other privileged programs) the programmer has
+ taken adequate precautions to prevent security violations.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn() succeeds, it returns a pointer to a NUL-
+ terminated string in a static buffer. If the name has not been set, it
+ returns NULL. If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() succeeds, a value of 0 is
+ returned, else the error number is returned. If a call to s\bse\bet\btl\blo\bog\bgi\bin\bn()
+ succeeds, a value of 0 is returned. If s\bse\bet\btl\blo\bog\bgi\bin\bn() fails, a value of -1
+ is returned and an error code is placed in the global location _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() and s\bse\bet\btl\blo\bog\bgi\bin\bn() will succeed unless:
+
+ [EFAULT] The _\bn_\ba_\bm_\be parameter points to an invalid address.
+
+ In addition, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() may return the following error:
+
+ [ERANGE] The value of _\bn_\ba_\bm_\be_\bl_\be_\bn is not large enough to store the
+ user's login name and a trailing NUL.
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() may return the following errors:
+
+ [EINVAL] The _\bn_\ba_\bm_\be parameter pointed to a string that was too
+ long. Login names are limited to LOGIN_NAME_MAX-1
+ characters, currently 31.
+
+ [EPERM] The caller tried to set the login name and was not the
+ superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ setsid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() and g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() function first appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ In earlier versions of the system, g\bge\bet\btl\blo\bog\bgi\bin\bn() failed unless the process
+ was associated with a login terminal. The current implementation (using
+ s\bse\bet\btl\blo\bog\bgi\bin\bn()) allows getlogin to succeed even when the process has no
+ controlling terminal. In earlier versions of the system, the value
+ returned by g\bge\bet\btl\blo\bog\bgi\bin\bn() could not be trusted without checking the user ID.
+ Portable programs should probably still make this check.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be - get name of connected peer
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be() returns the address information of the peer connected to
+ socket _\bs. One common use occurs when a process inherits an open socket,
+ such as TCP servers forked from inetd(8). In this scenario,
+ g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be() is used to determine the connecting client's IP address.
+
+ g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be() takes three parameters:
+
+ _\bs contains the file descriptor of the socket whose peer should be looked
+ up.
+
+ _\bn_\ba_\bm_\be points to a sockaddr structure that will hold the address
+ information for the connected peer. Normal use requires one to use a
+ structure specific to the protocol family in use, such as sockaddr_in
+ (IPv4) or sockaddr_in6 (IPv6), cast to a (struct sockaddr *).
+
+ For greater portability, especially with the newer protocol families, the
+ new struct sockaddr_storage should be used. sockaddr_storage is large
+ enough to hold any of the other sockaddr_* variants. On return, it can
+ be cast to the correct sockaddr type, based on the protocol family
+ contained in its ss_family field.
+
+ _\bn_\ba_\bm_\be_\bl_\be_\bn indicates the amount of space pointed to by _\bn_\ba_\bm_\be, in bytes.
+
+ If address information for the local end of the socket is required, the
+ getsockname(2) function should be used instead.
+
+ If _\bn_\ba_\bm_\be does not point to enough space to hold the entire socket address,
+ the result will be truncated to _\bn_\ba_\bm_\be_\bl_\be_\bn bytes.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the call succeeds, a 0 is returned and _\bn_\ba_\bm_\be_\bl_\be_\bn is set to the actual
+ size of the socket address returned in _\bn_\ba_\bm_\be. Otherwise, _\be_\br_\br_\bn_\bo is set and
+ a value of -1 is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ On failure, _\be_\br_\br_\bn_\bo is set to one of the following:
+
+ [EBADF] The argument _\bs is not a valid descriptor.
+
+ [ENOTSOCK] The argument _\bs is a file, not a socket.
+
+ [ENOTCONN] The socket is not connected.
+
+ [ENOBUFS] Insufficient resources were available in the system to
+ perform the operation.
+
+ [EFAULT] The _\bn_\ba_\bm_\be or _\bn_\ba_\bm_\be_\bl_\be_\bn parameter points to memory not in
+ a valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), bind(2), getsockname(2), socket(2), getpeereid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be() function conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpg\bgr\brp\bp, g\bge\bet\btp\bpg\bgi\bid\bd - get process group
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpg\bgr\brp\bp(_\bv_\bo_\bi_\bd);
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpg\bgi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The process group of the current process is returned by g\bge\bet\btp\bpg\bgr\brp\bp(). The
+ process group of the _\bp_\bi_\bd process is returned by g\bge\bet\btp\bpg\bgi\bid\bd(). If _\bp_\bi_\bd is
+ zero, g\bge\bet\btp\bpg\bgi\bid\bd() returns the process group of the current process.
+
+ Process groups are used for distribution of signals, and by terminals to
+ arbitrate requests for their input: processes that have the same process
+ group as the terminal are foreground and may read, while others will
+ block with a signal if they attempt to read.
+
+ These calls are thus used by programs such as csh(1) to create process
+ groups in implementing job control. The t\btc\bcg\bge\bet\btp\bpg\bgr\brp\bp() and t\btc\bcs\bse\bet\btp\bpg\bgr\brp\bp()
+ calls are used to get/set the process group of the control terminal.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btp\bpg\bgr\brp\bp() always succeeds, however g\bge\bet\btp\bpg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The current process and the process _\bp_\bi_\bd are not in the
+ same session.
+
+ [ESRCH] There is no process with a process ID equal to _\bp_\bi_\bd.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ setpgid(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btp\bpg\bgr\brp\bp() and g\bge\bet\btp\bpg\bgi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A g\bge\bet\btp\bpg\bgr\brp\bp() function call that took a _\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd argument appeared in
+ 4.0BSD. This version, without an argument, is derived from its usage in
+ System V Release 4, and first appeared in NetBSD 0.9.
+
+ The g\bge\bet\btp\bpg\bgi\bid\bd() function call is derived from its usage in System V Release
+ 4, and first appeared in NetBSD 1.2a.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpg\bgr\brp\bp, g\bge\bet\btp\bpg\bgi\bid\bd - get process group
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpg\bgr\brp\bp(_\bv_\bo_\bi_\bd);
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpg\bgi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The process group of the current process is returned by g\bge\bet\btp\bpg\bgr\brp\bp(). The
+ process group of the _\bp_\bi_\bd process is returned by g\bge\bet\btp\bpg\bgi\bid\bd(). If _\bp_\bi_\bd is
+ zero, g\bge\bet\btp\bpg\bgi\bid\bd() returns the process group of the current process.
+
+ Process groups are used for distribution of signals, and by terminals to
+ arbitrate requests for their input: processes that have the same process
+ group as the terminal are foreground and may read, while others will
+ block with a signal if they attempt to read.
+
+ These calls are thus used by programs such as csh(1) to create process
+ groups in implementing job control. The t\btc\bcg\bge\bet\btp\bpg\bgr\brp\bp() and t\btc\bcs\bse\bet\btp\bpg\bgr\brp\bp()
+ calls are used to get/set the process group of the control terminal.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btp\bpg\bgr\brp\bp() always succeeds, however g\bge\bet\btp\bpg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The current process and the process _\bp_\bi_\bd are not in the
+ same session.
+
+ [ESRCH] There is no process with a process ID equal to _\bp_\bi_\bd.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ setpgid(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btp\bpg\bgr\brp\bp() and g\bge\bet\btp\bpg\bgi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A g\bge\bet\btp\bpg\bgr\brp\bp() function call that took a _\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd argument appeared in
+ 4.0BSD. This version, without an argument, is derived from its usage in
+ System V Release 4, and first appeared in NetBSD 0.9.
+
+ The g\bge\bet\btp\bpg\bgi\bid\bd() function call is derived from its usage in System V Release
+ 4, and first appeared in NetBSD 1.2a.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpi\bid\bd, g\bge\bet\btp\bpp\bpi\bid\bd - get parent or calling process identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpi\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpp\bpi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btp\bpi\bid\bd() returns the process ID of the calling process. Though the ID is
+ guaranteed to be unique, it should _\bN_\bO_\bT be used for constructing temporary
+ file names; see mkstemp(3) instead.
+
+ g\bge\bet\btp\bpp\bpi\bid\bd() returns the process ID of the parent of the calling process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ These functions are always successful, and no return value is reserved to
+ indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ gethostid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ g\bge\bet\btp\bpi\bid\bd() and g\bge\bet\btp\bpp\bpi\bid\bd() conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpi\bid\bd, g\bge\bet\btp\bpp\bpi\bid\bd - get parent or calling process identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpi\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btp\bpp\bpi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btp\bpi\bid\bd() returns the process ID of the calling process. Though the ID is
+ guaranteed to be unique, it should _\bN_\bO_\bT be used for constructing temporary
+ file names; see mkstemp(3) instead.
+
+ g\bge\bet\btp\bpp\bpi\bid\bd() returns the process ID of the parent of the calling process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ These functions are always successful, and no return value is reserved to
+ indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ gethostid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ g\bge\bet\btp\bpi\bid\bd() and g\bge\bet\btp\bpp\bpi\bid\bd() conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by, s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by - get/set process scheduling priority
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bi_\bd_\b__\bt _\bw_\bh_\bo);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bi_\bd_\b__\bt _\bw_\bh_\bo, _\bi_\bn_\bt _\bp_\br_\bi_\bo);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The scheduling priority of the process, process group, or user, as
+ indicated by _\bw_\bh_\bi_\bc_\bh and _\bw_\bh_\bo is obtained with the g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call and
+ set with the s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call. _\bw_\bh_\bi_\bc_\bh is one of PRIO_PROCESS,
+ PRIO_PGRP, or PRIO_USER, and _\bw_\bh_\bo is interpreted relative to _\bw_\bh_\bi_\bc_\bh (a
+ process identifier for PRIO_PROCESS, process group identifier for
+ PRIO_PGRP, and a user ID for PRIO_USER). A zero value of _\bw_\bh_\bo denotes the
+ current process, process group, or user. _\bp_\br_\bi_\bo is a value in the range
+ -20 to 20. The default priority is 0; lower priorities cause more
+ favorable scheduling.
+
+ The g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call returns the highest priority (lowest numerical
+ value) enjoyed by any of the specified processes. The s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call
+ sets the priorities of all of the specified processes to the specified
+ value. Priority values outside the range -20 to 20 are truncated to the
+ appropriate limit. Only the superuser may lower priorities.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Since g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() can legitimately return the value -1, it is necessary
+ to clear the external variable _\be_\br_\br_\bn_\bo prior to the call, then check it
+ afterward to determine if a -1 is an error or a legitimate value. The
+ s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call returns 0 if there is no error, or -1 if there is.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() will fail if:
+
+ [ESRCH] No process was located using the _\bw_\bh_\bi_\bc_\bh and _\bw_\bh_\bo values
+ specified.
+
+ [EINVAL] _\bw_\bh_\bi_\bc_\bh was not one of PRIO_PROCESS, PRIO_PGRP, or
+ PRIO_USER.
+
+ In addition, s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() will fail if:
+
+ [EPERM] A process was located, but neither its effective nor
+ real user ID matched the effective user ID of the
+ caller.
+
+ [EACCES] A non-superuser attempted to lower a process priority.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ nice(1), fork(2), renice(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former n\bni\bic\bce\be() system call,
+ appeared in Version 3 AT&T UNIX and was removed in 4.3BSD-Reno. The
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() system calls appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd, g\bge\bet\btr\bre\bes\bsu\bui\bid\bd, s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd, s\bse\bet\btr\bre\bes\bsu\bui\bid\bd - get or set real, effective
+ and saved user or group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\b*_\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\b*_\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\bs_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\bs_\bu_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btr\bre\bes\bsu\bui\bid\bd() function sets the real, effective and saved user IDs of
+ the current process. The analogous s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd() sets the real, effective
+ and saved group IDs.
+
+ Privileged processes may set these IDs to arbitrary values. Unprivileged
+ processes are restricted in that each of the new IDs must match one of
+ the current IDs.
+
+ Passing -1 as an argument causes the corresponding value to remain
+ unchanged.
+
+ The g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() and g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() calls retrieve the real, effective, and
+ saved group and user IDs of the current process, respectively.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The calling process was not privileged and tried to
+ change one or more IDs to a value which was not the
+ current real ID, the current effective ID nor the
+ current saved ID.
+
+ [EFAULT] An address passed to g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() or g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() was
+ invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getegid(2), geteuid(2), getgid(2), getuid(2), issetugid(2), setgid(2),
+ setregid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ These functions are not part of the IEEE Std 1003.1 (``POSIX.1'')
+ specification. While they are not completely portable, they are the
+ least ambiguous way to manage user and group IDs.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions first appeared in HP-UX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd, g\bge\bet\btr\bre\bes\bsu\bui\bid\bd, s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd, s\bse\bet\btr\bre\bes\bsu\bui\bid\bd - get or set real, effective
+ and saved user or group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\b*_\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\b*_\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\bs_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\bs_\bu_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btr\bre\bes\bsu\bui\bid\bd() function sets the real, effective and saved user IDs of
+ the current process. The analogous s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd() sets the real, effective
+ and saved group IDs.
+
+ Privileged processes may set these IDs to arbitrary values. Unprivileged
+ processes are restricted in that each of the new IDs must match one of
+ the current IDs.
+
+ Passing -1 as an argument causes the corresponding value to remain
+ unchanged.
+
+ The g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() and g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() calls retrieve the real, effective, and
+ saved group and user IDs of the current process, respectively.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The calling process was not privileged and tried to
+ change one or more IDs to a value which was not the
+ current real ID, the current effective ID nor the
+ current saved ID.
+
+ [EFAULT] An address passed to g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() or g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() was
+ invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getegid(2), geteuid(2), getgid(2), getuid(2), issetugid(2), setgid(2),
+ setregid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ These functions are not part of the IEEE Std 1003.1 (``POSIX.1'')
+ specification. While they are not completely portable, they are the
+ least ambiguous way to manage user and group IDs.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions first appeared in HP-UX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt, s\bse\bet\btr\brl\bli\bim\bmi\bit\bt - control maximum system resource consumption
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt(_\bi_\bn_\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bl_\bi_\bm_\bi_\bt _\b*_\br_\bl_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\brl\bli\bim\bmi\bit\bt(_\bi_\bn_\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\br_\bl_\bi_\bm_\bi_\bt _\b*_\br_\bl_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ Limits on the consumption of system resources by the current process and
+ each process it creates may be obtained with the g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() call, and
+ set with the s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() call.
+
+ The _\br_\be_\bs_\bo_\bu_\br_\bc_\be parameter is one of the following:
+
+ RLIMIT_CORE The largest size (in bytes) _\bc_\bo_\br_\be file that may be
+ created.
+
+ RLIMIT_CPU The maximum amount of CPU time (in seconds) to be used by
+ each process.
+
+ RLIMIT_DATA The maximum size (in bytes) of the data segment for a
+ process; this includes memory allocated via malloc(3) and
+ all other anonymous memory mapped via mmap(2).
+
+ RLIMIT_FSIZE The largest size (in bytes) file that may be created.
+
+ RLIMIT_MEMLOCK The maximum size (in bytes) which a process may lock into
+ memory using the mlock(2) function.
+
+ RLIMIT_NOFILE The maximum number of open files for this process.
+
+ RLIMIT_NPROC The maximum number of simultaneous processes for this
+ user id.
+
+ RLIMIT_RSS The maximum size (in bytes) to which a process's resident
+ set size may grow. This imposes a limit on the amount of
+ physical memory to be given to a process; if memory is
+ tight, the system will prefer to take memory from
+ processes that are exceeding their declared resident set
+ size.
+
+ RLIMIT_STACK The maximum size (in bytes) of the stack segment for a
+ process, which defines how far a process's stack segment
+ may be extended. Stack extension is performed
+ automatically by the system, and is only used by the main
+ thread of a process.
+
+ A resource limit is specified as a soft limit and a hard limit. When a
+ soft limit is exceeded a process may receive a signal (for example, if
+ the CPU time or file size is exceeded), but it will be allowed to
+ continue execution until it reaches the hard limit (or modifies its
+ resource limit). The _\br_\bl_\bi_\bm_\bi_\bt structure is used to specify the hard and
+ soft limits on a resource,
+
+ struct rlimit {
+ rlim_t rlim_cur; /* current (soft) limit */
+ rlim_t rlim_max; /* hard limit */
+ };
+
+ Only the superuser may raise the maximum limits. Other users may only
+ alter _\br_\bl_\bi_\bm_\b__\bc_\bu_\br within the range from 0 to _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx or (irreversibly)
+ lower _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx.
+
+ An ``infinite'' value for a limit is defined as RLIM_INFINITY.
+
+ A value of RLIM_SAVED_CUR or RLIM_SAVED_MAX will be stored in _\br_\bl_\bi_\bm_\b__\bc_\bu_\br or
+ _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx respectively by g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() if the value for the current or
+ maximum resource limit cannot be stored in an rlim_t. The values
+ RLIM_SAVED_CUR and RLIM_SAVED_MAX should not be used in a call to
+ s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() unless they were returned by a previous call to g\bge\bet\btr\brl\bli\bim\bmi\bit\bt().
+
+ Because this information is stored in the per-process information, this
+ system call must be executed directly by the shell if it is to affect all
+ future processes created by the shell; l\bli\bim\bmi\bit\bt is thus a built-in command
+ to csh(1) and u\bul\bli\bim\bmi\bit\bt is the sh(1) equivalent.
+
+ The system refuses to extend the data or stack space when the limits
+ would be exceeded in the normal way: a brk(2) call fails if the data
+ space limit is reached. When the stack limit is reached, the process
+ receives a segmentation fault (SIGSEGV); if this signal is not caught by
+ a handler using the signal stack, this signal will kill the process.
+
+ A file I/O operation that would create a file larger than the process'
+ soft limit will cause the write to fail and a signal SIGXFSZ to be
+ generated; this normally terminates the process, but may be caught. When
+ the soft CPU time limit is exceeded, a signal SIGXCPU is sent to the
+ offending process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() will fail if:
+
+ [EFAULT] The address specified for _\br_\bl_\bp is invalid.
+
+ [EINVAL] An unrecognized value for _\br_\be_\bs_\bo_\bu_\br_\bc_\be was specified.
+
+ In addition, s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() may return the following errors:
+
+ [EINVAL] The new _\br_\bl_\bi_\bm_\b__\bc_\bu_\br is greater than the new _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx.
+
+ [EPERM] The new _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx is greater than the current maximum
+ limit value, and the caller is not the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ csh(1), sh(1), quotactl(2), sigaction(2), sigaltstack(2), sysctl(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ The RLIMIT_MEMLOCK, RLIMIT_NPROC, and RLIMIT_RSS resources are non-
+ standard extensions.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() system calls first appeared in 4.1cBSD.
+
+B\bBU\bUG\bGS\bS
+ The RLIMIT_AS resource is missing.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be, s\bse\bet\btr\brt\bta\bab\bbl\ble\be - get and set the default routing table of the
+ current process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\brt\bta\bab\bbl\ble\be(_\bi_\bn_\bt _\br_\bt_\ba_\bb_\bl_\be_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be() and s\bse\bet\btr\brt\bta\bab\bbl\ble\be() manipulate the routing table and routing
+ domain associated with the current process.
+
+ Only the superuser is allowed to change the process routing table if it
+ is already set to a non-zero value.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be() returns the routing table of the current process. Upon
+ successful completion, s\bse\bet\btr\brt\bta\bab\bbl\ble\be() returns 0 if the call succeeds, -1 if
+ it fails.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The call succeeds unless:
+
+ [EINVAL] The value of the _\br_\bt_\ba_\bb_\bl_\be_\bi_\bd argument is not a valid
+ routing table.
+
+ [EPERM] The user is not the superuser and the routing table of
+ the calling process is already set to a non-zero
+ value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getsockopt(2), route(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btr\brt\bta\bab\bbl\ble\be() and s\bse\bet\btr\brt\bta\bab\bbl\ble\be() system calls appeared in OpenBSD 4.8.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\bru\bus\bsa\bag\bge\be - get information about resource utilization
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bru\bus\bsa\bag\bge\be(_\bi_\bn_\bt _\bw_\bh_\bo, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btr\bru\bus\bsa\bag\bge\be() returns resource usage information for argument _\bw_\bh_\bo, which
+ can be one of the following:
+
+ RUSAGE_SELF Resources used by the current process.
+
+ RUSAGE_CHILDREN Resources used by all the terminated children of
+ the current process.
+
+ RUSAGE_THREAD Resources used by the current thread.
+
+ The buffer to which _\br_\bu_\bs_\ba_\bg_\be points will be filled in with the following
+ structure:
+
+ struct rusage {
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
+ long ru_maxrss; /* max resident set size */
+ long ru_ixrss; /* integral shared text memory size */
+ long ru_idrss; /* integral unshared data size */
+ long ru_isrss; /* integral unshared stack size */
+ long ru_minflt; /* page reclaims */
+ long ru_majflt; /* page faults */
+ long ru_nswap; /* swaps */
+ long ru_inblock; /* block input operations */
+ long ru_oublock; /* block output operations */
+ long ru_msgsnd; /* messages sent */
+ long ru_msgrcv; /* messages received */
+ long ru_nsignals; /* signals received */
+ long ru_nvcsw; /* voluntary context switches */
+ long ru_nivcsw; /* involuntary context switches */
+ };
+
+ The fields are interpreted as follows:
+
+ _\br_\bu_\b__\bu_\bt_\bi_\bm_\be the total amount of time spent executing in user mode.
+
+ _\br_\bu_\b__\bs_\bt_\bi_\bm_\be the total amount of time spent in the system executing on
+ behalf of the process(es).
+
+ _\br_\bu_\b__\bm_\ba_\bx_\br_\bs_\bs the maximum resident set size utilized (in kilobytes).
+
+ _\br_\bu_\b__\bi_\bx_\br_\bs_\bs an ``integral'' value indicating the amount of memory used
+ by the text segment that was also shared among other
+ processes. This value is expressed in units of kilobytes *
+ ticks-of-execution.
+
+ _\br_\bu_\b__\bi_\bd_\br_\bs_\bs an integral value of the amount of unshared memory residing
+ in the data segment of a process (expressed in units of
+ kilobytes * ticks-of-execution).
+
+ _\br_\bu_\b__\bi_\bs_\br_\bs_\bs an integral value of the amount of unshared memory residing
+ in the stack segment of a process (expressed in units of
+ kilobytes * ticks-of-execution).
+
+ _\br_\bu_\b__\bm_\bi_\bn_\bf_\bl_\bt the number of page faults serviced without any I/O activity;
+ here I/O activity is avoided by ``reclaiming'' a page frame
+ from the list of pages awaiting reallocation.
+
+ _\br_\bu_\b__\bm_\ba_\bj_\bf_\bl_\bt the number of page faults serviced that required I/O
+ activity.
+
+ _\br_\bu_\b__\bn_\bs_\bw_\ba_\bp the number of times a process was ``swapped'' out of main
+ memory.
+
+ _\br_\bu_\b__\bi_\bn_\bb_\bl_\bo_\bc_\bk the number of times the file system had to perform input.
+
+ _\br_\bu_\b__\bo_\bu_\bb_\bl_\bo_\bc_\bk the number of times the file system had to perform output.
+
+ _\br_\bu_\b__\bm_\bs_\bg_\bs_\bn_\bd the number of IPC messages sent.
+
+ _\br_\bu_\b__\bm_\bs_\bg_\br_\bc_\bv the number of IPC messages received.
+
+ _\br_\bu_\b__\bn_\bs_\bi_\bg_\bn_\ba_\bl_\bs the number of signals delivered.
+
+ _\br_\bu_\b__\bn_\bv_\bc_\bs_\bw the number of times a context switch resulted due to a
+ process voluntarily giving up the processor before its time
+ slice was completed (usually to await availability of a
+ resource).
+
+ _\br_\bu_\b__\bn_\bi_\bv_\bc_\bs_\bw the number of times a context switch resulted due to a
+ higher priority process becoming runnable or because the
+ current process exceeded its time slice.
+
+N\bNO\bOT\bTE\bES\bS
+ The numbers _\br_\bu_\b__\bi_\bn_\bb_\bl_\bo_\bc_\bk and _\br_\bu_\b__\bo_\bu_\bb_\bl_\bo_\bc_\bk account only for real I/O; data
+ supplied by the caching mechanism is charged only to the first process to
+ read or write the data.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btr\bru\bus\bsa\bag\bge\be() will fail if:
+
+ [EINVAL] The _\bw_\bh_\bo parameter is not a valid value.
+
+ [EFAULT] The address specified by the _\br_\bu_\bs_\ba_\bg_\be parameter is not
+ in a valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), gettimeofday(2), wait(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btr\bru\bus\bsa\bag\bge\be() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+ The RUSAGE_THREAD flag is an extension to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A predecessor to g\bge\bet\btr\bru\bus\bsa\bag\bge\be(), t\bti\bim\bme\bes\bs(), first appeared in Version 3 AT&T
+ UNIX. The g\bge\bet\btr\bru\bus\bsa\bag\bge\be() system call first appeared in 4.1cBSD.
+
+ The RUSAGE_THREAD flag has been available since OpenBSD 4.8.
+
+B\bBU\bUG\bGS\bS
+ There is no way to obtain information about a child process that has not
+ yet terminated.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bts\bsi\bid\bd - get process session
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\bts\bsi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The session ID of the process identified by _\bp_\bi_\bd is returned by g\bge\bet\bts\bsi\bid\bd().
+ If _\bp_\bi_\bd is zero, g\bge\bet\bts\bsi\bid\bd() returns the session ID of the current process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the function g\bge\bet\bts\bsi\bid\bd() returns the session ID
+ of the specified process; otherwise, it returns a value of -1 and sets
+ _\be_\br_\br_\bn_\bo to indicate an error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\bts\bsi\bid\bd() will succeed unless:
+
+ [EPERM] The current process and the process _\bp_\bi_\bd are not in the
+ same session.
+
+ [ESRCH] There is no process with a process ID equal to _\bp_\bi_\bd.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getpgid(2), getpgrp(2), setpgid(2), setsid(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ g\bge\bet\bts\bsi\bid\bd() conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bts\bsi\bid\bd() function call is derived from its usage in AT&T System V
+ UNIX, and is mandated by X/Open Portability Guide Issue 4 (``XPG4'').
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be - get socket name
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() returns the locally bound address information for a
+ specified socket.
+
+ Common uses of this function are as follows:
+
+ +\b+\bo\bo When bind(2) is called with a port number of 0 (indicating the kernel
+ should pick an ephemeral port) g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() is used to retrieve the
+ kernel-assigned port number.
+
+ +\b+\bo\bo When a process calls bind(2) on a wildcard IP address, g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be()
+ is used to retrieve the local IP address for the connection.
+
+ +\b+\bo\bo When a function wishes to know the address family of a socket,
+ g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() can be used.
+
+ g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() takes three parameters:
+
+ _\bs contains the file descriptor for the socket to be looked up.
+
+ _\bn_\ba_\bm_\be points to a sockaddr structure which will hold the resulting address
+ information. Normal use requires one to use a structure specific to the
+ protocol family in use, such as sockaddr_in (IPv4) or sockaddr_in6
+ (IPv6), cast to a (struct sockaddr *).
+
+ For greater portability (such as newer protocol families) the new
+ structure sockaddr_storage exists. sockaddr_storage is large enough to
+ hold any of the other sockaddr_* variants. On return, it should be cast
+ to the correct sockaddr type, according to the current protocol family.
+
+ _\bn_\ba_\bm_\be_\bl_\be_\bn indicates the amount of space pointed to by _\bn_\ba_\bm_\be, in bytes. Upon
+ return, _\bn_\ba_\bm_\be_\bl_\be_\bn is set to the actual size of the returned address
+ information.
+
+ If the address of the destination socket for a given socket connection is
+ needed, the getpeername(2) function should be used instead.
+
+ If _\bn_\ba_\bm_\be does not point to enough space to hold the entire socket address,
+ the result will be truncated to _\bn_\ba_\bm_\be_\bl_\be_\bn bytes.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ On success, g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() returns a 0, and _\bn_\ba_\bm_\be_\bl_\be_\bn is set to the actual
+ size of the socket address returned in _\bn_\ba_\bm_\be. Otherwise, _\be_\br_\br_\bn_\bo is set,
+ and a value of -1 is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ If g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() fails, _\be_\br_\br_\bn_\bo is set to one of the following:
+
+ [EBADF] The argument _\bs is not a valid descriptor.
+
+ [ENOTSOCK] The argument _\bs is a file, not a socket.
+
+ [ENOBUFS] Insufficient resources were available in the system to
+ perform the operation.
+
+ [EFAULT] The _\bn_\ba_\bm_\be or _\bn_\ba_\bm_\be_\bl_\be_\bn parameter points to memory not in
+ a valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), bind(2), getpeername(2), socket(2), getpeereid(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() function conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt, s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt - get and set options on sockets
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bl_\be_\bv_\be_\bl, _\bi_\bn_\bt _\bo_\bp_\bt_\bn_\ba_\bm_\be, _\bv_\bo_\bi_\bd _\b*_\bo_\bp_\bt_\bv_\ba_\bl,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bo_\bp_\bt_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bl_\be_\bv_\be_\bl, _\bi_\bn_\bt _\bo_\bp_\bt_\bn_\ba_\bm_\be, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bo_\bp_\bt_\bv_\ba_\bl,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bo_\bp_\bt_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() manipulate the _\bo_\bp_\bt_\bi_\bo_\bn_\bs associated with a
+ socket. Options may exist at multiple protocol levels; they are always
+ present at the uppermost ``socket'' level.
+
+ When manipulating socket options the level at which the option resides
+ and the name of the option must be specified. To manipulate options at
+ the socket level, _\bl_\be_\bv_\be_\bl is specified as SOL_SOCKET. To manipulate
+ options at any other level the protocol number of the appropriate
+ protocol controlling the option is supplied. For example, to indicate
+ that an option is to be interpreted by the TCP protocol, _\bl_\be_\bv_\be_\bl should be
+ set to the protocol number of TCP; see getprotoent(3).
+
+ The parameters _\bo_\bp_\bt_\bv_\ba_\bl and _\bo_\bp_\bt_\bl_\be_\bn are used to access option values for
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(). For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() they identify a buffer in which the value
+ for the requested option(s) are to be returned. For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), _\bo_\bp_\bt_\bl_\be_\bn
+ is a value-result parameter, initially containing the size of the buffer
+ pointed to by _\bo_\bp_\bt_\bv_\ba_\bl, and modified on return to indicate the actual size
+ of the value returned. If no option value is to be supplied or returned,
+ _\bo_\bp_\bt_\bv_\ba_\bl may be NULL.
+
+ _\bo_\bp_\bt_\bn_\ba_\bm_\be and any specified options are passed uninterpreted to the
+ appropriate protocol module for interpretation. The include file
+ <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh> contains definitions for socket level options, described
+ below. Options at other protocol levels vary in format and name; consult
+ the appropriate entries in section 4 of the manual.
+
+ Most socket-level options utilize an int parameter for _\bo_\bp_\bt_\bv_\ba_\bl. For
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), the parameter should be non-zero to enable a boolean
+ option, or zero if the option is to be disabled. SO_LINGER uses a struct
+ linger parameter, defined in <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>, which specifies the desired
+ state of the option and the linger interval (see below). SO_SNDTIMEO and
+ SO_RCVTIMEO use a struct timeval parameter, defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>.
+
+ The following options are recognized at the socket level. Except as
+ noted, each may be examined with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and set with s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt().
+
+ SO_DEBUG enables recording of debugging information
+ SO_REUSEADDR enables local address reuse
+ SO_REUSEPORT enables duplicate address and port bindings
+ SO_KEEPALIVE enables keep connections alive
+ SO_DONTROUTE enables routing bypass; not supported
+ SO_LINGER linger on close if data present
+ SO_BROADCAST enables permission to transmit broadcast messages
+ SO_OOBINLINE enables reception of out-of-band data in band
+ SO_BINDANY enables binding to any address
+ SO_SNDBUF set buffer size for output
+ SO_RCVBUF set buffer size for input
+ SO_SNDLOWAT set minimum count for output
+ SO_RCVLOWAT set minimum count for input
+ SO_SNDTIMEO set timeout value for output
+ SO_RCVTIMEO set timeout value for input
+ SO_TIMESTAMP enables reception of a timestamp with datagrams
+ SO_PEERCRED get the credentials from other side of connection
+ SO_RTABLE set the routing table used for route lookups
+ SO_SPLICE splice two sockets together or get data length
+ SO_TYPE get the type of the socket (get only)
+ SO_ERROR get and clear error on the socket (get only)
+
+ SO_DEBUG enables debugging in the underlying protocol modules.
+ SO_REUSEADDR indicates that the rules used in validating addresses
+ supplied in a bind(2) call should allow reuse of local addresses.
+ SO_REUSEPORT allows completely duplicate bindings by multiple processes
+ if they all set SO_REUSEPORT before binding the port. This option
+ permits multiple instances of a program to each receive UDP/IP multicast
+ or broadcast datagrams destined for the bound port. SO_KEEPALIVE enables
+ the periodic transmission of messages on a connected socket. Should the
+ connected party fail to respond to these messages, the connection is
+ considered broken and processes using the socket are notified via a
+ SIGPIPE signal when attempting to send data.
+
+ SO_LINGER controls the action taken when unsent messages are queued on
+ socket and a close(2) is performed. If the socket promises reliable
+ delivery of data and SO_LINGER is set, the system will block the process
+ on the close(2) attempt until it is able to transmit the data or until it
+ decides it is unable to deliver the information (a timeout period
+ measured in seconds, termed the linger interval, is specified in the
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() call when SO_LINGER is requested). If SO_LINGER is disabled
+ and a close(2) is issued, the system will process the close in a manner
+ that allows the process to continue as quickly as possible.
+
+ The option SO_BROADCAST requests permission to send broadcast datagrams
+ on the socket. Broadcast was a privileged operation in earlier versions
+ of the system. With protocols that support out-of-band data, the
+ SO_OOBINLINE option requests that out-of-band data be placed in the
+ normal data input queue as received; it will then be accessible with
+ recv(2) or read(2) calls without the MSG_OOB flag. Some protocols always
+ behave as if this option is set.
+
+ SO_BINDANY allows the socket to be bound to addresses which are not local
+ to the machine, so it can be used to make a transparent proxy. Note that
+ this option is limited to the super-user. In order to receive packets
+ for these addresses, SO_BINDANY needs to be combined with matching
+ outgoing pf(4) rules with the _\bd_\bi_\bv_\be_\br_\bt_\b-_\br_\be_\bp_\bl_\by parameter. For example, with
+ the following rule the socket receives packets for 192.168.0.10 even if
+ it is not a local address:
+
+ pass out inet from 192.168.0.10 divert-reply
+
+ SO_SNDBUF and SO_RCVBUF are options to adjust the normal buffer sizes
+ allocated for output and input buffers, respectively. The buffer size
+ may be increased for high-volume connections, or may be decreased to
+ limit the possible backlog of incoming data. The system places an
+ absolute limit on these values.
+
+ SO_SNDLOWAT is an option to set the minimum count for output operations.
+ Most output operations process all of the data supplied by the call,
+ delivering data to the protocol for transmission and blocking as
+ necessary for flow control. Nonblocking output operations will process
+ as much data as permitted subject to flow control without blocking, but
+ will process no data if flow control does not allow the smaller of the
+ low water mark value or the entire request to be processed. A select(2)
+ or poll(2) operation testing the ability to write to a socket will return
+ true only if the low water mark amount could be processed. The default
+ value for SO_SNDLOWAT is set to a convenient size for network efficiency,
+ often 1024. SO_RCVLOWAT is an option to set the minimum count for input
+ operations. In general, receive calls will block until any (non-zero)
+ amount of data is received, then return with the smaller of the amount
+ available or the amount requested. The default value for SO_RCVLOWAT is
+ 1. If SO_RCVLOWAT is set to a larger value, blocking receive calls
+ normally wait until they have received the smaller of the low water mark
+ value or the requested amount. Receive calls may still return less than
+ the low water mark if an error occurs, a signal is caught, or the type of
+ data next in the receive queue is different than that returned.
+
+ SO_SNDTIMEO is an option to set a timeout value for output operations.
+ It accepts a struct timeval parameter with the number of seconds and
+ microseconds used to limit waits for output operations to complete. If a
+ send operation has blocked for this much time, it returns with a partial
+ count or with the error EWOULDBLOCK if no data was sent. In the current
+ implementation, this timer is restarted each time additional data are
+ delivered to the protocol, implying that the limit applies to output
+ portions ranging in size from the low water mark to the high water mark
+ for output. SO_RCVTIMEO is an option to set a timeout value for input
+ operations. It accepts a struct timeval parameter with the number of
+ seconds and microseconds used to limit waits for input operations to
+ complete. In the current implementation, this timer is restarted each
+ time additional data are received by the protocol, and thus the limit is
+ in effect an inactivity timer. If a receive operation has been blocked
+ for this much time without receiving additional data, it returns with a
+ short count or with the error EWOULDBLOCK if no data were received.
+
+ If the SO_TIMESTAMP option is enabled on a SOCK_DGRAM socket, the
+ recvmsg(2) call will return a timestamp corresponding to when the
+ datagram was received. The msg_control field in the msghdr structure
+ points to a buffer that contains a cmsghdr structure followed by a struct
+ timeval. The cmsghdr fields have the following values:
+
+ cmsg_len = CMSG_LEN(sizeof(struct timeval))
+ cmsg_level = SOL_SOCKET
+ cmsg_type = SCM_TIMESTAMP
+
+ SO_PEERCRED fetches the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\bp_\be_\be_\br_\bc_\br_\be_\bd credentials from the other
+ side of the connection (currently only possible on AF_UNIX sockets).
+ These credentials are from the time that bind(2) or connect(2) were
+ called.
+
+ The SO_RTABLE option gets or sets the routing table which will be used by
+ the socket for address lookups. If a protocol family of the socket
+ doesn't support switching routing tables, the ENOPROTOOPT error is
+ returned. Only the superuser is allowed to change the routing table if
+ it is already set to a non-zero value. A socket's chosen routing table
+ is initialized from the process's configuration, previously selected
+ using setrtable(2).
+
+ SO_SPLICE can splice together two TCP or UDP sockets for zero-copy data
+ transfers. Both sockets must be of the same type. In the first form,
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() is called with the source socket _\bs and the drain socket's
+ _\bi_\bn_\bt file descriptor as _\bo_\bp_\bt_\bv_\ba_\bl. In the second form, _\bo_\bp_\bt_\bv_\ba_\bl is a _\bs_\bt_\br_\bu_\bc_\bt
+ _\bs_\bp_\bl_\bi_\bc_\be with the drain socket in _\bs_\bp_\b__\bf_\bd, a positive maximum number of bytes
+ or 0 in _\bs_\bp_\b__\bm_\ba_\bx and an idle timeout _\bs_\bp_\b__\bi_\bd_\bl_\be in the form of a _\bs_\bt_\br_\bu_\bc_\bt
+ _\bt_\bi_\bm_\be_\bv_\ba_\bl. If -1 is given as drain socket, the source socket _\bs gets
+ unspliced. Otherwise the spliced data transfer continues within the
+ kernel until the optional maximum is reached, one of the connections
+ terminates, idle timeout expires or an error occurs. A successful
+ select(2), poll(2), or kqueue(2) operation testing the ability to read
+ from the source socket indicates that the splicing has terminated. The
+ error status can be examined with SO_ERROR at the source socket. The
+ ETIMEDOUT error is set if there was no data transferred between two
+ sockets during the _\bs_\bp_\b__\bi_\bd_\bl_\be period of time. The EFBIG error is set after
+ exactly _\bs_\bp_\b__\bm_\ba_\bx bytes have been transferred. Note that if a maximum is
+ given, it is only guaranteed that no more bytes are transferred. A short
+ splice can happen, but then a second call to splice will transfer the
+ remaining data immediately. The SO_SPLICE option with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and
+ an _\bo_\bf_\bf_\b__\bt value as _\bo_\bp_\bt_\bv_\ba_\bl can be used to retrieve the number of bytes
+ transferred so far from the source socket _\bs. A successful new splice
+ resets this number.
+
+ Finally, SO_TYPE and SO_ERROR are options used only with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt().
+ SO_TYPE returns the type of the socket, such as SOCK_STREAM; it is useful
+ for servers that inherit sockets on startup. SO_ERROR returns any
+ pending error on the socket and clears the error status. It may be used
+ to check for asynchronous errors on connected datagram sockets or for
+ other asynchronous errors.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The call succeeds unless:
+
+ [EBADF] The argument _\bs is not a valid descriptor.
+
+ [ENOTSOCK] The argument _\bs is a file, not a socket.
+
+ [ENOPROTOOPT] The option is unknown at the level indicated.
+
+ [EOPNOTSUPP] The option is unsupported.
+
+ [EFAULT] The address pointed to by _\bo_\bp_\bt_\bv_\ba_\bl is not in a valid
+ part of the process address space. For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(),
+ this error may also be returned if _\bo_\bp_\bt_\bl_\be_\bn is not in a
+ valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), getrtable(2), ioctl(2), poll(2), select(2), socket(2),
+ getprotoent(3), divert(4), pf.conf(5), protocols(5), sosplice(9)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() system call appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ Several of the socket options should be handled at lower levels of the
+ system.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btt\bth\bhr\bri\bid\bd - get thread identifier
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ g\bge\bet\btt\bth\bhr\bri\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ k\bkq\bqu\bue\beu\bue\be returns the thread ID of the calling thread. This is used in the
+ implementation of the thread library (-\b-l\blp\bpt\bth\bhr\bre\bea\bad\bd) and can appear in the
+ output of system utilities such as ps(1) and kdump(1).
+
+ Thread IDs are not a stable interface and should not be used directly by
+ applications except for correlation with system utility output.
+ Applications should use the _\bp_\bt_\bh_\br_\be_\ba_\bd_\b__\bt values from pthread_self(3) and
+ pthread_create(3) to identify threads within the process itself.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ This function is always successful, and no return value is reserved to
+ indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), getpid(2), pthread_create(3), pthread_self(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The k\bkq\bqu\bue\beu\bue\be syscall is specific to OpenBSD and should not be used in
+ portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bkq\bqu\bue\beu\bue\be syscall appeared in OpenBSD 3.9.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by, s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by - get/set date and time
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be _\b*_\bt_\bz_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bp, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be _\b*_\bt_\bz_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ N\bNo\bot\bte\be:\b: t\bti\bim\bme\bez\bzo\bon\bne\be i\bis\bs n\bno\bo l\blo\bon\bng\bge\ber\br u\bus\bse\bed\bd;\b; t\bth\bhi\bis\bs i\bin\bnf\bfo\bor\brm\bma\bat\bti\bio\bon\bn i\bis\bs k\bke\bep\bpt\bt o\bou\but\bts\bsi\bid\bde\be t\bth\bhe\be
+ k\bke\ber\brn\bne\bel\bl.\b.
+
+ The system's notion of the current Greenwich time and the current time
+ zone is obtained with the g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() call, and set with the
+ s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() call. The time is expressed in seconds and microseconds
+ since midnight (0 hour), January 1, 1970. The resolution of the system
+ clock is hardware dependent, and the time may be updated continuously or
+ in ``ticks''. If _\bt_\bp or _\bt_\bz_\bp is NULL, the associated time information will
+ not be returned or set.
+
+ The structures pointed to by _\bt_\bp and _\bt_\bz_\bp are defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh> as:
+
+ struct timeval {
+ time_t tv_sec; /* seconds since Jan. 1, 1970 */
+ suseconds_t tv_usec; /* and microseconds */
+ };
+
+ struct timezone {
+ int tz_minuteswest; /* of Greenwich */
+ int tz_dsttime; /* type of dst correction to apply */
+ };
+
+ The _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be structure indicates the local time zone (measured in minutes
+ of time westward from Greenwich), and a flag that, if nonzero, indicates
+ that Daylight Saving time applies locally during the appropriate part of
+ the year.
+
+ Only the superuser may set the time of day or time zone. If the system
+ securelevel is greater than 1 (see init(8)), the time may only be
+ advanced. This limitation is imposed to prevent a malicious superuser
+ from setting arbitrary time stamps on files. The system time can still
+ be adjusted backwards using the adjtime(2) system call even when the
+ system is secure.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() and s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() will succeed unless:
+
+ [EFAULT] An argument address referenced invalid memory.
+
+ In addition, s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() may return the following error:
+
+ [EPERM] A user other than the superuser attempted to set the
+ time.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), clock_gettime(2), getitimer(2), ctime(3), time(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() function conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ As predecessors of these functions, former system calls t\bti\bim\bme\be() and
+ s\bst\bti\bim\bme\be() first appeared in Version 1 AT&T UNIX, and f\bft\bti\bim\bme\be() first appeared
+ in Version 7 AT&T UNIX. The g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() and s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() system
+ calls first appeared in 4.1cBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Setting the time with s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() is dangerous; if possible use
+ adjtime(2) instead. Many daemon programming techniques utilize time-
+ delta techniques using the results from g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() instead of from
+ clock_gettime(2) on the CLOCK_MONOTONIC clock. Time jumps can cause
+ these programs to malfunction in unexpected ways. If the time must be
+ set, consider rebooting the machine for safety.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btu\bui\bid\bd, g\bge\bet\bte\beu\bui\bid\bd - get user identification
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bu_\bi_\bd_\b__\bt
+ g\bge\bet\btu\bui\bid\bd(_\bv_\bo_\bi_\bd);
+
+ _\bu_\bi_\bd_\b__\bt
+ g\bge\bet\bte\beu\bui\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btu\bui\bid\bd() function returns the real user ID of the calling process.
+ The g\bge\bet\bte\beu\bui\bid\bd() function returns the effective user ID of the calling
+ process.
+
+ The real user ID is that of the user who has invoked the program. As the
+ effective user ID gives the process additional permissions during
+ execution of ``_\bs_\be_\bt_\b-_\bu_\bs_\be_\br_\b-_\bI_\bD'' mode processes, g\bge\bet\btu\bui\bid\bd() is used to
+ determine the real user ID of the calling process.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The g\bge\bet\btu\bui\bid\bd() and g\bge\bet\bte\beu\bui\bid\bd() functions are always successful, and no return
+ value is reserved to indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getresuid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btu\bui\bid\bd() and g\bge\bet\bte\beu\bui\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX, and
+ g\bge\bet\bte\beu\bui\bid\bd() in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be - manage i386 per-thread %fs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() copies the current base address of the segment that, by
+ default, is referenced by the %fs selector into the memory referenced by
+ _\bb_\ba_\bs_\be.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() sets the base address of the segment that, by default,
+ is referenced by %fs to the address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be - manage i386 per-thread %gs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() copies the current base address of the segment that, by
+ default, is referenced by the %gs selector into the memory referenced by
+ _\bb_\ba_\bs_\be.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() sets the base address of the segment that, by default,
+ is referenced by %gs to the address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ The ELF Thread-Local Storage ABI reserves %gs for its own use and
+ requires that the dynamic linker and thread library set it to reference
+ data-structures internal to and shared between them. Programs should use
+ the __thread storage class keyword instead of using these calls. To be
+ maximally portable, programs that require per-thread data should use the
+ p\bpt\bth\bhr\bre\bea\bad\bd_\b_k\bke\bey\by_\b_c\bcr\bre\bea\bat\bte\be() interface.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm - manage i386 per-process I/O permission
+ bitmap
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm(_\bu_\b__\bl_\bo_\bn_\bg _\b*_\bi_\bo_\bm_\ba_\bp);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm(_\bu_\b__\bl_\bo_\bn_\bg _\b*_\bi_\bo_\bm_\ba_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() copies the current I/O permission bitmap into the
+ memory referenced by _\bi_\bo_\bm_\ba_\bp.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() sets the I/O permission bitmap from the data pointed to
+ by _\bi_\bo_\bm_\ba_\bp. This call may only be made by the superuser. Additionally, it
+ is only permitted when the securelevel(7) is less than or equal to 0 or
+ the _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be sysctl has been set to a non-zero value.
+
+ The permission bitmap contains 1024 bits in 32 longwords. If bit _\bn is
+ clear in the bitmap, then access is granted to I/O port _\bn. If bit _\bn is
+ set in the bitmap, then an attempt to access I/O port _\bn results in
+ delivery of a SIGBUS signal unless the process's I/O permission level
+ would grant I/O access.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() will fail if:
+
+ [EFAULT] _\bi_\bo_\bm_\ba_\bp points outside the process's allocated address space.
+
+ Additionally i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() will fail if:
+
+ [EPERM] The caller was not the superuser, or the securelevel is greater
+ than zero and _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be has not been set to a non-
+ zero value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ i386_iopl(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your machine if you enable user-level I/O and write
+ to hardware ports without care.
+
+B\bBU\bUG\bGS\bS
+ The bitmap should really cover 65536 bits, but that's just too big for
+ allocation in a kernel structure. If you need access to ports beyond
+ 1024, use i386_iopl(2).
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt - manage i386 per-process Local Descriptor
+ Table entries
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bse\beg\bgm\bme\ben\bnt\bts\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl, _\bu_\bn_\bi_\bo_\bn _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br _\b*_\bd_\be_\bs_\bc_\bs, _\bi_\bn_\bt _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl, _\bu_\bn_\bi_\bo_\bn _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br _\b*_\bd_\be_\bs_\bc_\bs, _\bi_\bn_\bt _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() returns a list of the i386 descriptors in the current
+ process' LDT. i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() sets a list of i386 descriptors in the
+ current process' LDT. For both routines, _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl specifies the index
+ of the selector in the LDT at which to begin and _\bd_\be_\bs_\bc_\bs points to an array
+ of _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs descriptors to be set or returned.
+
+ Each entry in the _\bd_\be_\bs_\bc_\bs array can be either a segment_descriptor or a
+ gate_descriptor, as defined in <_\bi_\b3_\b8_\b6_\b/_\bs_\be_\bg_\bm_\be_\bn_\bt_\bs_\b._\bh>. These structures are
+ defined by the architecture as disjoint bit-fields, so care must be taken
+ in constructing them.
+
+ Before this API can be used the functionality has to be enabled using the
+ machdep.userldt sysctl(8) variable.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() functions must be
+ compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() returns the number of i386
+ descriptors copied into _\bd_\be_\bs_\bc_\bs from the current process' LDT. Otherwise,
+ a value of -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+ Upon successful completion, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() returns the first selector
+ set; if the kernel allocated a descriptor in the LDT, the allocated index
+ is returned. Otherwise, a value of -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() will fail if:
+
+ [EINVAL] An inappropriate parameter was used for _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl or _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs.
+
+ [EACCES] The caller attempted to use a descriptor that would circumvent
+ protection or cause a failure.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your process using this.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl - change the i386 I/O privilege level
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl(_\bi_\bn_\bt _\bi_\bo_\bp_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl() sets the i386 I/O privilege level to the value specified by
+ _\bi_\bo_\bp_\bl.
+
+ This call may only be made by the superuser. Additionally, it is only
+ permitted when the securelevel(7) is less than or equal to 0 or the
+ _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be sysctl has been set to a non-zero value.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl() function must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl() returns 0. Otherwise, a value of
+ -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_i\bio\bop\bpl\bl() will fail if:
+
+ [EPERM] The caller was not the superuser, or the securelevel is greater
+ than zero and _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be has not been set to a non-
+ zero value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ i386_get_ioperm(2), securelevel(7)
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your machine if you enable user-level I/O and write
+ to hardware ports without care.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be - manage i386 per-thread %fs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() copies the current base address of the segment that, by
+ default, is referenced by the %fs selector into the memory referenced by
+ _\bb_\ba_\bs_\be.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() sets the base address of the segment that, by default,
+ is referenced by %fs to the address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_f\bfs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be - manage i386 per-thread %gs base
+ address
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\b*_\bb_\ba_\bs_\be);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be(_\bv_\bo_\bi_\bd _\b*_\bb_\ba_\bs_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() copies the current base address of the segment that, by
+ default, is referenced by the %gs selector into the memory referenced by
+ _\bb_\ba_\bs_\be.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() sets the base address of the segment that, by default,
+ is referenced by %gs to the address _\bb_\ba_\bs_\be.
+
+ The segment base address is local to each thread. The initial thread of
+ a new process inherits its segment base address from the parent thread.
+ __tfork(2) sets the initial segment base address for threads that it
+ creates.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_g\bgs\bsb\bba\bas\bse\be() will fail if:
+
+ [EFAULT] _\bb_\ba_\bs_\be points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ __tfork(2), fork(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ The ELF Thread-Local Storage ABI reserves %gs for its own use and
+ requires that the dynamic linker and thread library set it to reference
+ data-structures internal to and shared between them. Programs should use
+ the __thread storage class keyword instead of using these calls. To be
+ maximally portable, programs that require per-thread data should use the
+ p\bpt\bth\bhr\bre\bea\bad\bd_\b_k\bke\bey\by_\b_c\bcr\bre\bea\bat\bte\be() interface.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm - manage i386 per-process I/O permission
+ bitmap
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm(_\bu_\b__\bl_\bo_\bn_\bg _\b*_\bi_\bo_\bm_\ba_\bp);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm(_\bu_\b__\bl_\bo_\bn_\bg _\b*_\bi_\bo_\bm_\ba_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() copies the current I/O permission bitmap into the
+ memory referenced by _\bi_\bo_\bm_\ba_\bp.
+
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() sets the I/O permission bitmap from the data pointed to
+ by _\bi_\bo_\bm_\ba_\bp. This call may only be made by the superuser. Additionally, it
+ is only permitted when the securelevel(7) is less than or equal to 0 or
+ the _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be sysctl has been set to a non-zero value.
+
+ The permission bitmap contains 1024 bits in 32 longwords. If bit _\bn is
+ clear in the bitmap, then access is granted to I/O port _\bn. If bit _\bn is
+ set in the bitmap, then an attempt to access I/O port _\bn results in
+ delivery of a SIGBUS signal unless the process's I/O permission level
+ would grant I/O access.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() functions
+ must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm()
+ return 0. Otherwise, a value of -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() will fail if:
+
+ [EFAULT] _\bi_\bo_\bm_\ba_\bp points outside the process's allocated address space.
+
+ Additionally i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_i\bio\bop\bpe\ber\brm\bm() will fail if:
+
+ [EPERM] The caller was not the superuser, or the securelevel is greater
+ than zero and _\bm_\ba_\bc_\bh_\bd_\be_\bp_\b._\ba_\bl_\bl_\bo_\bw_\ba_\bp_\be_\br_\bt_\bu_\br_\be has not been set to a non-
+ zero value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ i386_iopl(2)
+
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your machine if you enable user-level I/O and write
+ to hardware ports without care.
+
+B\bBU\bUG\bGS\bS
+ The bitmap should really cover 65536 bits, but that's just too big for
+ allocation in a kernel structure. If you need access to ports beyond
+ 1024, use i386_iopl(2).
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt - manage i386 per-process Local Descriptor
+ Table entries
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bse\beg\bgm\bme\ben\bnt\bts\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl, _\bu_\bn_\bi_\bo_\bn _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br _\b*_\bd_\be_\bs_\bc_\bs, _\bi_\bn_\bt _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs);
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl, _\bu_\bn_\bi_\bo_\bn _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br _\b*_\bd_\be_\bs_\bc_\bs, _\bi_\bn_\bt _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() returns a list of the i386 descriptors in the current
+ process' LDT. i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() sets a list of i386 descriptors in the
+ current process' LDT. For both routines, _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl specifies the index
+ of the selector in the LDT at which to begin and _\bd_\be_\bs_\bc_\bs points to an array
+ of _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs descriptors to be set or returned.
+
+ Each entry in the _\bd_\be_\bs_\bc_\bs array can be either a segment_descriptor or a
+ gate_descriptor, as defined in <_\bi_\b3_\b8_\b6_\b/_\bs_\be_\bg_\bm_\be_\bn_\bt_\bs_\b._\bh>. These structures are
+ defined by the architecture as disjoint bit-fields, so care must be taken
+ in constructing them.
+
+ Before this API can be used the functionality has to be enabled using the
+ machdep.userldt sysctl(8) variable.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() functions must be
+ compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() returns the number of i386
+ descriptors copied into _\bd_\be_\bs_\bc_\bs from the current process' LDT. Otherwise,
+ a value of -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+ Upon successful completion, i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() returns the first selector
+ set; if the kernel allocated a descriptor in the LDT, the allocated index
+ is returned. Otherwise, a value of -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_g\bge\bet\bt_\b_l\bld\bdt\bt() and i\bi3\b38\b86\b6_\b_s\bse\bet\bt_\b_l\bld\bdt\bt() will fail if:
+
+ [EINVAL] An inappropriate parameter was used for _\bs_\bt_\ba_\br_\bt_\b__\bs_\be_\bl or _\bn_\bu_\bm_\b__\bs_\be_\bl_\bs.
+
+ [EACCES] The caller attempted to use a descriptor that would circumvent
+ protection or cause a failure.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+W\bWA\bAR\bRN\bNI\bIN\bNG\bG
+ You can really hose your process using this.
+
+N\bNA\bAM\bME\bE
+ i\bi3\b38\b86\b6_\b_v\bvm\bm8\b86\b6 - set virtual 8086 processor registers and mode
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bse\beg\bgm\bme\ben\bnt\bts\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/v\bvm\bm8\b86\b6.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bi3\b38\b86\b6_\b_v\bvm\bm8\b86\b6(_\bs_\bt_\br_\bu_\bc_\bt _\bv_\bm_\b8_\b6_\b__\bs_\bt_\br_\bu_\bc_\bt _\b*_\bv_\bm_\bc_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ i\bi3\b38\b86\b6_\b_v\bvm\bm8\b86\b6() will set the process into virtual 8086 mode using the
+ registers and selectors specified by the context pointed to by _\bv_\bm_\bc_\bp. The
+ processor registers are set from _\bv_\bm_\bc_\bp_\b-_\b>_\bs_\bu_\bb_\bs_\bt_\br_\b._\br_\be_\bg_\bs, and the emulated
+ processor type from _\bv_\bm_\bc_\bp_\b-_\b>_\bs_\bu_\bb_\bs_\bt_\br_\b._\bs_\bs_\b__\bc_\bp_\bu_\b__\bt_\by_\bp_\be.
+
+ The kernel keeps a pointer to the context, and uses the tables stored at
+ _\bv_\bm_\bc_\bp_\b-_\b>_\bi_\bn_\bt_\b__\bb_\by_\bu_\bs_\be_\br and _\bv_\bm_\bc_\bp_\b-_\b>_\bi_\bn_\bt_\b2_\b1_\b__\bb_\by_\bu_\bs_\be_\br for fast virtual interrupt
+ handling. If the _\bnth bit is clear in the first of these arrays, then the
+ kernel may directly emulate the real-mode x86 INT _\bn instruction handling.
+ If the _\bnth bit is set, then the process is delivered a signal when an INT
+ instruction is executed.
+
+ Since MS-DOS puts many DOS functions onto interrupt 21, it is handled
+ specially: the _\bkth bit in the _\bv_\bm_\bc_\bp_\b-_\b>_\bi_\bn_\bt_\b2_\b1_\b__\bb_\by_\bu_\bs_\be_\br array is checked when
+ INT _\b2_\b1 is requested and the _\ba_\bh register is _\bk.
+
+ N\bNo\bot\bte\be:\b: Code using the i\bi3\b38\b86\b6_\b_v\bvm\bm8\b86\b6() function must be compiled using -\b-l\bli\bi3\b38\b86\b6.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ This routine does not normally return: 32-bit mode will be restored by
+ the delivery of a signal to the process. In case of an error in setting
+ the VM86 mode, a value of -1 is returned and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bi3\b38\b86\b6_\b_v\bvm\bm8\b86\b6() will fail if:
+
+ [EFAULT] The state at _\bv_\bm_\bc_\bp was not readable to the user process.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ Intel, _\bi_\b3_\b8_\b6 _\bM_\bi_\bc_\br_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs_\bo_\br _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\be_\br_\b'_\bs _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl.
+
+N\bNA\bAM\bME\bE
+ i\bin\bnt\btr\bro\bo - introduction to system calls and error numbers
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<e\ber\brr\brn\bno\bo.\b.h\bh>\b>
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The manual pages in section 2 provide an overview of the system calls,
+ their error returns, and other common definitions and concepts.
+
+D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
+ Nearly all of the system calls provide an error number via the identifier
+ errno, which expands to an addressable location of type _\bi_\bn_\bt. The address
+ of _\be_\br_\br_\bn_\bo in each thread is guaranteed to be unique for the lifetime of
+ the thread. Applications must use _\be_\br_\br_\bn_\bo as defined in <_\be_\br_\br_\bn_\bo_\b._\bh> and not
+ attempt to use a custom definition.
+
+ When a system call detects an error, it returns an integer value
+ indicating failure (usually -1) and sets the variable _\be_\br_\br_\bn_\bo accordingly.
+ (This allows interpretation of the failure on receiving a -1 and to take
+ action accordingly.) Successful calls never set _\be_\br_\br_\bn_\bo; once set, it
+ remains until another error occurs. It should only be examined after an
+ error. Note that a number of system calls overload the meanings of these
+ error numbers, and that the meanings must be interpreted according to the
+ type and circumstances of the call.
+
+ The following is a complete list of the errors and their names as given
+ in <_\bs_\by_\bs_\b/_\be_\br_\br_\bn_\bo_\b._\bh>.
+
+ 0 _\bU_\bn_\bd_\be_\bf_\bi_\bn_\be_\bd _\be_\br_\br_\bo_\br_\b: _\b0. Not used.
+
+ 1 EPERM _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bp_\be_\br_\bm_\bi_\bt_\bt_\be_\bd. An attempt was made to perform an
+ operation limited to processes with appropriate privileges or to
+ the owner of a file or other resources.
+
+ 2 ENOENT _\bN_\bo _\bs_\bu_\bc_\bh _\bf_\bi_\bl_\be _\bo_\br _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. A component of a specified pathname
+ did not exist, or the pathname was an empty string.
+
+ 3 ESRCH _\bN_\bo _\bs_\bu_\bc_\bh _\bp_\br_\bo_\bc_\be_\bs_\bs. No process could be found which corresponds to
+ the given process ID.
+
+ 4 EINTR _\bI_\bn_\bt_\be_\br_\br_\bu_\bp_\bt_\be_\bd _\bs_\by_\bs_\bt_\be_\bm _\bc_\ba_\bl_\bl. An asynchronous signal (such as SIGINT
+ or SIGQUIT) was caught by the thread during the execution of an
+ interruptible function. If the signal handler performs a normal
+ return, the interrupted function call will seem to have returned
+ the error condition.
+
+ 5 EIO _\bI_\bn_\bp_\bu_\bt_\b/_\bo_\bu_\bt_\bp_\bu_\bt _\be_\br_\br_\bo_\br. Some physical input or output error occurred.
+ This error will not be reported until a subsequent operation on
+ the same file descriptor and may be lost (overwritten) by any
+ subsequent errors.
+
+ 6 ENXIO _\bD_\be_\bv_\bi_\bc_\be _\bn_\bo_\bt _\bc_\bo_\bn_\bf_\bi_\bg_\bu_\br_\be_\bd. Input or output on a special file referred
+ to a device that did not exist, or made a request beyond the
+ limits of the device. This error may also occur when, for
+ example, a tape drive is not online or no disk pack is loaded on
+ a drive.
+
+ 7 E2BIG _\bA_\br_\bg_\bu_\bm_\be_\bn_\bt _\bl_\bi_\bs_\bt _\bt_\bo_\bo _\bl_\bo_\bn_\bg. The number of bytes used for the argument
+ and environment list of the new process exceeded the limit NCARGS
+ (specified in <_\bs_\by_\bs_\b/_\bp_\ba_\br_\ba_\bm_\b._\bh>).
+
+ 8 ENOEXEC _\bE_\bx_\be_\bc _\bf_\bo_\br_\bm_\ba_\bt _\be_\br_\br_\bo_\br. A request was made to execute a file that,
+ although it has the appropriate permissions, was not in the
+ format required for an executable file.
+
+ 9 EBADF _\bB_\ba_\bd _\bf_\bi_\bl_\be _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bo_\br. A file descriptor argument was out of range,
+ referred to no open file, or a read (write) request was made to a
+ file that was only open for writing (reading).
+
+ 10 ECHILD _\bN_\bo _\bc_\bh_\bi_\bl_\bd _\bp_\br_\bo_\bc_\be_\bs_\bs_\be_\bs. A wait(2) or waitpid(2) function was
+ executed by a process that had no existing or unwaited-for child
+ processes.
+
+ 11 EDEADLK _\bR_\be_\bs_\bo_\bu_\br_\bc_\be _\bd_\be_\ba_\bd_\bl_\bo_\bc_\bk _\ba_\bv_\bo_\bi_\bd_\be_\bd. An attempt was made to lock a
+ system resource that would have resulted in a deadlock situation.
+
+ 12 ENOMEM _\bC_\ba_\bn_\bn_\bo_\bt _\ba_\bl_\bl_\bo_\bc_\ba_\bt_\be _\bm_\be_\bm_\bo_\br_\by. The new process image required more
+ memory than was allowed by the hardware or by system-imposed
+ memory management constraints. A lack of swap space is normally
+ temporary; however, a lack of core is not. Soft limits may be
+ increased to their corresponding hard limits.
+
+ 13 EACCES _\bP_\be_\br_\bm_\bi_\bs_\bs_\bi_\bo_\bn _\bd_\be_\bn_\bi_\be_\bd. An attempt was made to access a file in a
+ way forbidden by its file access permissions.
+
+ 14 EFAULT _\bB_\ba_\bd _\ba_\bd_\bd_\br_\be_\bs_\bs. The system detected an invalid address in
+ attempting to use an argument of a call.
+
+ 15 ENOTBLK _\bB_\bl_\bo_\bc_\bk _\bd_\be_\bv_\bi_\bc_\be _\br_\be_\bq_\bu_\bi_\br_\be_\bd. A block device operation was attempted
+ on a non-block device or file.
+
+ 16 EBUSY _\bD_\be_\bv_\bi_\bc_\be _\bb_\bu_\bs_\by. An attempt to use a system resource which was in
+ use at the time in a manner which would have conflicted with the
+ request.
+
+ 17 EEXIST _\bF_\bi_\bl_\be _\be_\bx_\bi_\bs_\bt_\bs. An existing file was mentioned in an inappropriate
+ context, for instance, as the new link name in a link(2)
+ function.
+
+ 18 EXDEV _\bC_\br_\bo_\bs_\bs_\b-_\bd_\be_\bv_\bi_\bc_\be _\bl_\bi_\bn_\bk. A hard link to a file on another file system
+ was attempted.
+
+ 19 ENODEV _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd _\bb_\by _\bd_\be_\bv_\bi_\bc_\be. An attempt was made to apply
+ an inappropriate function to a device, for example, trying to
+ read a write-only device such as a printer.
+
+ 20 ENOTDIR _\bN_\bo_\bt _\ba _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. A component of the specified pathname
+ existed, but it was not a directory, when a directory was
+ expected.
+
+ 21 EISDIR _\bI_\bs _\ba _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by. An attempt was made to open a directory with
+ write mode specified.
+
+ 22 EINVAL _\bI_\bn_\bv_\ba_\bl_\bi_\bd _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt. Some invalid argument was supplied. (For
+ example, specifying an undefined signal to a signal(3) or kill(2)
+ function).
+
+ 23 ENFILE _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bo_\bp_\be_\bn _\bf_\bi_\bl_\be_\bs _\bi_\bn _\bs_\by_\bs_\bt_\be_\bm. Maximum number of file
+ descriptors allowable on the system has been reached and a
+ request for an open cannot be satisfied until at least one has
+ been closed. The sysctl(3) variable _\bk_\be_\br_\bn_\b._\bm_\ba_\bx_\bf_\bi_\bl_\be_\bs contains the
+ current limit.
+
+ 24 EMFILE _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bo_\bp_\be_\bn _\bf_\bi_\bl_\be_\bs. The maximum number of file descriptors
+ allowable for this process has been reached and a request for an
+ open cannot be satisfied until at least one has been closed.
+ getdtablesize(3) will obtain the current limit.
+
+ 25 ENOTTY _\bI_\bn_\ba_\bp_\bp_\br_\bo_\bp_\br_\bi_\ba_\bt_\be _\bi_\bo_\bc_\bt_\bl _\bf_\bo_\br _\bd_\be_\bv_\bi_\bc_\be. A control function (see
+ ioctl(2)) was attempted for a file or special device for which
+ the operation was inappropriate.
+
+ 26 ETXTBSY _\bT_\be_\bx_\bt _\bf_\bi_\bl_\be _\bb_\bu_\bs_\by. An attempt was made either to execute a pure
+ procedure (shared text) file which was open for writing by
+ another process, or to open with write access a pure procedure
+ file that is currently being executed.
+
+ 27 EFBIG _\bF_\bi_\bl_\be _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be. The size of a file exceeded the maximum. (The
+ system-wide maximum file size is 2**63 bytes. Each file system
+ may impose a lower limit for files contained within it.)
+
+ 28 ENOSPC _\bN_\bo _\bs_\bp_\ba_\bc_\be _\bl_\be_\bf_\bt _\bo_\bn _\bd_\be_\bv_\bi_\bc_\be. A write(2) to an ordinary file, the
+ creation of a directory or symbolic link, or the creation of a
+ directory entry failed because no more disk blocks were available
+ on the file system, or the allocation of an inode for a newly
+ created file failed because no more inodes were available on the
+ file system.
+
+ 29 ESPIPE _\bI_\bl_\bl_\be_\bg_\ba_\bl _\bs_\be_\be_\bk. An lseek(2) function was issued on a socket, pipe
+ or FIFO.
+
+ 30 EROFS _\bR_\be_\ba_\bd_\b-_\bo_\bn_\bl_\by _\bf_\bi_\bl_\be _\bs_\by_\bs_\bt_\be_\bm. An attempt was made to modify a file or
+ create a directory on a file system that was read-only at the
+ time.
+
+ 31 EMLINK _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bl_\bi_\bn_\bk_\bs. The maximum allowable number of hard links to a
+ single file has been exceeded (see pathconf(2) for how to obtain
+ this value).
+
+ 32 EPIPE _\bB_\br_\bo_\bk_\be_\bn _\bp_\bi_\bp_\be. A write on a pipe, socket or FIFO for which there
+ is no process to read the data.
+
+ 33 EDOM _\bN_\bu_\bm_\be_\br_\bi_\bc_\ba_\bl _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt _\bo_\bu_\bt _\bo_\bf _\bd_\bo_\bm_\ba_\bi_\bn. A numerical input argument was
+ outside the defined domain of the mathematical function.
+
+ 34 ERANGE _\bR_\be_\bs_\bu_\bl_\bt _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be. A result of the function was too large to fit
+ in the available space (perhaps exceeded precision).
+
+ 35 EAGAIN _\bR_\be_\bs_\bo_\bu_\br_\bc_\be _\bt_\be_\bm_\bp_\bo_\br_\ba_\br_\bi_\bl_\by _\bu_\bn_\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. This is a temporary condition
+ and later calls to the same routine may complete normally.
+
+ 36 EINPROGRESS _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bw _\bi_\bn _\bp_\br_\bo_\bg_\br_\be_\bs_\bs. An operation that takes a long
+ time to complete (such as a connect(2)) was attempted on a non-
+ blocking object (see fcntl(2)).
+
+ 37 EALREADY _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\ba_\bl_\br_\be_\ba_\bd_\by _\bi_\bn _\bp_\br_\bo_\bg_\br_\be_\bs_\bs. An operation was attempted on
+ a non-blocking object that already had an operation in progress.
+
+ 38 ENOTSOCK _\bS_\bo_\bc_\bk_\be_\bt _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bo_\bn _\bn_\bo_\bn_\b-_\bs_\bo_\bc_\bk_\be_\bt. Self-explanatory.
+
+ 39 EDESTADDRREQ _\bD_\be_\bs_\bt_\bi_\bn_\ba_\bt_\bi_\bo_\bn _\ba_\bd_\bd_\br_\be_\bs_\bs _\br_\be_\bq_\bu_\bi_\br_\be_\bd. A required address was
+ omitted from an operation on a socket.
+
+ 40 EMSGSIZE _\bM_\be_\bs_\bs_\ba_\bg_\be _\bt_\bo_\bo _\bl_\bo_\bn_\bg. A message sent on a socket was larger than
+ the internal message buffer or some other network limit.
+
+ 41 EPROTOTYPE _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bw_\br_\bo_\bn_\bg _\bt_\by_\bp_\be _\bf_\bo_\br _\bs_\bo_\bc_\bk_\be_\bt. A protocol was specified
+ that does not support the semantics of the socket type requested.
+ For example, you cannot use the Internet UDP protocol with type
+ SOCK_STREAM.
+
+ 42 ENOPROTOOPT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bn_\bo_\bt _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. A bad option or level was
+ specified in a getsockopt(2) or setsockopt(2) call.
+
+ 43 EPROTONOSUPPORT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The protocol has not been
+ configured into the system or no implementation for it exists.
+
+ 44 ESOCKTNOSUPPORT _\bS_\bo_\bc_\bk_\be_\bt _\bt_\by_\bp_\be _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The support for the socket
+ type has not been configured into the system or no implementation
+ for it exists.
+
+ 45 EOPNOTSUPP _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The attempted operation is not
+ supported for the type of object referenced. Usually this occurs
+ when a file descriptor refers to a file or socket that cannot
+ support this operation, for example, trying to _\ba_\bc_\bc_\be_\bp_\bt a
+ connection on a datagram socket.
+
+ 46 EPFNOSUPPORT _\bP_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bf_\ba_\bm_\bi_\bl_\by _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The protocol family has
+ not been configured into the system or no implementation for it
+ exists.
+
+ 47 EAFNOSUPPORT _\bA_\bd_\bd_\br_\be_\bs_\bs _\bf_\ba_\bm_\bi_\bl_\by _\bn_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd _\bb_\by _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl _\bf_\ba_\bm_\bi_\bl_\by. An
+ address incompatible with the requested protocol was used. For
+ example, you shouldn't necessarily expect to be able to use NS
+ addresses with Internet protocols.
+
+ 48 EADDRINUSE _\bA_\bd_\bd_\br_\be_\bs_\bs _\ba_\bl_\br_\be_\ba_\bd_\by _\bi_\bn _\bu_\bs_\be. Only one usage of each address is
+ normally permitted.
+
+ 49 EADDRNOTAVAIL _\bC_\ba_\bn_\b'_\bt _\ba_\bs_\bs_\bi_\bg_\bn _\br_\be_\bq_\bu_\be_\bs_\bt_\be_\bd _\ba_\bd_\bd_\br_\be_\bs_\bs. Normally results from an
+ attempt to create a socket with an address not on this machine.
+
+ 50 ENETDOWN _\bN_\be_\bt_\bw_\bo_\br_\bk _\bi_\bs _\bd_\bo_\bw_\bn. A socket operation encountered a dead
+ network.
+
+ 51 ENETUNREACH _\bN_\be_\bt_\bw_\bo_\br_\bk _\bi_\bs _\bu_\bn_\br_\be_\ba_\bc_\bh_\ba_\bb_\bl_\be. A socket operation was attempted
+ to an unreachable network.
+
+ 52 ENETRESET _\bN_\be_\bt_\bw_\bo_\br_\bk _\bd_\br_\bo_\bp_\bp_\be_\bd _\bc_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\bo_\bn _\br_\be_\bs_\be_\bt. The host you were
+ connected to crashed and rebooted.
+
+ 53 ECONNABORTED _\bS_\bo_\bf_\bt_\bw_\ba_\br_\be _\bc_\ba_\bu_\bs_\be_\bd _\bc_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\ba_\bb_\bo_\br_\bt. A connection abort was
+ caused internal to your host machine.
+
+ 54 ECONNRESET _\bC_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\br_\be_\bs_\be_\bt _\bb_\by _\bp_\be_\be_\br. A connection was forcibly closed
+ by a peer. This normally results from a loss of the connection
+ on the remote socket due to a timeout or a reboot.
+
+ 55 ENOBUFS _\bN_\bo _\bb_\bu_\bf_\bf_\be_\br _\bs_\bp_\ba_\bc_\be _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. An operation on a socket or pipe
+ was not performed because the system lacked sufficient buffer
+ space or because a queue was full.
+
+ 56 EISCONN _\bS_\bo_\bc_\bk_\be_\bt _\bi_\bs _\ba_\bl_\br_\be_\ba_\bd_\by _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd. A connect(2) request was made on
+ an already connected socket; or, a sendto(2) or sendmsg(2)
+ request on a connected socket specified a destination when
+ already connected.
+
+ 57 ENOTCONN _\bS_\bo_\bc_\bk_\be_\bt _\bi_\bs _\bn_\bo_\bt _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd. A request to send or receive data
+ was disallowed because the socket was not connected and (when
+ sending on a datagram socket) no address was supplied.
+
+ 58 ESHUTDOWN _\bC_\ba_\bn_\b'_\bt _\bs_\be_\bn_\bd _\ba_\bf_\bt_\be_\br _\bs_\bo_\bc_\bk_\be_\bt _\bs_\bh_\bu_\bt_\bd_\bo_\bw_\bn. A request to send data was
+ disallowed because the socket had already been shut down with a
+ previous shutdown(2) call.
+
+ 59 ETOOMANYREFS _\bT_\bo_\bo _\bm_\ba_\bn_\by _\br_\be_\bf_\be_\br_\be_\bn_\bc_\be_\bs_\b: _\bc_\ba_\bn_\b'_\bt _\bs_\bp_\bl_\bi_\bc_\be. Not used in OpenBSD.
+
+ 60 ETIMEDOUT _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bt_\bi_\bm_\be_\bd _\bo_\bu_\bt. A connect(2) or send(2) request failed
+ because the connected party did not properly respond after a
+ period of time. (The timeout period is dependent on the
+ communication protocol.)
+
+ 61 ECONNREFUSED _\bC_\bo_\bn_\bn_\be_\bc_\bt_\bi_\bo_\bn _\br_\be_\bf_\bu_\bs_\be_\bd. No connection could be made because
+ the target machine actively refused it. This usually results
+ from trying to connect to a service that is inactive on the
+ foreign host.
+
+ 62 ELOOP _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bl_\be_\bv_\be_\bl_\bs _\bo_\bf _\bs_\by_\bm_\bb_\bo_\bl_\bi_\bc _\bl_\bi_\bn_\bk_\bs. A path name lookup involved
+ more than 32 (SYMLOOP_MAX) symbolic links.
+
+ 63 ENAMETOOLONG _\bF_\bi_\bl_\be _\bn_\ba_\bm_\be _\bt_\bo_\bo _\bl_\bo_\bn_\bg. A component of a pathname exceeded
+ 255 (NAME_MAX) characters, or an entire pathname (including the
+ terminating NUL) exceeded 1024 (PATH_MAX) bytes.
+
+ 64 EHOSTDOWN _\bH_\bo_\bs_\bt _\bi_\bs _\bd_\bo_\bw_\bn. A socket operation failed because the
+ destination host was down.
+
+ 65 EHOSTUNREACH _\bN_\bo _\br_\bo_\bu_\bt_\be _\bt_\bo _\bh_\bo_\bs_\bt. A socket operation was attempted to an
+ unreachable host.
+
+ 66 ENOTEMPTY _\bD_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bn_\bo_\bt _\be_\bm_\bp_\bt_\by. A directory with entries other than `.'
+ and `..' was supplied to a remove directory or rename call.
+
+ 67 EPROCLIM _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bp_\br_\bo_\bc_\be_\bs_\bs_\be_\bs.
+
+ 68 EUSERS _\bT_\bo_\bo _\bm_\ba_\bn_\by _\bu_\bs_\be_\br_\bs. The quota system ran out of table entries.
+
+ 69 EDQUOT _\bD_\bi_\bs_\bc _\bq_\bu_\bo_\bt_\ba _\be_\bx_\bc_\be_\be_\bd_\be_\bd. A write(2) to an ordinary file, the
+ creation of a directory or symbolic link, or the creation of a
+ directory entry failed because the user's quota of disk blocks
+ was exhausted, or the allocation of an inode for a newly created
+ file failed because the user's quota of inodes was exhausted.
+
+ 70 ESTALE _\bS_\bt_\ba_\bl_\be _\bN_\bF_\bS _\bf_\bi_\bl_\be _\bh_\ba_\bn_\bd_\bl_\be. An attempt was made to access an open
+ file on an NFS filesystem which is now unavailable as referenced
+ by the file descriptor. This may indicate the file was deleted
+ on the NFS server or some other catastrophic event occurred.
+
+ 72 EBADRPC _\bR_\bP_\bC _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bs _\bb_\ba_\bd. Exchange of rpc(3) information was
+ unsuccessful.
+
+ 73 ERPCMISMATCH _\bR_\bP_\bC _\bv_\be_\br_\bs_\bi_\bo_\bn _\bw_\br_\bo_\bn_\bg. The version of rpc(3) on the remote
+ peer is not compatible with the local version.
+
+ 74 EPROGUNAVAIL _\bR_\bP_\bC _\bp_\br_\bo_\bg_\b. _\bn_\bo_\bt _\ba_\bv_\ba_\bi_\bl. The requested rpc(3) program is not
+ registered on the remote host.
+
+ 75 EPROGMISMATCH _\bP_\br_\bo_\bg_\br_\ba_\bm _\bv_\be_\br_\bs_\bi_\bo_\bn _\bw_\br_\bo_\bn_\bg. The requested version of the
+ rpc(3) program is not available on the remote host.
+
+ 76 EPROCUNAVAIL _\bB_\ba_\bd _\bp_\br_\bo_\bc_\be_\bd_\bu_\br_\be _\bf_\bo_\br _\bp_\br_\bo_\bg_\br_\ba_\bm. An rpc(3) call was attempted
+ for a procedure which doesn't exist in the remote program.
+
+ 77 ENOLCK _\bN_\bo _\bl_\bo_\bc_\bk_\bs _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be. A system-imposed limit on the number of
+ simultaneous file locks was reached.
+
+ 78 ENOSYS _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bn_\bo_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd. Attempted a system call that is not
+ available on this system.
+
+ 79 EFTYPE _\bI_\bn_\ba_\bp_\bp_\br_\bo_\bp_\br_\bi_\ba_\bt_\be _\bf_\bi_\bl_\be _\bt_\by_\bp_\be _\bo_\br _\bf_\bo_\br_\bm_\ba_\bt. The file contains invalid
+ data or set to invalid modes.
+
+ 80 EAUTH _\bA_\bu_\bt_\bh_\be_\bn_\bt_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\be_\br_\br_\bo_\br. Attempted to use an invalid authentication
+ ticket to mount a NFS filesystem.
+
+ 81 ENEEDAUTH _\bN_\be_\be_\bd _\ba_\bu_\bt_\bh_\be_\bn_\bt_\bi_\bc_\ba_\bt_\bo_\br. An authentication ticket must be
+ obtained before the given NFS filesystem may be mounted.
+
+ 82 EIPSEC _\bI_\bP_\bs_\be_\bc _\bp_\br_\bo_\bc_\be_\bs_\bs_\bi_\bn_\bg _\bf_\ba_\bi_\bl_\bu_\br_\be. IPsec subsystem error. Not used in
+ OpenBSD.
+
+ 83 ENOATTR _\bA_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be _\bn_\bo_\bt _\bf_\bo_\bu_\bn_\bd. A UFS Extended Attribute is not found for
+ the specified pathname.
+
+ 84 EILSEQ _\bI_\bl_\bl_\be_\bg_\ba_\bl _\bb_\by_\bt_\be _\bs_\be_\bq_\bu_\be_\bn_\bc_\be. An illegal sequence of bytes was used
+ when using wide characters.
+
+ 85 ENOMEDIUM _\bN_\bo _\bm_\be_\bd_\bi_\bu_\bm _\bf_\bo_\bu_\bn_\bd. Attempted to use a removable media device
+ with no medium present.
+
+ 86 EMEDIUMTYPE _\bW_\br_\bo_\bn_\bg _\bm_\be_\bd_\bi_\bu_\bm _\bt_\by_\bp_\be. Attempted to use a removable media
+ device with incorrect or incompatible medium.
+
+ 87 EOVERFLOW _\bV_\ba_\bl_\bu_\be _\bt_\bo_\bo _\bl_\ba_\br_\bg_\be _\bt_\bo _\bb_\be _\bs_\bt_\bo_\br_\be_\bd _\bi_\bn _\bd_\ba_\bt_\ba _\bt_\by_\bp_\be. A numerical
+ result of the function was too large to be stored in the caller
+ provided space.
+
+ 88 ECANCELED _\bO_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn _\bc_\ba_\bn_\bc_\be_\bl_\be_\bd. The requested operation was canceled.
+
+ 89 EIDRM _\bI_\bd_\be_\bn_\bt_\bi_\bf_\bi_\be_\br _\br_\be_\bm_\bo_\bv_\be_\bd. An IPC identifier was removed while the
+ current thread was waiting on it.
+
+ 90 ENOMSG _\bN_\bo _\bm_\be_\bs_\bs_\ba_\bg_\be _\bo_\bf _\bd_\be_\bs_\bi_\br_\be_\bd _\bt_\by_\bp_\be. An IPC message queue does not
+ contain a message of the desired type, or a message catalog does
+ not contain the requested message.
+
+ 91 ENOTSUP _\bN_\bo_\bt _\bs_\bu_\bp_\bp_\bo_\br_\bt_\be_\bd. The operation has requested an unsupported
+ value.
+
+D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS
+ Process
+ A process is a collection of one or more threads, plus the
+ resources shared by those threads such as process ID, address
+ space, user IDs and group IDs, and root directory and current
+ working directory.
+
+ Process ID
+ Each active process in the system is uniquely identified by a
+ non-negative integer called a process ID. The range of this ID
+ is from 1 to 32766.
+
+ Parent Process ID
+ A new process is created by a currently active process; (see
+ fork(2)). The parent process ID of a process is initially the
+ process ID of its creator. If the creating process exits, the
+ parent process ID of each child is set to the ID of a system
+ process, init(8).
+
+ Process Group
+ Each active process is a member of a process group that is
+ identified by a non-negative integer called the process group ID.
+ This is the process ID of the group leader. This grouping
+ permits the signaling of related processes (see termios(4)) and
+ the job control mechanisms of csh(1).
+
+ Session
+ A session is a set of one or more process groups. A session is
+ created by a successful call to setsid(2), which causes the
+ caller to become the only member of the only process group in the
+ new session.
+
+ Session Leader
+ A process that has created a new session by a successful call to
+ setsid(2), is known as a session leader. Only a session leader
+ may acquire a terminal as its controlling terminal (see
+ termios(4)).
+
+ Controlling Process
+ A session leader with a controlling terminal is a controlling
+ process.
+
+ Controlling Terminal
+ A terminal that is associated with a session is known as the
+ controlling terminal for that session and its members.
+
+ Terminal Process Group ID
+ A terminal may be acquired by a session leader as its controlling
+ terminal. Once a terminal is associated with a session, any of
+ the process groups within the session may be placed into the
+ foreground by setting the terminal process group ID to the ID of
+ the process group. This facility is used to arbitrate between
+ multiple jobs contending for the same terminal; (see csh(1) and
+ tty(4)).
+
+ Orphaned Process Group
+ A process group is considered to be _\bo_\br_\bp_\bh_\ba_\bn_\be_\bd if it is not under
+ the control of a job control shell. More precisely, a process
+ group is orphaned when none of its members has a parent process
+ that is in the same session as the group, but is in a different
+ process group. Note that when a process exits, the parent
+ process for its children is changed to be init(8), which is in a
+ separate session. Not all members of an orphaned process group
+ are necessarily orphaned processes (those whose creating process
+ has exited). The process group of a session leader is orphaned
+ by definition.
+
+ Thread A thread is a preemptively scheduled flow of control within a
+ process, with its own set of register values, floating point
+ environment, thread ID, signal mask, pending signal set,
+ alternate signal stack, thread control block address, resource
+ utilization, errno variable location, and values for thread-
+ specific keys. A process initially has just one thread, a
+ duplicate of the thread in the parent process that created this
+ process.
+
+ Real User ID and Real Group ID
+ Each user on the system is identified by a positive integer
+ termed the real user ID.
+
+ Each user is also a member of one or more groups. One of these
+ groups is distinguished from others and used in implementing
+ accounting facilities. The positive integer corresponding to
+ this distinguished group is termed the real group ID.
+
+ All processes have a real user ID and real group ID. These are
+ initialized from the equivalent attributes of the process that
+ created it.
+
+ Effective User ID, Effective Group ID, and Group Access List
+ Access to system resources is governed by two values: the
+ effective user ID, and the group access list. The first member
+ of the group access list is also known as the effective group ID.
+ (In POSIX.1, the group access list is known as the set of
+ supplementary group IDs, and it is unspecified whether the
+ effective group ID is a member of the list.)
+
+ The effective user ID and effective group ID are initially the
+ process's real user ID and real group ID respectively. Either
+ may be modified through execution of a set-user-ID or set-group-
+ ID file (possibly by one of its ancestors) (see execve(2)). By
+ convention, the effective group ID (the first member of the group
+ access list) is duplicated, so that the execution of a set-group-
+ ID program does not result in the loss of the original (real)
+ group ID.
+
+ The group access list is a set of group IDs used only in
+ determining resource accessibility. Access checks are performed
+ as described below in ``File Access Permissions''.
+
+ Saved Set User ID and Saved Set Group ID
+ When a process executes a new file, the effective user ID is set
+ to the owner of the file if the file is set-user-ID, and the
+ effective group ID (first element of the group access list) is
+ set to the group of the file if the file is set-group-ID. The
+ effective user ID of the process is then recorded as the saved
+ set-user-ID, and the effective group ID of the process is
+ recorded as the saved set-group-ID. These values may be used to
+ regain those values as the effective user or group ID after
+ reverting to the real ID (see setuid(2)). (In POSIX.1, the saved
+ set-user-ID and saved set-group-ID are optional, and are used in
+ setuid and setgid, but this does not work as desired for the
+ superuser.)
+
+ Superuser
+ A process is recognized as a _\bs_\bu_\bp_\be_\br_\bu_\bs_\be_\br process and is granted
+ special privileges if its effective user ID is 0.
+
+ Special Processes
+ The processes with process IDs of 0 and 1 are special. Process 0
+ is the scheduler. Process 1 is the initialization process
+ init(8), and is the ancestor of every other process in the
+ system. It is used to control the process structure.
+
+ Descriptor
+ An integer assigned by the system when a file is referenced by
+ open(2) or dup(2), or when a socket is created by pipe(2),
+ socket(2) or socketpair(2), which uniquely identifies an access
+ path to that file or socket from a given process or any of its
+ children.
+
+ File Name
+ Names consisting of up to 255 (NAME_MAX) characters may be used
+ to name an ordinary file, special file, or directory.
+
+ These characters may be arbitrary eight-bit values, excluding 0
+ (NUL) and the ASCII code for `/' (slash).
+
+ Note that it is generally unwise to use `*', `?', `[' or `]' as
+ part of file names because of the special meaning attached to
+ these characters by the shell.
+
+ Note also that NAME_MAX is an upper limit fixed by the kernel,
+ meant to be used for sizing buffers. Some filesystems may have
+ additional restrictions. These can be queried using pathconf(2)
+ and fpathconf(2).
+
+ Path Name
+ A path name is a NUL-terminated character string starting with an
+ optional slash `/', followed by zero or more directory names
+ separated by slashes, optionally followed by a file name. The
+ total length of a path name must be less than 1024 (PATH_MAX)
+ characters. Additional restrictions may apply, depending upon
+ the filesystem, to be queried with pathconf(2) or fpathconf(2) if
+ needed.
+
+ If a path name begins with a slash, the path search begins at the
+ _\br_\bo_\bo_\bt directory. Otherwise, the search begins from the current
+ working directory. A slash by itself names the root directory.
+ An empty pathname is invalid.
+
+ Directory
+ A directory is a special type of file that contains entries that
+ are references to other files. Directory entries are called
+ links. By convention, a directory contains at least two links,
+ `.' and `..', referred to as _\bd_\bo_\bt and _\bd_\bo_\bt_\b-_\bd_\bo_\bt respectively. Dot
+ refers to the directory itself and dot-dot refers to its parent
+ directory.
+
+ Root Directory and Current Working Directory
+ Each process has associated with it a concept of a root directory
+ and a current working directory for the purpose of resolving path
+ name searches. A process's root directory need not be the root
+ directory of the root file system.
+
+ File Access Permissions
+ Every file in the file system has a set of access permissions.
+ These permissions are used in determining whether a process may
+ perform a requested operation on the file (such as opening a file
+ for writing). Access permissions are established at the time a
+ file is created. They may be changed at some later time through
+ the chmod(2) call.
+
+ File access is broken down according to whether a file may be:
+ read, written, or executed. Directory files use the execute
+ permission to control if the directory may be searched.
+
+ File access permissions are interpreted by the system as they
+ apply to three different classes of users: the owner of the file,
+ those users in the file's group, anyone else. Every file has an
+ independent set of access permissions for each of these classes.
+ When an access check is made, the system decides if permission
+ should be granted by checking the access information applicable
+ to the caller.
+
+ Read, write, and execute/search permissions on a file are granted
+ to a process if:
+
+ The process's effective user ID is that of the superuser. (Note:
+ even the superuser cannot execute a non-executable file.)
+
+ The process's effective user ID matches the user ID of the owner
+ of the file and the owner permissions allow the access.
+
+ The process's effective user ID does not match the user ID of the
+ owner of the file, and either the process's effective group ID
+ matches the group ID of the file, or the group ID of the file is
+ in the process's group access list, and the group permissions
+ allow the access.
+
+ Neither the effective user ID nor effective group ID and group
+ access list of the process match the corresponding user ID and
+ group ID of the file, but the permissions for ``other users''
+ allow access.
+
+ Otherwise, permission is denied.
+
+ Sockets and Address Families
+ A socket is an endpoint for communication between processes.
+ Each socket has queues for sending and receiving data.
+
+ Sockets are typed according to their communications properties.
+ These properties include whether messages sent and received at a
+ socket require the name of the partner, whether communication is
+ reliable, the format used in naming message recipients, etc.
+
+ Each instance of the system supports some collection of socket
+ types; consult socket(2) for more information about the types
+ available and their properties.
+
+ Each instance of the system supports some number of sets of
+ communications protocols. Each protocol set supports addresses
+ of a certain format. An Address Family is the set of addresses
+ for a specific group of protocols. Each socket has an address
+ chosen from the address family in which the socket was created.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ intro(3), perror(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An k\bkq\bqu\bue\beu\bue\be manual page appeared in Version 6 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ i\bio\boc\bct\btl\bl - control device
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/i\bio\boc\bct\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bio\boc\bct\btl\bl(_\bi_\bn_\bt _\bd, _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg _\br_\be_\bq_\bu_\be_\bs_\bt, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The i\bio\boc\bct\btl\bl() function manipulates the underlying device parameters of
+ special files. In particular, many operating characteristics of
+ character special files (e.g., terminals) may be controlled with i\bio\boc\bct\btl\bl()
+ requests.
+
+ The argument _\bd must be an open file descriptor. The third argument is
+ called _\ba_\br_\bg and contains additional information needed by this device to
+ perform the requested function. _\ba_\br_\bg is either an int or a pointer to a
+ device-specific data structure, depending upon the given _\br_\be_\bq_\bu_\be_\bs_\bt.
+
+ An k\bkq\bqu\bue\beu\bue\be _\br_\be_\bq_\bu_\be_\bs_\bt has encoded in it whether the argument is an ``in''
+ parameter or ``out'' parameter, and the size of the third argument (_\ba_\br_\bg)
+ in bytes. Macros and defines used in specifying an ioctl _\br_\be_\bq_\bu_\be_\bs_\bt are
+ located in the file <_\bs_\by_\bs_\b/_\bi_\bo_\bc_\bt_\bl_\b._\bh>.
+
+G\bGE\bEN\bNE\bER\bRI\bIC\bC I\bIO\bOC\bCT\bTL\bLS\bS
+ Some ioctls are applicable to any file descriptor. These include:
+
+ FIOCLEX
+ Set close-on-exec flag. The file will be closed when exec(3) is
+ invoked.
+
+ FIONCLEX
+ Clear close-on-exec flag. The file will remain open across
+ exec(3).
+
+ Some generic ioctls are not implemented for all types of file
+ descriptors. These include:
+
+ FIONREAD _\bi_\bn_\bt _\b*
+ Get the number of bytes that are immediately available for
+ reading.
+
+ FIONBIO _\bi_\bn_\bt _\b*
+ Set non-blocking I/O mode if the argument is non-zero. In non-
+ blocking mode, read(2) or write(2) calls return -1 and set _\be_\br_\br_\bn_\bo
+ to EAGAIN immediately when no data is available.
+
+ FIOASYNC _\bi_\bn_\bt _\b*
+ Set asynchronous I/O mode if the argument is non-zero. In
+ asynchronous mode, the process or process group specified by
+ FIOSETOWN will start receiving SIGIO signals when data is
+ available. The SIGIO signal will be delivered when data is
+ available on the file descriptor.
+
+ FIOSETOWN, FIOGETOWN _\bi_\bn_\bt _\b*
+ Set/get the process or the process group (if negative) that
+ should receive SIGIO signals when data is available.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If an error has occurred, a value of -1 is returned and _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ i\bio\boc\bct\btl\bl() will fail if:
+
+ [EBADF] _\bd is not a valid descriptor.
+
+ [ENOTTY] _\bd is not associated with a character special device.
+
+ [ENOTTY] The specified request does not apply to the kind of
+ object that the descriptor _\bd references.
+
+ [EINVAL] _\br_\be_\bq_\bu_\be_\bs_\bt or _\ba_\br_\bg is not valid.
+
+ [EFAULT] _\ba_\br_\bg points outside the process's allocated address
+ space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ cdio(1), chio(1), mt(1), execve(2), fcntl(2), intro(4), tty(4)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An i\bio\boc\bct\btl\bl() function call appeared in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ i\bis\bss\bse\bet\btu\bug\bgi\bid\bd - is current executable running setuid or setgid
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ i\bis\bss\bse\bet\btu\bug\bgi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The i\bis\bss\bse\bet\btu\bug\bgi\bid\bd() function returns 1 if the process was made setuid or
+ setgid as the result of the last or other previous e\bex\bxe\bec\bcv\bve\be() system calls.
+ Otherwise it returns 0.
+
+ This system call exists so that library routines (inside libtermlib,
+ libc, or other libraries) can guarantee safe behavior when used inside
+ setuid or setgid programs. Some library routines may be passed
+ insufficient information and hence not know whether the current program
+ was started setuid or setgid because higher level calling code may have
+ made changes to the uid, euid, gid, or egid. Hence these low-level
+ library routines are unable to determine if they are being run with
+ elevated or normal privileges.
+
+ In particular, it is wise to use this call to determine if a pathname
+ returned from a g\bge\bet\bte\ben\bnv\bv() call may safely be used to o\bop\bpe\ben\bn() the specified
+ file. Quite often this is not wise because the status of the effective
+ uid is not known.
+
+ The i\bis\bss\bse\bet\btu\bug\bgi\bid\bd() system call's result is unaffected by calls to s\bse\bet\btu\bui\bid\bd(),
+ s\bse\bet\btg\bgi\bid\bd(), or other such calls. In case of a f\bfo\bor\brk\bk(), the child process
+ inherits the same status.
+
+ The status of i\bis\bss\bse\bet\btu\bug\bgi\bid\bd() is only affected by e\bex\bxe\bec\bcv\bve\be(). If a child
+ process executes a new executable file, a new issetugid status will be
+ determined. This status is based on the existing process's uid, euid,
+ gid, and egid permissions and on the modes of the executable file. If
+ the new executable file modes are setuid or setgid, or if the existing
+ process is executing the new image with uid != euid or gid != egid, the
+ new process will be considered issetugid.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The i\bis\bss\bse\bet\btu\bug\bgi\bid\bd() function is always successful, and no return value is
+ reserved to indicate an error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ execve(2), setegid(2), seteuid(2), setgid(2), setuid(2), getenv(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The i\bis\bss\bse\bet\btu\bug\bgi\bid\bd() function call first appeared in OpenBSD 2.0.
+
+N\bNA\bAM\bME\bE
+ k\bkq\bqu\bue\beu\bue\be, k\bke\bev\bve\ben\bnt\bt - kernel event notification mechanism
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/e\bev\bve\ben\bnt\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ k\bkq\bqu\bue\beu\bue\be(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ k\bke\bev\bve\ben\bnt\bt(_\bi_\bn_\bt _\bk_\bq, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\be_\bv_\be_\bn_\bt_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ E\bEV\bV_\b_S\bSE\bET\bT(_\b&_\bk_\be_\bv, _\bi_\bd_\be_\bn_\bt, _\bf_\bi_\bl_\bt_\be_\br, _\bf_\bl_\ba_\bg_\bs, _\bf_\bf_\bl_\ba_\bg_\bs, _\bd_\ba_\bt_\ba, _\bu_\bd_\ba_\bt_\ba);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ k\bkq\bqu\bue\beu\bue\be() provides a generic method of notifying the user when an event
+ happens or a condition holds, based on the results of small pieces of
+ kernel code termed ``filters''. A kevent is identified by the (ident,
+ filter) pair; there may only be one unique kevent per kqueue.
+
+ The filter is executed upon the initial registration of a kevent in order
+ to detect whether a preexisting condition is present, and is also
+ executed whenever an event is passed to the filter for evaluation. If
+ the filter determines that the condition should be reported, then the
+ kevent is placed on the kqueue for the user to retrieve.
+
+ The filter is also run when the user attempts to retrieve the kevent from
+ the kqueue. If the filter indicates that the condition that triggered
+ the event no longer holds, the kevent is removed from the kqueue and is
+ not returned.
+
+ Multiple events which trigger the filter do not result in multiple
+ kevents being placed on the kqueue; instead, the filter will aggregate
+ the events into a single struct kevent. Calling c\bcl\blo\bos\bse\be() on a file
+ descriptor will remove any kevents that reference the descriptor.
+
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a descriptor. The
+ queue is not inherited by a child created with fork(2). Similarly,
+ kqueues cannot be passed across UNIX-domain sockets.
+
+ k\bke\bev\bve\ben\bnt\bt() is used to register events with the queue, and return any
+ pending events to the user. _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt is a pointer to an array of
+ _\bk_\be_\bv_\be_\bn_\bt structures, as defined in <_\bs_\by_\bs_\b/_\be_\bv_\be_\bn_\bt_\b._\bh>. All changes contained in
+ the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt are applied before any pending events are read from the
+ queue. _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs gives the size of _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt. _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt is a pointer to
+ an array of kevent structures. _\bn_\be_\bv_\be_\bn_\bt_\bs determines the size of _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+ When _\bn_\be_\bv_\be_\bn_\bt_\bs is zero, k\bke\bev\bve\ben\bnt\bt() will return immediately even if there is a
+ _\bt_\bi_\bm_\be_\bo_\bu_\bt specified unlike select(2). If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a non-null pointer, it
+ specifies a maximum interval to wait for an event, which will be
+ interpreted as a struct timespec. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a null pointer, k\bke\bev\bve\ben\bnt\bt()
+ waits indefinitely. To effect a poll, the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument should be
+ non-null, pointing to a zero-valued _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc structure. The same array
+ may be used for the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+
+ E\bEV\bV_\b_S\bSE\bET\bT() is a macro which is provided for ease of initializing a kevent
+ structure.
+
+ The _\bk_\be_\bv_\be_\bn_\bt structure is defined as:
+
+ struct kevent {
+ uintptr_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags; /* action flags for kqueue */
+ u_int fflags; /* filter flag value */
+ quad_t data; /* filter data value */
+ void *udata; /* opaque user data identifier */
+ };
+
+ The fields of struct kevent are:
+
+ ident Value used to identify this event. The exact interpretation
+ is determined by the attached filter, but often is a file
+ descriptor.
+
+ filter Identifies the kernel filter used to process this event. The
+ pre-defined system filters are described below.
+
+ flags Actions to perform on the event.
+
+ fflags Filter-specific flags.
+
+ data Filter-specific data value.
+
+ udata Opaque user-defined value passed through the kernel unchanged.
+
+ The _\bf_\bl_\ba_\bg_\bs field can contain the following values:
+
+ EV_ADD Adds the event to the kqueue. Re-adding an existing event
+ will modify the parameters of the original event, and not
+ result in a duplicate entry. Adding an event
+ automatically enables it, unless overridden by the
+ EV_DISABLE flag.
+
+ EV_ENABLE Permit k\bke\bev\bve\ben\bnt\bt() to return the event if it is triggered.
+
+ EV_DISABLE Disable the event so k\bke\bev\bve\ben\bnt\bt() will not return it. The
+ filter itself is not disabled.
+
+ EV_DELETE Removes the event from the kqueue. Events which are
+ attached to file descriptors are automatically deleted on
+ the last close of the descriptor.
+
+ EV_ONESHOT Causes the event to return only the first occurrence of
+ the filter being triggered. After the user retrieves the
+ event from the kqueue, it is deleted.
+
+ EV_CLEAR After the event is retrieved by the user, its state is
+ reset. This is useful for filters which report state
+ transitions instead of the current state. Note that some
+ filters may automatically set this flag internally.
+
+ EV_EOF Filters may set this flag to indicate filter-specific EOF
+ condition.
+
+ EV_ERROR See _\bR_\bE_\bT_\bU_\bR_\bN _\bV_\bA_\bL_\bU_\bE_\bS below.
+
+ The predefined system filters are listed below. Arguments may be passed
+ to and from the filter via the _\bf_\bf_\bl_\ba_\bg_\bs and _\bd_\ba_\bt_\ba fields in the kevent
+ structure.
+
+ EVFILT_READ Takes a descriptor as the identifier, and returns whenever
+ there is data available to read. The behavior of the
+ filter is slightly different depending on the descriptor
+ type.
+
+ Sockets
+ Sockets which have previously been passed to l\bli\bis\bst\bte\ben\bn()
+ return when there is an incoming connection pending.
+ _\bd_\ba_\bt_\ba contains the size of the listen backlog.
+
+ Other socket descriptors return when there is data to
+ be read, subject to the SO_RCVLOWAT value of the
+ socket buffer. This may be overridden with a per-
+ filter low water mark at the time the filter is added
+ by setting the NOTE_LOWAT flag in _\bf_\bf_\bl_\ba_\bg_\bs, and
+ specifying the new low water mark in _\bd_\ba_\bt_\ba. On return,
+ _\bd_\ba_\bt_\ba contains the number of bytes in the socket
+ buffer.
+
+ If the read direction of the socket has shutdown, then
+ the filter also sets EV_EOF in _\bf_\bl_\ba_\bg_\bs, and returns the
+ socket error (if any) in _\bf_\bf_\bl_\ba_\bg_\bs. It is possible for
+ EOF to be returned (indicating the connection is gone)
+ while there is still data pending in the socket
+ buffer.
+
+ Vnodes
+ Returns when the file pointer is not at the end of
+ file. _\bd_\ba_\bt_\ba contains the offset from current position
+ to end of file, and may be negative. If NOTE_EOF is
+ set in _\bf_\bf_\bl_\ba_\bg_\bs, k\bke\bev\bve\ben\bnt\bt() will also return when the file
+ pointer is at the end of file. The end of file
+ condition is indicated by the presence of NOTE_EOF in
+ _\bf_\bf_\bl_\ba_\bg_\bs on return.
+
+ Fifos, Pipes
+ Returns when there is data to read; _\bd_\ba_\bt_\ba contains the
+ number of bytes available.
+
+ When the last writer disconnects, the filter will set
+ EV_EOF in _\bf_\bl_\ba_\bg_\bs. This may be cleared by passing in
+ EV_CLEAR, at which point the filter will resume
+ waiting for data to become available before returning.
+
+ BPF devices
+ Returns when the BPF buffer is full, the BPF timeout
+ has expired, or when the BPF has ``immediate mode''
+ enabled and there is any data to read; _\bd_\ba_\bt_\ba contains
+ the number of bytes available.
+
+ EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever
+ it is possible to write to the descriptor. For sockets,
+ pipes, and FIFOs, _\bd_\ba_\bt_\ba will contain the amount of space
+ remaining in the write buffer. The filter will set EV_EOF
+ when the reader disconnects, and for the FIFO case, this
+ may be cleared by use of EV_CLEAR. Note that this filter
+ is not supported for vnodes or BPF devices.
+
+ For sockets, the low water mark and socket error handling
+ is identical to the EVFILT_READ case.
+
+ EVFILT_VNODE Takes a file descriptor as the identifier and the events
+ to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when one or more of
+ the requested events occurs on the descriptor. The events
+ to monitor are:
+
+ NOTE_DELETE u\bun\bnl\bli\bin\bnk\bk() was called on the file referenced
+ by the descriptor.
+
+ NOTE_WRITE A write occurred on the file referenced by
+ the descriptor.
+
+ NOTE_EXTEND The file referenced by the descriptor was
+ extended.
+
+ NOTE_TRUNCATE The file referenced by the descriptor was
+ truncated.
+
+ NOTE_ATTRIB The file referenced by the descriptor had
+ its attributes changed.
+
+ NOTE_LINK The link count on the file changed.
+
+ NOTE_RENAME The file referenced by the descriptor was
+ renamed.
+
+ NOTE_REVOKE Access to the file was revoked via
+ revoke(2) or the underlying file system was
+ unmounted.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_PROC Takes the process ID to monitor as the identifier and the
+ events to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when the
+ process performs one or more of the requested events. If
+ a process can normally see another process, it can attach
+ an event to it. The events to monitor are:
+
+ NOTE_EXIT The process has exited. The exit status
+ will be stored in _\bd_\ba_\bt_\ba in the same format
+ as the status set by wait(2).
+
+ NOTE_FORK The process has called f\bfo\bor\brk\bk().
+
+ NOTE_EXEC The process has executed a new process
+ via execve(2) or similar call.
+
+ NOTE_TRACK Follow a process across f\bfo\bor\brk\bk() calls.
+ The parent process will return with
+ NOTE_FORK set in the _\bf_\bf_\bl_\ba_\bg_\bs field, while
+ the child process will return with
+ NOTE_CHILD set in _\bf_\bf_\bl_\ba_\bg_\bs and the parent
+ PID in _\bd_\ba_\bt_\ba.
+
+ NOTE_TRACKERR This flag is returned if the system was
+ unable to attach an event to the child
+ process, usually due to resource
+ limitations.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_SIGNAL Takes the signal number to monitor as the identifier and
+ returns when the given signal is delivered to the process.
+ This coexists with the s\bsi\big\bgn\bna\bal\bl() and s\bsi\big\bga\bac\bct\bti\bio\bon\bn()
+ facilities, and has a lower precedence. The filter will
+ record all attempts to deliver a signal to a process, even
+ if the signal has been marked as SIG_IGN. Event
+ notification happens after normal signal delivery
+ processing. _\bd_\ba_\bt_\ba returns the number of times the signal
+ has occurred since the last call to k\bke\bev\bve\ben\bnt\bt(). This filter
+ automatically sets the EV_CLEAR flag internally.
+
+ EVFILT_TIMER Establishes an arbitrary timer identified by _\bi_\bd_\be_\bn_\bt. When
+ adding a timer, _\bd_\ba_\bt_\ba specifies the timeout period in
+ milliseconds. The timer will be periodic unless
+ EV_ONESHOT is specified. On return, _\bd_\ba_\bt_\ba contains the
+ number of times the timeout has expired since the last
+ call to k\bke\bev\bve\ben\bnt\bt(). This filter automatically sets the
+ EV_CLEAR flag internally.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a file descriptor.
+ If there was an error creating the kernel event queue, a value of -1 is
+ returned and errno set.
+
+ k\bke\bev\bve\ben\bnt\bt() returns the number of events placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, up to the
+ value given by _\bn_\be_\bv_\be_\bn_\bt_\bs. If an error occurs while processing an element
+ of the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and there is enough room in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, then the
+ event will be placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt with EV_ERROR set in _\bf_\bl_\ba_\bg_\bs and the
+ system error in _\bd_\ba_\bt_\ba. Otherwise, -1 will be returned, and errno will be
+ set to indicate the error condition. If the time limit expires, then
+ k\bke\bev\bve\ben\bnt\bt() returns 0.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() function fails if:
+
+ [ENOMEM] The kernel failed to allocate enough memory for the
+ kernel queue.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ The k\bke\bev\bve\ben\bnt\bt() function fails if:
+
+ [EACCES] The process does not have permission to register a
+ filter.
+
+ [EFAULT] There was an error reading or writing the _\bk_\be_\bv_\be_\bn_\bt
+ structure.
+
+ [EBADF] The specified descriptor is invalid.
+
+ [EINTR] A signal was delivered before the timeout expired and
+ before any events were placed on the kqueue for
+ return.
+
+ [EINVAL] The specified time limit or filter is invalid.
+
+ [ENOENT] The event could not be found to be modified or
+ deleted.
+
+ [ENOMEM] No memory was available to register the event.
+
+ [ESRCH] The specified process to attach to does not exist.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ poll(2), read(2), select(2), sigaction(2), wait(2), write(2), signal(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bkq\bqu\bue\beu\bue\be() and k\bke\bev\bve\ben\bnt\bt() functions first appeared in FreeBSD 4.1.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() system and this manual page were written by Jonathan Lemon
+ <_\bj_\bl_\be_\bm_\bo_\bn_\b@_\bF_\br_\be_\be_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+B\bBU\bUG\bGS\bS
+ It is currently not possible to watch FIFOs or AIO that reside on
+ anything but a UFS file system. Watching a vnode is possible on UFS, NFS
+ and MS-DOS file systems.
+
+ The _\bt_\bi_\bm_\be_\bo_\bu_\bt value is limited to 24 hours; longer timeouts will be
+ silently reinterpreted as 24 hours.
+
+N\bNA\bAM\bME\bE
+ k\bki\bil\bll\bl - send signal to a process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ k\bki\bil\bll\bl(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bi_\bn_\bt _\bs_\bi_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The k\bki\bil\bll\bl() function sends the signal given by _\bs_\bi_\bg to _\bp_\bi_\bd, a process or a
+ group of processes. _\bs_\bi_\bg may be one of the signals specified in
+ sigaction(2) or it may be 0, in which case error checking is performed
+ but no signal is actually sent. This can be used to check the validity
+ of _\bp_\bi_\bd.
+
+ For a process to have permission to send a signal to a process designated
+ by _\bp_\bi_\bd, the real or effective user ID of the receiving process must match
+ that of the sending process or the user must have appropriate privileges
+ (such as given by a set-user-ID program or the user is the superuser). A
+ single exception is the signal SIGCONT, which may always be sent to any
+ process with the same session ID as the caller.
+
+ If _\bp_\bi_\bd is greater than zero:
+ _\bs_\bi_\bg is sent to the process whose ID is equal to _\bp_\bi_\bd.
+
+ If _\bp_\bi_\bd is zero:
+ _\bs_\bi_\bg is sent to all processes whose group ID is equal to the
+ process group ID of the sender, and for which the process has
+ permission; this is a variant of killpg(3).
+
+ If _\bp_\bi_\bd is -1:
+ If the user has superuser privileges, the signal is sent to all
+ processes excluding system processes and the process sending the
+ signal. If the user is not the superuser, the signal is sent to
+ all processes with the same uid as the user excluding the process
+ sending the signal. No error is returned if any process could be
+ signaled.
+
+ Setuid and setgid processes are dealt with slightly differently. For the
+ non-root user, to prevent attacks against such processes, some signal
+ deliveries are not permitted and return the error EPERM. The following
+ signals are allowed through to this class of processes: SIGKILL, SIGINT,
+ SIGTERM, SIGSTOP, SIGTTIN, SIGTTOU, SIGTSTP, SIGHUP, SIGUSR1, SIGUSR2.
+
+ For compatibility with System V, if the process number is negative but
+ not -1, the signal is sent to all processes whose process group ID is
+ equal to the absolute value of the process number. This is a variant of
+ killpg(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ k\bki\bil\bll\bl() will fail and no signal will be sent if:
+
+ [EINVAL] _\bs_\bi_\bg is not a valid signal number.
+
+ [ESRCH] No process can be found corresponding to that
+ specified by _\bp_\bi_\bd.
+
+ [EPERM] The sending process is not the superuser and its
+ effective user ID does not match the effective user ID
+ of the receiving process. When signaling a process
+ group, this error is returned if none of the members
+ of the group could be signaled.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getpgrp(2), getpid(2), sigaction(2), killpg(3), raise(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The k\bki\bil\bll\bl() function is expected to conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bki\bil\bll\bl() system call first appeared in Version 3 AT&T UNIX. The _\bs_\bi_\bg
+ argument was introduced in Version 4 AT&T UNIX.
+
+B\bBU\bUG\bGS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that k\bki\bil\bll\bl(_\b0, _\bs_\bi_\bg) should
+ send signal _\bs_\bi_\bg to the calling process, but OpenBSD doesn't do so for
+ historical reasons.
+
+N\bNA\bAM\bME\bE
+ k\bkq\bqu\bue\beu\bue\be, k\bke\bev\bve\ben\bnt\bt - kernel event notification mechanism
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/e\bev\bve\ben\bnt\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ k\bkq\bqu\bue\beu\bue\be(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ k\bke\bev\bve\ben\bnt\bt(_\bi_\bn_\bt _\bk_\bq, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bk_\be_\bv_\be_\bn_\bt _\b*_\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, _\bi_\bn_\bt _\bn_\be_\bv_\be_\bn_\bt_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ E\bEV\bV_\b_S\bSE\bET\bT(_\b&_\bk_\be_\bv, _\bi_\bd_\be_\bn_\bt, _\bf_\bi_\bl_\bt_\be_\br, _\bf_\bl_\ba_\bg_\bs, _\bf_\bf_\bl_\ba_\bg_\bs, _\bd_\ba_\bt_\ba, _\bu_\bd_\ba_\bt_\ba);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ k\bkq\bqu\bue\beu\bue\be() provides a generic method of notifying the user when an event
+ happens or a condition holds, based on the results of small pieces of
+ kernel code termed ``filters''. A kevent is identified by the (ident,
+ filter) pair; there may only be one unique kevent per kqueue.
+
+ The filter is executed upon the initial registration of a kevent in order
+ to detect whether a preexisting condition is present, and is also
+ executed whenever an event is passed to the filter for evaluation. If
+ the filter determines that the condition should be reported, then the
+ kevent is placed on the kqueue for the user to retrieve.
+
+ The filter is also run when the user attempts to retrieve the kevent from
+ the kqueue. If the filter indicates that the condition that triggered
+ the event no longer holds, the kevent is removed from the kqueue and is
+ not returned.
+
+ Multiple events which trigger the filter do not result in multiple
+ kevents being placed on the kqueue; instead, the filter will aggregate
+ the events into a single struct kevent. Calling c\bcl\blo\bos\bse\be() on a file
+ descriptor will remove any kevents that reference the descriptor.
+
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a descriptor. The
+ queue is not inherited by a child created with fork(2). Similarly,
+ kqueues cannot be passed across UNIX-domain sockets.
+
+ k\bke\bev\bve\ben\bnt\bt() is used to register events with the queue, and return any
+ pending events to the user. _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt is a pointer to an array of
+ _\bk_\be_\bv_\be_\bn_\bt structures, as defined in <_\bs_\by_\bs_\b/_\be_\bv_\be_\bn_\bt_\b._\bh>. All changes contained in
+ the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt are applied before any pending events are read from the
+ queue. _\bn_\bc_\bh_\ba_\bn_\bg_\be_\bs gives the size of _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt. _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt is a pointer to
+ an array of kevent structures. _\bn_\be_\bv_\be_\bn_\bt_\bs determines the size of _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+ When _\bn_\be_\bv_\be_\bn_\bt_\bs is zero, k\bke\bev\bve\ben\bnt\bt() will return immediately even if there is a
+ _\bt_\bi_\bm_\be_\bo_\bu_\bt specified unlike select(2). If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a non-null pointer, it
+ specifies a maximum interval to wait for an event, which will be
+ interpreted as a struct timespec. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a null pointer, k\bke\bev\bve\ben\bnt\bt()
+ waits indefinitely. To effect a poll, the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument should be
+ non-null, pointing to a zero-valued _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc structure. The same array
+ may be used for the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt.
+
+ E\bEV\bV_\b_S\bSE\bET\bT() is a macro which is provided for ease of initializing a kevent
+ structure.
+
+ The _\bk_\be_\bv_\be_\bn_\bt structure is defined as:
+
+ struct kevent {
+ uintptr_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags; /* action flags for kqueue */
+ u_int fflags; /* filter flag value */
+ quad_t data; /* filter data value */
+ void *udata; /* opaque user data identifier */
+ };
+
+ The fields of struct kevent are:
+
+ ident Value used to identify this event. The exact interpretation
+ is determined by the attached filter, but often is a file
+ descriptor.
+
+ filter Identifies the kernel filter used to process this event. The
+ pre-defined system filters are described below.
+
+ flags Actions to perform on the event.
+
+ fflags Filter-specific flags.
+
+ data Filter-specific data value.
+
+ udata Opaque user-defined value passed through the kernel unchanged.
+
+ The _\bf_\bl_\ba_\bg_\bs field can contain the following values:
+
+ EV_ADD Adds the event to the kqueue. Re-adding an existing event
+ will modify the parameters of the original event, and not
+ result in a duplicate entry. Adding an event
+ automatically enables it, unless overridden by the
+ EV_DISABLE flag.
+
+ EV_ENABLE Permit k\bke\bev\bve\ben\bnt\bt() to return the event if it is triggered.
+
+ EV_DISABLE Disable the event so k\bke\bev\bve\ben\bnt\bt() will not return it. The
+ filter itself is not disabled.
+
+ EV_DELETE Removes the event from the kqueue. Events which are
+ attached to file descriptors are automatically deleted on
+ the last close of the descriptor.
+
+ EV_ONESHOT Causes the event to return only the first occurrence of
+ the filter being triggered. After the user retrieves the
+ event from the kqueue, it is deleted.
+
+ EV_CLEAR After the event is retrieved by the user, its state is
+ reset. This is useful for filters which report state
+ transitions instead of the current state. Note that some
+ filters may automatically set this flag internally.
+
+ EV_EOF Filters may set this flag to indicate filter-specific EOF
+ condition.
+
+ EV_ERROR See _\bR_\bE_\bT_\bU_\bR_\bN _\bV_\bA_\bL_\bU_\bE_\bS below.
+
+ The predefined system filters are listed below. Arguments may be passed
+ to and from the filter via the _\bf_\bf_\bl_\ba_\bg_\bs and _\bd_\ba_\bt_\ba fields in the kevent
+ structure.
+
+ EVFILT_READ Takes a descriptor as the identifier, and returns whenever
+ there is data available to read. The behavior of the
+ filter is slightly different depending on the descriptor
+ type.
+
+ Sockets
+ Sockets which have previously been passed to l\bli\bis\bst\bte\ben\bn()
+ return when there is an incoming connection pending.
+ _\bd_\ba_\bt_\ba contains the size of the listen backlog.
+
+ Other socket descriptors return when there is data to
+ be read, subject to the SO_RCVLOWAT value of the
+ socket buffer. This may be overridden with a per-
+ filter low water mark at the time the filter is added
+ by setting the NOTE_LOWAT flag in _\bf_\bf_\bl_\ba_\bg_\bs, and
+ specifying the new low water mark in _\bd_\ba_\bt_\ba. On return,
+ _\bd_\ba_\bt_\ba contains the number of bytes in the socket
+ buffer.
+
+ If the read direction of the socket has shutdown, then
+ the filter also sets EV_EOF in _\bf_\bl_\ba_\bg_\bs, and returns the
+ socket error (if any) in _\bf_\bf_\bl_\ba_\bg_\bs. It is possible for
+ EOF to be returned (indicating the connection is gone)
+ while there is still data pending in the socket
+ buffer.
+
+ Vnodes
+ Returns when the file pointer is not at the end of
+ file. _\bd_\ba_\bt_\ba contains the offset from current position
+ to end of file, and may be negative. If NOTE_EOF is
+ set in _\bf_\bf_\bl_\ba_\bg_\bs, k\bke\bev\bve\ben\bnt\bt() will also return when the file
+ pointer is at the end of file. The end of file
+ condition is indicated by the presence of NOTE_EOF in
+ _\bf_\bf_\bl_\ba_\bg_\bs on return.
+
+ Fifos, Pipes
+ Returns when there is data to read; _\bd_\ba_\bt_\ba contains the
+ number of bytes available.
+
+ When the last writer disconnects, the filter will set
+ EV_EOF in _\bf_\bl_\ba_\bg_\bs. This may be cleared by passing in
+ EV_CLEAR, at which point the filter will resume
+ waiting for data to become available before returning.
+
+ BPF devices
+ Returns when the BPF buffer is full, the BPF timeout
+ has expired, or when the BPF has ``immediate mode''
+ enabled and there is any data to read; _\bd_\ba_\bt_\ba contains
+ the number of bytes available.
+
+ EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever
+ it is possible to write to the descriptor. For sockets,
+ pipes, and FIFOs, _\bd_\ba_\bt_\ba will contain the amount of space
+ remaining in the write buffer. The filter will set EV_EOF
+ when the reader disconnects, and for the FIFO case, this
+ may be cleared by use of EV_CLEAR. Note that this filter
+ is not supported for vnodes or BPF devices.
+
+ For sockets, the low water mark and socket error handling
+ is identical to the EVFILT_READ case.
+
+ EVFILT_VNODE Takes a file descriptor as the identifier and the events
+ to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when one or more of
+ the requested events occurs on the descriptor. The events
+ to monitor are:
+
+ NOTE_DELETE u\bun\bnl\bli\bin\bnk\bk() was called on the file referenced
+ by the descriptor.
+
+ NOTE_WRITE A write occurred on the file referenced by
+ the descriptor.
+
+ NOTE_EXTEND The file referenced by the descriptor was
+ extended.
+
+ NOTE_TRUNCATE The file referenced by the descriptor was
+ truncated.
+
+ NOTE_ATTRIB The file referenced by the descriptor had
+ its attributes changed.
+
+ NOTE_LINK The link count on the file changed.
+
+ NOTE_RENAME The file referenced by the descriptor was
+ renamed.
+
+ NOTE_REVOKE Access to the file was revoked via
+ revoke(2) or the underlying file system was
+ unmounted.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_PROC Takes the process ID to monitor as the identifier and the
+ events to watch for in _\bf_\bf_\bl_\ba_\bg_\bs, and returns when the
+ process performs one or more of the requested events. If
+ a process can normally see another process, it can attach
+ an event to it. The events to monitor are:
+
+ NOTE_EXIT The process has exited. The exit status
+ will be stored in _\bd_\ba_\bt_\ba in the same format
+ as the status set by wait(2).
+
+ NOTE_FORK The process has called f\bfo\bor\brk\bk().
+
+ NOTE_EXEC The process has executed a new process
+ via execve(2) or similar call.
+
+ NOTE_TRACK Follow a process across f\bfo\bor\brk\bk() calls.
+ The parent process will return with
+ NOTE_FORK set in the _\bf_\bf_\bl_\ba_\bg_\bs field, while
+ the child process will return with
+ NOTE_CHILD set in _\bf_\bf_\bl_\ba_\bg_\bs and the parent
+ PID in _\bd_\ba_\bt_\ba.
+
+ NOTE_TRACKERR This flag is returned if the system was
+ unable to attach an event to the child
+ process, usually due to resource
+ limitations.
+
+ On return, _\bf_\bf_\bl_\ba_\bg_\bs contains the events which triggered the
+ filter.
+
+ EVFILT_SIGNAL Takes the signal number to monitor as the identifier and
+ returns when the given signal is delivered to the process.
+ This coexists with the s\bsi\big\bgn\bna\bal\bl() and s\bsi\big\bga\bac\bct\bti\bio\bon\bn()
+ facilities, and has a lower precedence. The filter will
+ record all attempts to deliver a signal to a process, even
+ if the signal has been marked as SIG_IGN. Event
+ notification happens after normal signal delivery
+ processing. _\bd_\ba_\bt_\ba returns the number of times the signal
+ has occurred since the last call to k\bke\bev\bve\ben\bnt\bt(). This filter
+ automatically sets the EV_CLEAR flag internally.
+
+ EVFILT_TIMER Establishes an arbitrary timer identified by _\bi_\bd_\be_\bn_\bt. When
+ adding a timer, _\bd_\ba_\bt_\ba specifies the timeout period in
+ milliseconds. The timer will be periodic unless
+ EV_ONESHOT is specified. On return, _\bd_\ba_\bt_\ba contains the
+ number of times the timeout has expired since the last
+ call to k\bke\bev\bve\ben\bnt\bt(). This filter automatically sets the
+ EV_CLEAR flag internally.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ k\bkq\bqu\bue\beu\bue\be() creates a new kernel event queue and returns a file descriptor.
+ If there was an error creating the kernel event queue, a value of -1 is
+ returned and errno set.
+
+ k\bke\bev\bve\ben\bnt\bt() returns the number of events placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, up to the
+ value given by _\bn_\be_\bv_\be_\bn_\bt_\bs. If an error occurs while processing an element
+ of the _\bc_\bh_\ba_\bn_\bg_\be_\bl_\bi_\bs_\bt and there is enough room in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt, then the
+ event will be placed in the _\be_\bv_\be_\bn_\bt_\bl_\bi_\bs_\bt with EV_ERROR set in _\bf_\bl_\ba_\bg_\bs and the
+ system error in _\bd_\ba_\bt_\ba. Otherwise, -1 will be returned, and errno will be
+ set to indicate the error condition. If the time limit expires, then
+ k\bke\bev\bve\ben\bnt\bt() returns 0.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() function fails if:
+
+ [ENOMEM] The kernel failed to allocate enough memory for the
+ kernel queue.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ The k\bke\bev\bve\ben\bnt\bt() function fails if:
+
+ [EACCES] The process does not have permission to register a
+ filter.
+
+ [EFAULT] There was an error reading or writing the _\bk_\be_\bv_\be_\bn_\bt
+ structure.
+
+ [EBADF] The specified descriptor is invalid.
+
+ [EINTR] A signal was delivered before the timeout expired and
+ before any events were placed on the kqueue for
+ return.
+
+ [EINVAL] The specified time limit or filter is invalid.
+
+ [ENOENT] The event could not be found to be modified or
+ deleted.
+
+ [ENOMEM] No memory was available to register the event.
+
+ [ESRCH] The specified process to attach to does not exist.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ poll(2), read(2), select(2), sigaction(2), wait(2), write(2), signal(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The k\bkq\bqu\bue\beu\bue\be() and k\bke\bev\bve\ben\bnt\bt() functions first appeared in FreeBSD 4.1.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The k\bkq\bqu\bue\beu\bue\be() system and this manual page were written by Jonathan Lemon
+ <_\bj_\bl_\be_\bm_\bo_\bn_\b@_\bF_\br_\be_\be_\bB_\bS_\bD_\b._\bo_\br_\bg>.
+
+B\bBU\bUG\bGS\bS
+ It is currently not possible to watch FIFOs or AIO that reside on
+ anything but a UFS file system. Watching a vnode is possible on UFS, NFS
+ and MS-DOS file systems.
+
+ The _\bt_\bi_\bm_\be_\bo_\bu_\bt value is limited to 24 hours; longer timeouts will be
+ silently reinterpreted as 24 hours.
+
+N\bNA\bAM\bME\bE
+ k\bkt\btr\bra\bac\bce\be - process tracing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/k\bkt\btr\bra\bac\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ k\bkt\btr\bra\bac\bce\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\br_\ba_\bc_\be_\bf_\bi_\bl_\be, _\bi_\bn_\bt _\bo_\bp_\bs, _\bi_\bn_\bt _\bt_\br_\bp_\bo_\bi_\bn_\bt_\bs, _\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The k\bkt\btr\bra\bac\bce\be() function enables or disables tracing of one or more
+ processes. Users may only trace their own processes. Only the superuser
+ can trace setuid or setgid programs. k\bkt\btr\bra\bac\bce\be() is only available on
+ kernels compiled with the K\bKT\bTR\bRA\bAC\bCE\bE option.
+
+ _\bt_\br_\ba_\bc_\be_\bf_\bi_\bl_\be gives the pathname of the file to be used for tracing. The
+ file must exist, be writable by the calling process, and not be a
+ symbolic link. All trace records are always appended to the file, so the
+ file must be truncated to zero length to discard previous trace data. If
+ tracing points are being disabled (see KTROP_CLEAR below), _\bt_\br_\ba_\bc_\be_\bf_\bi_\bl_\be may
+ be NULL.
+
+ The _\bo_\bp_\bs parameter specifies the requested ktrace operation. The defined
+ operations are:
+
+ KTROP_SET Enable trace points specified in _\bt_\br_\bp_\bo_\bi_\bn_\bt_\bs.
+ KTROP_CLEAR Disable trace points specified in _\bt_\br_\bp_\bo_\bi_\bn_\bt_\bs.
+ KTROP_CLEARFILE Stop all tracing.
+ KTRFLAG_DESCEND The tracing change should apply to the specified
+ process and all its current children.
+
+ The _\bt_\br_\bp_\bo_\bi_\bn_\bt_\bs parameter specifies the trace points of interest. The
+ defined trace points are:
+
+ KTRFAC_SYSCALL Trace system calls.
+ KTRFAC_SYSRET Trace return values from system calls.
+ KTRFAC_NAMEI Trace name lookup operations.
+ KTRFAC_GENIO Trace all I/O (note that this option can generate
+ much output).
+ KTRFAC_PSIG Trace posted signals.
+ KTRFAC_EMUL Trace emulation changes.
+ KTRFAC_CSW Trace context switch points.
+ KTRFAC_STRUCT Trace various structs
+ KTRFAC_USER Trace user data coming from utrace(2) calls.
+ KTRFAC_INHERIT Inherit tracing to future children.
+
+ The _\bp_\bi_\bd parameter refers to a process ID. If it is negative, it refers
+ to a process group ID.
+
+ Each tracing event outputs a record composed of a generic header followed
+ by a trace point specific structure. The generic header is:
+
+ struct ktr_header {
+ uint ktr_type; /* trace record type */
+ pid_t ktr_pid; /* process id */
+ pid_t ktr_tid; /* thread id */
+ struct timespec ktr_time; /* timestamp */
+ char ktr_comm[MAXCOMLEN+1]; /* command name */
+ size_t ktr_len; /* length of buf */
+ };
+
+ The _\bk_\bt_\br_\b__\bl_\be_\bn field specifies the length of the _\bk_\bt_\br_\b__\bt_\by_\bp_\be data that follows
+ this header. The _\bk_\bt_\br_\b__\bp_\bi_\bd, _\bk_\bt_\br_\b__\bt_\bi_\bd, and _\bk_\bt_\br_\b__\bc_\bo_\bm_\bm fields specify the
+ process, thread, and command generating the record. The _\bk_\bt_\br_\b__\bt_\bi_\bm_\be field
+ gives the time (with nanosecond resolution) that the record was
+ generated.
+
+ The generic header is followed by _\bk_\bt_\br_\b__\bl_\be_\bn bytes of a _\bk_\bt_\br_\b__\bt_\by_\bp_\be record.
+ The type specific records are defined in the <_\bs_\by_\bs_\b/_\bk_\bt_\br_\ba_\bc_\be_\b._\bh> include file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ k\bkt\btr\bra\bac\bce\be() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [EINVAL] No trace points were selected.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters,
+ or an entire pathname (including the terminating NUL)
+ exceeded PATH_MAX bytes.
+
+ [ENOENT] The named tracefile does not exist.
+
+ [EACCES] Search permission is denied for a component of the path
+ prefix or the path refers to a symbolic link.
+
+ [ELOOP] Too many symbolic links were encountered in translating
+ the pathname.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [ESRCH] No process can be found corresponding to that specified
+ by _\bp_\bi_\bd.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ kdump(1), ktrace(1), utrace(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A k\bkt\btr\bra\bac\bce\be() function call first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ c\bch\bho\bow\bwn\bn, l\blc\bch\bho\bow\bwn\bn, f\bfc\bch\bho\bow\bwn\bna\bat\bt, f\bfc\bch\bho\bow\bwn\bn - change owner and group of a file or
+ link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ c\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ l\blc\bch\bho\bow\bwn\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bn(_\bi_\bn_\bt _\bf_\bd, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfc\bch\bho\bow\bwn\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bu_\bi_\bd_\b__\bt _\bo_\bw_\bn_\be_\br, _\bg_\bi_\bd_\b__\bt _\bg_\br_\bo_\bu_\bp, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The owner ID and group ID of the file (or link) named by _\bp_\ba_\bt_\bh or
+ referenced by _\bf_\bd is changed as specified by the arguments _\bo_\bw_\bn_\be_\br and
+ _\bg_\br_\bo_\bu_\bp. The owner of a file may change the _\bg_\br_\bo_\bu_\bp to a group of which he
+ or she is a member, but the change _\bo_\bw_\bn_\be_\br capability is restricted to the
+ superuser.
+
+ By default, c\bch\bho\bow\bwn\bn() clears the set-user-ID and set-group-ID bits on the
+ file to prevent accidental or mischievous creation of set-user-ID and
+ set-group-ID programs. This behaviour can be overridden by setting the
+ sysctl(8) variable _\bf_\bs_\b._\bp_\bo_\bs_\bi_\bx_\b._\bs_\be_\bt_\bu_\bi_\bd to zero.
+
+ l\blc\bch\bho\bow\bwn\bn() operates similarly to how c\bch\bho\bow\bwn\bn() operated on older systems, and
+ does not follow symbolic links. It allows the owner and group of a
+ symbolic link to be set.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() function is equivalent to either the c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose ownership is changed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfc\bch\bho\bow\bwn\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to c\bch\bho\bow\bwn\bn() or l\blc\bch\bho\bow\bwn\bn(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ ownership of the symbolic link is changed.
+
+ f\bfc\bch\bho\bow\bwn\bn() is particularly useful when used in conjunction with the file
+ locking primitives (see flock(2)).
+
+ One of the owner or group IDs may be left unchanged by specifying it as
+ -1.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ c\bch\bho\bow\bwn\bn(), l\blc\bch\bho\bow\bwn\bn(), and f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail and the file or link will be
+ unchanged if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfc\bch\bho\bow\bwn\bna\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfc\bch\bho\bow\bwn\bn() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EINVAL] _\bf_\bd refers to a socket, not a file.
+
+ [EPERM] The effective user ID is not the superuser.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chgrp(1), chmod(2), flock(2), chown(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The c\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bna\bat\bt(), and l\blc\bch\bho\bow\bwn\bn() functions are expected to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The c\bch\bho\bow\bwn\bn() system call first appeared in Version 1 AT&T UNIX. Since
+ Version 6 AT&T UNIX it supports changing the group as well, and in
+ Version 7 AT&T UNIX _\bg_\br_\bo_\bu_\bp was made a separate argument.
+
+ The f\bfc\bch\bho\bow\bwn\bn() system call first appeared in 4.1cBSD.
+
+ The c\bch\bho\bow\bwn\bn() and f\bfc\bch\bho\bow\bwn\bn() system calls were changed to follow symbolic
+ links in 4.4BSD; therefore, and for compatibility with AT&T System V
+ Release 4 UNIX, the l\blc\bch\bho\bow\bwn\bn() system call was added to OpenBSD 2.1.
+
+ The f\bfc\bch\bho\bow\bwn\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ l\bli\bin\bnk\bk, l\bli\bin\bnk\bka\bat\bt - make hard link to a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ l\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ l\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bi_\bn_\bt _\bf_\bd_\b2, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The l\bli\bin\bnk\bk() function atomically creates the specified directory entry
+ (hard link) _\bn_\ba_\bm_\be_\b2 with the attributes of the underlying object pointed at
+ by _\bn_\ba_\bm_\be_\b1. If the link is successful: the link count of the underlying
+ object is incremented; _\bn_\ba_\bm_\be_\b1 and _\bn_\ba_\bm_\be_\b2 share equal access and rights to
+ the underlying object.
+
+ If _\bn_\ba_\bm_\be_\b1 is removed, the file _\bn_\ba_\bm_\be_\b2 is not deleted and the link count of
+ the underlying object is decremented.
+
+ _\bn_\ba_\bm_\be_\b1 must exist for the hard link to succeed and both _\bn_\ba_\bm_\be_\b1 and _\bn_\ba_\bm_\be_\b2
+ must be in the same file system. As mandated by POSIX.1 _\bn_\ba_\bm_\be_\b1 may not be
+ a directory.
+
+ The l\bli\bin\bnk\bka\bat\bt() function is equivalent to l\bli\bin\bnk\bk() except that where _\bn_\ba_\bm_\be_\b1 or
+ _\bn_\ba_\bm_\be_\b2 specifies a relative path, the directory entries linked are
+ resolved relative to the directories associated with file descriptors _\bf_\bd_\b1
+ or _\bf_\bd_\b2 (respectively) instead of the current working directory.
+
+ If l\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd_\b1 or _\bf_\bd_\b2 parameter, the current working directory is used for
+ resolving the respective _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_FOLLOW If _\bn_\ba_\bm_\be_\b1 names a symbolic link, a new link for
+ the target of the symbolic link is created.
+
+ If the AT_SYMLINK_FOLLOW flag is clear and _\bn_\ba_\bm_\be_\b1 names a symbolic link, a
+ new link is created for the symbolic link _\bn_\ba_\bm_\be_\b1 and not its target.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ l\bli\bin\bnk\bk() and l\bli\bin\bnk\bka\bat\bt() will fail and no link will be created if:
+
+ [ENOTDIR] A component of either path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of either path prefix does not exist.
+
+ [EOPNOTSUPP] The file system containing the file named by _\bn_\ba_\bm_\be_\b1
+ does not support links.
+
+ [EMLINK] The link count of the file named by _\bn_\ba_\bm_\be_\b1 would exceed
+ LINK_MAX.
+
+ [EACCES] A component of either path prefix denies search
+ permission.
+
+ [EACCES] The requested link requires writing in a directory
+ with a mode that denies write permission.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating one of the pathnames.
+
+ [ENOENT] The file named by _\bn_\ba_\bm_\be_\b1 does not exist.
+
+ [EEXIST] The link named by _\bn_\ba_\bm_\be_\b2 does exist.
+
+ [EPERM] The file named by _\bn_\ba_\bm_\be_\b1 is a directory and the
+ effective user ID is not superuser, or the file system
+ containing the file does not permit the use of l\bli\bin\bnk\bk()
+ on a directory.
+
+ [EPERM] The file named by _\bn_\ba_\bm_\be_\b1 is flagged immutable or
+ append-only.
+
+ [EXDEV] The link named by _\bn_\ba_\bm_\be_\b2 and the file named by _\bn_\ba_\bm_\be_\b1
+ are on different file systems.
+
+ [ENOSPC] The directory in which the entry for the new link is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [EDQUOT] The directory in which the entry for the new link is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system to make the directory entry.
+
+ [EROFS] The requested link requires writing in a directory on
+ a read-only file system.
+
+ [EFAULT] One of the pathnames specified is outside the
+ process's allocated address space.
+
+ Additionally, l\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_FOLLOW.
+
+ [EBADF] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ and the _\bf_\bd_\b1 or _\bf_\bd_\b2 argument, respectively, is neither
+ AT_FDCWD nor a valid file descriptor.
+
+ [ENOTDIR] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ and the _\bf_\bd_\b1 or _\bf_\bd_\b2 argument, respectively, is a valid
+ file descriptor but it does not reference a directory.
+
+ [EACCES] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ but search permission is denied for the directory
+ which the _\bf_\bd_\b1 or _\bf_\bd_\b2 file descriptor, respectively,
+ references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ln(1), readlink(2), symlink(2), unlink(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The l\bli\bin\bnk\bk() and l\bli\bin\bnk\bka\bat\bt() functions are expected to conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The l\bli\bin\bnk\bk() system call first appeared in Version 1 AT&T UNIX. The
+ l\bli\bin\bnk\bka\bat\bt() function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ l\bli\bin\bnk\bk, l\bli\bin\bnk\bka\bat\bt - make hard link to a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ l\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ l\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bi_\bn_\bt _\bf_\bd_\b2, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The l\bli\bin\bnk\bk() function atomically creates the specified directory entry
+ (hard link) _\bn_\ba_\bm_\be_\b2 with the attributes of the underlying object pointed at
+ by _\bn_\ba_\bm_\be_\b1. If the link is successful: the link count of the underlying
+ object is incremented; _\bn_\ba_\bm_\be_\b1 and _\bn_\ba_\bm_\be_\b2 share equal access and rights to
+ the underlying object.
+
+ If _\bn_\ba_\bm_\be_\b1 is removed, the file _\bn_\ba_\bm_\be_\b2 is not deleted and the link count of
+ the underlying object is decremented.
+
+ _\bn_\ba_\bm_\be_\b1 must exist for the hard link to succeed and both _\bn_\ba_\bm_\be_\b1 and _\bn_\ba_\bm_\be_\b2
+ must be in the same file system. As mandated by POSIX.1 _\bn_\ba_\bm_\be_\b1 may not be
+ a directory.
+
+ The l\bli\bin\bnk\bka\bat\bt() function is equivalent to l\bli\bin\bnk\bk() except that where _\bn_\ba_\bm_\be_\b1 or
+ _\bn_\ba_\bm_\be_\b2 specifies a relative path, the directory entries linked are
+ resolved relative to the directories associated with file descriptors _\bf_\bd_\b1
+ or _\bf_\bd_\b2 (respectively) instead of the current working directory.
+
+ If l\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd_\b1 or _\bf_\bd_\b2 parameter, the current working directory is used for
+ resolving the respective _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_FOLLOW If _\bn_\ba_\bm_\be_\b1 names a symbolic link, a new link for
+ the target of the symbolic link is created.
+
+ If the AT_SYMLINK_FOLLOW flag is clear and _\bn_\ba_\bm_\be_\b1 names a symbolic link, a
+ new link is created for the symbolic link _\bn_\ba_\bm_\be_\b1 and not its target.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ l\bli\bin\bnk\bk() and l\bli\bin\bnk\bka\bat\bt() will fail and no link will be created if:
+
+ [ENOTDIR] A component of either path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of either path prefix does not exist.
+
+ [EOPNOTSUPP] The file system containing the file named by _\bn_\ba_\bm_\be_\b1
+ does not support links.
+
+ [EMLINK] The link count of the file named by _\bn_\ba_\bm_\be_\b1 would exceed
+ LINK_MAX.
+
+ [EACCES] A component of either path prefix denies search
+ permission.
+
+ [EACCES] The requested link requires writing in a directory
+ with a mode that denies write permission.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating one of the pathnames.
+
+ [ENOENT] The file named by _\bn_\ba_\bm_\be_\b1 does not exist.
+
+ [EEXIST] The link named by _\bn_\ba_\bm_\be_\b2 does exist.
+
+ [EPERM] The file named by _\bn_\ba_\bm_\be_\b1 is a directory and the
+ effective user ID is not superuser, or the file system
+ containing the file does not permit the use of l\bli\bin\bnk\bk()
+ on a directory.
+
+ [EPERM] The file named by _\bn_\ba_\bm_\be_\b1 is flagged immutable or
+ append-only.
+
+ [EXDEV] The link named by _\bn_\ba_\bm_\be_\b2 and the file named by _\bn_\ba_\bm_\be_\b1
+ are on different file systems.
+
+ [ENOSPC] The directory in which the entry for the new link is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [EDQUOT] The directory in which the entry for the new link is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system to make the directory entry.
+
+ [EROFS] The requested link requires writing in a directory on
+ a read-only file system.
+
+ [EFAULT] One of the pathnames specified is outside the
+ process's allocated address space.
+
+ Additionally, l\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_FOLLOW.
+
+ [EBADF] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ and the _\bf_\bd_\b1 or _\bf_\bd_\b2 argument, respectively, is neither
+ AT_FDCWD nor a valid file descriptor.
+
+ [ENOTDIR] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ and the _\bf_\bd_\b1 or _\bf_\bd_\b2 argument, respectively, is a valid
+ file descriptor but it does not reference a directory.
+
+ [EACCES] The _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 argument specifies a relative path
+ but search permission is denied for the directory
+ which the _\bf_\bd_\b1 or _\bf_\bd_\b2 file descriptor, respectively,
+ references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ln(1), readlink(2), symlink(2), unlink(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The l\bli\bin\bnk\bk() and l\bli\bin\bnk\bka\bat\bt() functions are expected to conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The l\bli\bin\bnk\bk() system call first appeared in Version 1 AT&T UNIX. The
+ l\bli\bin\bnk\bka\bat\bt() function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ l\bli\bis\bst\bte\ben\bn - listen for connections on a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ l\bli\bis\bst\bte\ben\bn(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bb_\ba_\bc_\bk_\bl_\bo_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ To accept connections, a socket is first created with socket(2), a
+ willingness to accept incoming connections and a queue limit for incoming
+ connections are specified with l\bli\bis\bst\bte\ben\bn(), and then the connections are
+ accepted with accept(2). The l\bli\bis\bst\bte\ben\bn() call applies only to sockets of
+ type SOCK_STREAM or SOCK_SEQPACKET.
+
+ The _\bb_\ba_\bc_\bk_\bl_\bo_\bg parameter defines the maximum length the queue of pending
+ connections may grow to. If a connection request arrives with the queue
+ full the client may receive an error with an indication of ECONNREFUSED,
+ or, if the underlying protocol supports retransmission, the request may
+ be ignored so that retries may succeed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ l\bli\bis\bst\bte\ben\bn() will fail if:
+
+ [EBADF] The argument _\bs is not a valid descriptor.
+
+ [ENOTSOCK] The argument _\bs is not a socket.
+
+ [EOPNOTSUPP] The socket is not of a type that supports the
+ operation l\bli\bis\bst\bte\ben\bn().
+
+ [EINVAL] The socket is already connected.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), connect(2), socket(2), sysctl(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The l\bli\bis\bst\bte\ben\bn() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The l\bli\bis\bst\bte\ben\bn() system call first appeared in 4.1cBSD.
+
+B\bBU\bUG\bGS\bS
+ The _\bb_\ba_\bc_\bk_\bl_\bo_\bg is currently limited (silently) to the value of the
+ kern.somaxconn sysctl, which defaults to 128.
+
+N\bNA\bAM\bME\bE
+ l\bls\bse\bee\bek\bk - reposition read/write file offset
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bo_\bf_\bf_\b__\bt
+ l\bls\bse\bee\bek\bk(_\bi_\bn_\bt _\bf_\bi_\bl_\bd_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt, _\bi_\bn_\bt _\bw_\bh_\be_\bn_\bc_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The l\bls\bse\bee\bek\bk() function repositions the offset of the file descriptor _\bf_\bi_\bl_\bd_\be_\bs
+ to the argument _\bo_\bf_\bf_\bs_\be_\bt according to the directive _\bw_\bh_\be_\bn_\bc_\be. The argument
+ _\bf_\bi_\bl_\bd_\be_\bs must be an open file descriptor. l\bls\bse\bee\bek\bk() repositions the file
+ pointer _\bf_\bi_\bl_\bd_\be_\bs as follows:
+
+ If _\bw_\bh_\be_\bn_\bc_\be is SEEK_SET, the offset is set to _\bo_\bf_\bf_\bs_\be_\bt bytes.
+
+ If _\bw_\bh_\be_\bn_\bc_\be is SEEK_CUR, the offset is set to its current location
+ plus _\bo_\bf_\bf_\bs_\be_\bt bytes.
+
+ If _\bw_\bh_\be_\bn_\bc_\be is SEEK_END, the offset is set to the size of the file
+ plus _\bo_\bf_\bf_\bs_\be_\bt bytes.
+
+ The l\bls\bse\bee\bek\bk() function allows the file offset to be set beyond the end of
+ the existing end-of-file of the file. If data is later written at this
+ point, subsequent reads of the data in the gap return bytes of zeros
+ (until data is actually written into the gap).
+
+ Some devices are incapable of seeking. The value of the pointer
+ associated with such a device is undefined.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, l\bls\bse\bee\bek\bk() returns the resulting offset location
+ as measured in bytes from the beginning of the file. Otherwise, a value
+ of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ l\bls\bse\bee\bek\bk() will fail and the file pointer will remain unchanged if:
+
+ [EBADF] _\bf_\bi_\bl_\bd_\be_\bs is not an open file descriptor.
+
+ [ESPIPE] _\bf_\bi_\bl_\bd_\be_\bs is associated with a pipe, socket, or FIFO.
+
+ [EINVAL] _\bw_\bh_\be_\bn_\bc_\be is not a proper value or the resulting offset
+ would be negative on a file system or special device
+ that does not allow negative offsets to be used.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dup(2), open(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The l\bls\bse\bee\bek\bk() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A s\bse\bee\bek\bk() system call first appeared in Version 1 AT&T UNIX. In Version 7
+ AT&T UNIX it was renamed to l\bls\bse\bee\bek\bk() for ``long seek'' due to a larger
+ _\bo_\bf_\bf_\bs_\be_\bt argument type.
+
+B\bBU\bUG\bGS\bS
+ This document's use of _\bw_\bh_\be_\bn_\bc_\be is incorrect English, but is maintained for
+ historical reasons.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ m\bma\bad\bdv\bvi\bis\bse\be, p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be - give advice about use of memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bma\bad\bdv\bvi\bis\bse\be(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bb_\be_\bh_\ba_\bv);
+
+ _\bi_\bn_\bt
+ p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bb_\be_\bh_\ba_\bv);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bma\bad\bdv\bvi\bis\bse\be() system call allows a process that has knowledge of its
+ memory behavior to describe it to the system. The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be()
+ interface has the same effect, but returns the error value instead of
+ only setting _\be_\br_\br_\bn_\bo.
+
+ The possible behaviors are:
+
+ MADV_NORMAL No further special treatment needed.
+
+ MADV_RANDOM Expect random page access patterns.
+
+ MADV_SEQUENTIAL Expect sequential page references.
+
+ MADV_WILLNEED The pages will be referenced soon.
+
+ MADV_DONTNEED The pages will not be referenced soon.
+
+ MADV_SPACEAVAIL Ensure that resources are reserved.
+
+ MADV_FREE The pages don't contain any useful data and can be
+ recycled.
+
+ Portable programs that call the p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() interface should use the
+ aliases POSIX_MADV_NORMAL, POSIX_MADV_RANDOM, POSIX_MADV_SEQUENTIAL,
+ POSIX_MADV_WILLNEED, and POSIX_MADV_DONTNEED rather than the flags
+ described above.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bma\bad\bdv\bvi\bis\bse\be() function returns the value 0 if successful; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+ If successful, the p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() function will return zero. Otherwise
+ an error number will be returned to indicate the error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mincore(2), minherit(2), mprotect(2), msync(2), munmap(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() system call conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bma\bad\bdv\bvi\bis\bse\be() function first appeared in 4.4BSD. The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be()
+ function first appeared in OpenBSD 4.8.
+
+B\bBU\bUG\bGS\bS
+ The MADV_WILLNEED behavior is ignored. The MADV_SPACEAVAIL behavior is
+ not implemented and will always fail.
+
+N\bNA\bAM\bME\bE
+ m\bmi\bin\bnc\bco\bor\bre\be - determine residency of memory pages
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmi\bin\bnc\bco\bor\bre\be(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bc_\bh_\ba_\br _\b*_\bv_\be_\bc);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmi\bin\bnc\bco\bor\bre\be() system call allows a process to obtain information about
+ whether pages are core resident. Here the current core residency of the
+ pages is returned in the character array _\bv_\be_\bc, with a value of 1 meaning
+ that the page is in-core.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), minherit(2), mlock(2), mprotect(2), msync(2), munmap(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmi\bin\bnc\bco\bor\bre\be() function first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ m\bmi\bin\bnh\bhe\ber\bri\bit\bt - control the inheritance of pages
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmi\bin\bnh\bhe\ber\bri\bit\bt(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bi_\bn_\bh_\be_\br_\bi_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmi\bin\bnh\bhe\ber\bri\bit\bt() system call changes the specified pages to have the
+ inheritance characteristic _\bi_\bn_\bh_\be_\br_\bi_\bt. A page's inheritance characteristic
+ controls how it will be mapped in child processes as created by fork(2).
+
+ The possible inheritance characteristics are:
+
+ MAP_INHERIT_NONE Pages are not mapped in the child process.
+ MAP_INHERIT_COPY Private copy of pages are mapped in the child
+ process.
+ MAP_INHERIT_SHARE Mapped pages are shared between the parent and
+ child processes.
+ MAP_INHERIT_ZERO New anonymous pages (initialized to all zero
+ bytes) are mapped in the child process.
+
+ Not all implementations will guarantee that the inheritance
+ characteristic can be set on a page basis; the granularity of changes may
+ be as large as an entire region.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The m\bmi\bin\bnh\bhe\ber\bri\bit\bt() system call will fail if:
+
+ [EINVAL] The virtual address range specified by the _\ba_\bd_\bd_\br and
+ _\bl_\be_\bn arguments is not valid.
+
+ [EINVAL] The _\bi_\bn_\bh_\be_\br_\bi_\bt argument is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), mincore(2), mprotect(2), msync(2), munmap(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmi\bin\bnh\bhe\ber\bri\bit\bt() function first appeared in OpenBSD 2.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkd\bdi\bir\br, m\bmk\bkd\bdi\bir\bra\bat\bt - make a directory file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkd\bdi\bir\bra\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The directory _\bp_\ba_\bt_\bh is created with the access permissions specified by
+ _\bm_\bo_\bd_\be and restricted by the umask(2) of the calling process.
+
+ The directory's owner ID is set to the process's effective user ID. The
+ directory's group ID is set to that of the parent directory in which it
+ is created.
+
+ The m\bmk\bkd\bdi\bir\bra\bat\bt() function is equivalent to m\bmk\bkd\bdi\bir\br() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created directory is created
+ relative to the directory associated with file descriptor _\bf_\bd instead of
+ the current working directory.
+
+ If m\bmk\bkd\bdi\bir\bra\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkd\bdi\bir\br().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkd\bdi\bir\br() and m\bmk\bkd\bdi\bir\bra\bat\bt() will fail and no directory will be created if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [ENOSPC] The new directory cannot be created because there is
+ no space left on the file system that will contain the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the directory is being created.
+
+ [EDQUOT] The new directory cannot be created because the user's
+ quota of disk blocks on the file system that will
+ contain the directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the directory is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, m\bmk\bkd\bdi\bir\bra\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkd\bdi\bir\br() and m\bmk\bkd\bdi\bir\bra\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A m\bmk\bkd\bdi\bir\br() system call first appeared in Version 1 AT&T UNIX. It was
+ renamed to m\bma\bak\bkd\bdi\bir\br() in Version 2 AT&T UNIX. However, it did not exist
+ from Version 4 AT&T UNIX to 4.1BSD; in those releases, mknod(2) had to be
+ used. Since m\bmk\bkd\bdi\bir\br() reappeared in 4.1cBSD, it no longer requires
+ superuser privileges and it automatically creates the `.' and `..'
+ directory entries.
+
+ The m\bmk\bkd\bdi\bir\bra\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkd\bdi\bir\br, m\bmk\bkd\bdi\bir\bra\bat\bt - make a directory file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkd\bdi\bir\bra\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The directory _\bp_\ba_\bt_\bh is created with the access permissions specified by
+ _\bm_\bo_\bd_\be and restricted by the umask(2) of the calling process.
+
+ The directory's owner ID is set to the process's effective user ID. The
+ directory's group ID is set to that of the parent directory in which it
+ is created.
+
+ The m\bmk\bkd\bdi\bir\bra\bat\bt() function is equivalent to m\bmk\bkd\bdi\bir\br() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created directory is created
+ relative to the directory associated with file descriptor _\bf_\bd instead of
+ the current working directory.
+
+ If m\bmk\bkd\bdi\bir\bra\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkd\bdi\bir\br().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkd\bdi\bir\br() and m\bmk\bkd\bdi\bir\bra\bat\bt() will fail and no directory will be created if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [ENOSPC] The new directory cannot be created because there is
+ no space left on the file system that will contain the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the directory is being created.
+
+ [EDQUOT] The new directory cannot be created because the user's
+ quota of disk blocks on the file system that will
+ contain the directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the directory is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, m\bmk\bkd\bdi\bir\bra\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkd\bdi\bir\br() and m\bmk\bkd\bdi\bir\bra\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A m\bmk\bkd\bdi\bir\br() system call first appeared in Version 1 AT&T UNIX. It was
+ renamed to m\bma\bak\bkd\bdi\bir\br() in Version 2 AT&T UNIX. However, it did not exist
+ from Version 4 AT&T UNIX to 4.1BSD; in those releases, mknod(2) had to be
+ used. Since m\bmk\bkd\bdi\bir\br() reappeared in 4.1cBSD, it no longer requires
+ superuser privileges and it automatically creates the `.' and `..'
+ directory entries.
+
+ The m\bmk\bkd\bdi\bir\bra\bat\bt() system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkf\bfi\bif\bfo\bo, m\bmk\bkf\bfi\bif\bfo\boa\bat\bt - make a FIFO file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkf\bfi\bif\bfo\bo(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkf\bfi\bif\bfo\boa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ m\bmk\bkf\bfi\bif\bfo\bo() creates a new FIFO file with name _\bp_\ba_\bt_\bh. The access permissions
+ are specified by _\bm_\bo_\bd_\be and restricted by the umask(2) of the calling
+ process.
+
+ The FIFO's owner ID is set to the process's effective user ID. The
+ FIFO's group ID is set to that of the parent directory in which it is
+ created.
+
+ The m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() function is equivalent to m\bmk\bkf\bfi\bif\bfo\bo() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created FIFO is created relative to
+ the directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkf\bfi\bif\bfo\bo().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkf\bfi\bif\bfo\bo() and m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() will fail and no FIFO will be created if:
+
+ [EOPNOTSUPP] The kernel has not been configured to support FIFOs.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [ENOSPC] The directory in which the entry for the new FIFO is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the FIFO is being created.
+
+ [EDQUOT] The directory in which the entry for the new FIFO is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the FIFO is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkf\bfi\bif\bfo\bo and m\bmk\bkf\bfi\bif\bfo\boa\bat\bt functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmk\bkf\bfi\bif\bfo\boa\bat\bt function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkf\bfi\bif\bfo\bo, m\bmk\bkf\bfi\bif\bfo\boa\bat\bt - make a FIFO file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkf\bfi\bif\bfo\bo(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkf\bfi\bif\bfo\boa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ m\bmk\bkf\bfi\bif\bfo\bo() creates a new FIFO file with name _\bp_\ba_\bt_\bh. The access permissions
+ are specified by _\bm_\bo_\bd_\be and restricted by the umask(2) of the calling
+ process.
+
+ The FIFO's owner ID is set to the process's effective user ID. The
+ FIFO's group ID is set to that of the parent directory in which it is
+ created.
+
+ The m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() function is equivalent to m\bmk\bkf\bfi\bif\bfo\bo() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created FIFO is created relative to
+ the directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkf\bfi\bif\bfo\bo().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkf\bfi\bif\bfo\bo() and m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() will fail and no FIFO will be created if:
+
+ [EOPNOTSUPP] The kernel has not been configured to support FIFOs.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [ENOSPC] The directory in which the entry for the new FIFO is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the FIFO is being created.
+
+ [EDQUOT] The directory in which the entry for the new FIFO is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the FIFO is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, m\bmk\bkf\bfi\bif\bfo\boa\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkf\bfi\bif\bfo\bo and m\bmk\bkf\bfi\bif\bfo\boa\bat\bt functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmk\bkf\bfi\bif\bfo\boa\bat\bt function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkn\bno\bod\bd, m\bmk\bkn\bno\bod\bda\bat\bt - make a special file node
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkn\bno\bod\bd(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bd_\be_\bv_\b__\bt _\bd_\be_\bv);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkn\bno\bod\bda\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bd_\be_\bv_\b__\bt _\bd_\be_\bv);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmk\bkn\bno\bod\bd() function creates _\bp_\ba_\bt_\bh with a file type and mode of _\bm_\bo_\bd_\be, as
+ modified by umask(2). Only FIFO and device special files are supported
+ by this implementation.
+
+ If _\bm_\bo_\bd_\be is the bitwise OR of S_IFIFO and zero or more file permissions,
+ and _\bd_\be_\bv is zero, then a FIFO is created. If _\bm_\bo_\bd_\be is the bitwise OR of
+ S_IFCHR or S_IFBLK and zero or more file permissions, then a character or
+ block device special (respectively) is created with major and minor
+ device numbers extracted from _\bd_\be_\bv.
+
+ The m\bmk\bkn\bno\bod\bda\bat\bt() function is equivalent to m\bmk\bkn\bno\bod\bd() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created device special file is
+ created relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If m\bmk\bkn\bno\bod\bda\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkn\bno\bod\bd().
+
+ Creating a device special file with m\bmk\bkn\bno\bod\bd() or m\bmk\bkn\bno\bod\bda\bat\bt() requires
+ superuser privileges.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkn\bno\bod\bd() and m\bmk\bkn\bno\bod\bda\bat\bt() will fail and the file will be not created if:
+
+ [EINVAL] _\bm_\bo_\bd_\be is an invalid file type or _\bd_\be_\bv is an invalid
+ value for that file type.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] _\bm_\bo_\bd_\be is a device special and the process's effective
+ user ID is not superuser.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [ENOSPC] The directory in which the entry for the new node is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the node is being created.
+
+ [EDQUOT] The directory in which the entry for the new node is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the node is being created has been exhausted.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EINVAL] The process is running within an alternate root
+ directory, as created by chroot(2).
+
+ Additionally, m\bmk\bkn\bno\bod\bda\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chroot(2), mkfifo(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkn\bno\bod\bd() and m\bmk\bkn\bno\bod\bda\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmk\bkn\bno\bod\bd() system call first appeared in Version 4 AT&T UNIX, and
+ m\bmk\bkn\bno\bod\bda\bat\bt() has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmk\bkn\bno\bod\bd, m\bmk\bkn\bno\bod\bda\bat\bt - make a special file node
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkn\bno\bod\bd(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bd_\be_\bv_\b__\bt _\bd_\be_\bv);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmk\bkn\bno\bod\bda\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bm_\bo_\bd_\be_\b__\bt _\bm_\bo_\bd_\be, _\bd_\be_\bv_\b__\bt _\bd_\be_\bv);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmk\bkn\bno\bod\bd() function creates _\bp_\ba_\bt_\bh with a file type and mode of _\bm_\bo_\bd_\be, as
+ modified by umask(2). Only FIFO and device special files are supported
+ by this implementation.
+
+ If _\bm_\bo_\bd_\be is the bitwise OR of S_IFIFO and zero or more file permissions,
+ and _\bd_\be_\bv is zero, then a FIFO is created. If _\bm_\bo_\bd_\be is the bitwise OR of
+ S_IFCHR or S_IFBLK and zero or more file permissions, then a character or
+ block device special (respectively) is created with major and minor
+ device numbers extracted from _\bd_\be_\bv.
+
+ The m\bmk\bkn\bno\bod\bda\bat\bt() function is equivalent to m\bmk\bkn\bno\bod\bd() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the newly created device special file is
+ created relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If m\bmk\bkn\bno\bod\bda\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to m\bmk\bkn\bno\bod\bd().
+
+ Creating a device special file with m\bmk\bkn\bno\bod\bd() or m\bmk\bkn\bno\bod\bda\bat\bt() requires
+ superuser privileges.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmk\bkn\bno\bod\bd() and m\bmk\bkn\bno\bod\bda\bat\bt() will fail and the file will be not created if:
+
+ [EINVAL] _\bm_\bo_\bd_\be is an invalid file type or _\bd_\be_\bv is an invalid
+ value for that file type.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the path prefix does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] _\bm_\bo_\bd_\be is a device special and the process's effective
+ user ID is not superuser.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [ENOSPC] The directory in which the entry for the new node is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the node is being created.
+
+ [EDQUOT] The directory in which the entry for the new node is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the node is being created has been exhausted.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EEXIST] The named file exists.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EINVAL] The process is running within an alternate root
+ directory, as created by chroot(2).
+
+ Additionally, m\bmk\bkn\bno\bod\bda\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chroot(2), mkfifo(2), stat(2), umask(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmk\bkn\bno\bod\bd() and m\bmk\bkn\bno\bod\bda\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmk\bkn\bno\bod\bd() system call first appeared in Version 4 AT&T UNIX, and
+ m\bmk\bkn\bno\bod\bda\bat\bt() has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bml\blo\boc\bck\bk, m\bmu\bun\bnl\blo\boc\bck\bk - lock (unlock) physical pages in memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bml\blo\boc\bck\bk(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ m\bmu\bun\bnl\blo\boc\bck\bk(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bml\blo\boc\bck\bk() system call locks into memory the physical pages associated
+ with the virtual address range starting at _\ba_\bd_\bd_\br for _\bl_\be_\bn bytes. The
+ m\bmu\bun\bnl\blo\boc\bck\bk() call unlocks pages previously locked by one or more m\bml\blo\boc\bck\bk()
+ calls. For both, the _\ba_\bd_\bd_\br parameter should be aligned to a multiple of
+ the page size. If the _\bl_\be_\bn parameter is not a multiple of the page size,
+ it will be rounded up to be so. The entire range must be allocated.
+
+ After an m\bml\blo\boc\bck\bk() call, the indicated pages will cause neither a non-
+ resident page nor address-translation fault until they are unlocked.
+ They may still cause protection-violation faults or TLB-miss faults on
+ architectures with software-managed TLBs. The physical pages remain in
+ memory until all locked mappings for the pages are removed. Multiple
+ processes may have the same physical pages locked via their own virtual
+ address mappings. A single process may likewise have pages multiply
+ locked via different virtual mappings of the same pages or via nested
+ m\bml\blo\boc\bck\bk() calls on the same address range. Unlocking is performed
+ explicitly by m\bmu\bun\bnl\blo\boc\bck\bk() or implicitly by a call to munmap(2) which
+ deallocates the unmapped address range. Locked mappings are not
+ inherited by the child process after a fork(2).
+
+ Since physical memory is a potentially scarce resource, processes are
+ limited in how much they can lock down. A single process can m\bml\blo\boc\bck\bk() the
+ minimum of a system-wide ``wired pages'' limit and the per-process
+ RLIMIT_MEMLOCK resource limit.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bml\blo\boc\bck\bk() and m\bmu\bun\bnl\blo\boc\bck\bk() functions return the value 0 if successful;
+ otherwise the value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bml\blo\boc\bck\bk() will fail if:
+
+ [EINVAL] The address given is not page aligned or the length is
+ negative.
+
+ [EAGAIN] Locking the indicated range would exceed either the
+ system or per-process limit for locked memory.
+
+ [ENOMEM] Some portion of the indicated address range is not
+ allocated. There was an error faulting/mapping a
+ page.
+
+ m\bmu\bun\bnl\blo\boc\bck\bk() will fail if:
+
+ [EINVAL] The address given is not page aligned or _\ba_\bd_\bd_\br and _\bs_\bi_\bz_\be
+ specify a region that would extend beyond the end of
+ the address space.
+
+ [ENOMEM] Some portion of the indicated address range is not
+ allocated. Some portion of the indicated address
+ range is not locked.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fork(2), mincore(2), minherit(2), mlockall(2), mmap(2), munmap(2),
+ setrlimit(2), getpagesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bml\blo\boc\bck\bk() and m\bmu\bun\bnl\blo\boc\bck\bk() functions first appeared in 4.4BSD.
+
+B\bBU\bUG\bGS\bS
+ Unlike Sun's implementation, multiple m\bml\blo\boc\bck\bk() calls on the same address
+ range require the corresponding number of m\bmu\bun\bnl\blo\boc\bck\bk() calls to actually
+ unlock the pages, i.e., m\bml\blo\boc\bck\bk() nests. This should be considered a
+ consequence of the implementation and not a feature.
+
+ The per-process resource limit is a limit on the amount of virtual memory
+ locked, while the system-wide limit is for the number of locked physical
+ pages. Hence a process with two distinct locked mappings of the same
+ physical page counts as 2 pages against the per-process limit and as only
+ a single page in the system limit.
+
+N\bNA\bAM\bME\bE
+ m\bml\blo\boc\bck\bka\bal\bll\bl, m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl - lock (unlock) the address space of a process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bml\blo\boc\bck\bka\bal\bll\bl(_\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() system call locks into memory the physical pages
+ associated with the address space of a process until the address space is
+ unlocked, the process exits, or execs another program image.
+
+ The following flags affect the behavior of m\bml\blo\boc\bck\bka\bal\bll\bl():
+
+ MCL_CURRENT Lock all pages currently mapped into the process's address
+ space.
+
+ MCL_FUTURE Lock all pages mapped into the process's address space in
+ the future, at the time the mapping is established. Note
+ that this may cause future mappings to fail if those
+ mappings cause resource limits to be exceeded.
+
+ Since physical memory is a potentially scarce resource, processes are
+ limited in how much they can lock down. A single process can lock the
+ minimum of a system-wide ``wired pages'' limit and the per-process
+ RLIMIT_MEMLOCK resource limit.
+
+ The m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() call unlocks any locked memory regions in the process
+ address space. Any regions mapped after an m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() call will not be
+ locked.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions return the value 0 if
+ successful; otherwise the value -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bml\blo\boc\bck\bka\bal\bll\bl() will fail if:
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs argument is zero or includes unimplemented
+ flags.
+
+ [ENOMEM] Locking all of the pages currently mapped would exceed
+ either the system or per-process limit for locked
+ memory.
+
+ [EAGAIN] Some or all of the memory mapped into the process's
+ address space could not be locked when the call was
+ made.
+
+ [EPERM] The calling process does not have the appropriate
+ privileges to perform the requested operation.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mincore(2), mlock(2), mmap(2), munmap(2), setrlimit(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions first appeared in OpenBSD 2.9.
+
+B\bBU\bUG\bGS\bS
+ The per-process resource limit is a limit on the amount of virtual memory
+ locked, while the system-wide limit is for the number of locked physical
+ pages. Hence a process with two distinct locked mappings of the same
+ physical page counts as 2 pages against the per-process limit and only as
+ a single page in the system limit.
+
+N\bNA\bAM\bME\bE
+ m\bmm\bma\bap\bp - map files or devices into memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bmm\bma\bap\bp(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bp_\br_\bo_\bt, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bi_\bn_\bt _\bf_\bd, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmm\bma\bap\bp() function causes the contents of _\bf_\bd, starting at _\bo_\bf_\bf_\bs_\be_\bt, to be
+ mapped in memory at the given _\ba_\bd_\bd_\br. The mapping will extend at least _\bl_\be_\bn
+ bytes, subject to page alignment restrictions.
+
+ The _\ba_\bd_\bd_\br argument describes the address where the system should place the
+ mapping. If the MAP_FIXED flag is specified, the allocation will happen
+ at the specified address, replacing any previously established mappings
+ in its range. Otherwise, the mapping will be placed at the available
+ spot at _\ba_\bd_\bd_\br; failing that it will be placed "close by". If _\ba_\bd_\bd_\br is NULL
+ the system can pick any address. Except for MAP_FIXED mappings, the
+ system will never replace existing mappings.
+
+ The _\bl_\be_\bn argument describes the minimum amount of bytes the mapping will
+ span. Since m\bmm\bma\bap\bp() maps pages into memory, _\bl_\be_\bn may be rounded up to hit
+ a page boundary. If _\bl_\be_\bn is 0, the mapping will fail with EINVAL.
+
+ If an _\bf_\bd and _\bo_\bf_\bf_\bs_\be_\bt are specified, the resulting address may end up not
+ on a page boundary, in order to align the page offset in the _\ba_\bd_\bd_\br to the
+ page offset in _\bo_\bf_\bf_\bs_\be_\bt.
+
+ The protections (region accessibility) are specified in the _\bp_\br_\bo_\bt
+ argument. It should either be PROT_NONE (no permissions) or the bitwise
+ OR of one or more of the following values:
+
+ PROT_EXEC Pages may be executed.
+ PROT_READ Pages may be read.
+ PROT_WRITE Pages may be written.
+
+ The _\bf_\bl_\ba_\bg_\bs parameter specifies the type of the mapped object, mapping
+ options, and whether modifications made to the mapped copy of the page
+ are private to the process or are to be shared with other references.
+ Sharing, mapping type, and options are specified in the _\bf_\bl_\ba_\bg_\bs argument by
+ OR'ing the following values. Exactly one of the first two values must be
+ specified:
+
+ MAP_PRIVATE Modifications are private.
+
+ MAP_SHARED Modifications are shared.
+
+ Any combination of the following flags may additionally be used:
+
+ MAP_ANON Map anonymous memory not associated with any
+ specific file. The file descriptor used for
+ creating MAP_ANON must currently be -1 indicating no
+ name is associated with the region.
+
+ MAP_ANONYMOUS Synonym for MAP_ANON.
+
+ MAP_FIXED Demand that the mapping is placed at _\ba_\bd_\bd_\br, rather
+ than having the system select a location. _\ba_\bd_\bd_\br, _\bl_\be_\bn
+ and _\bo_\bf_\bf_\bs_\be_\bt (in the case of _\bf_\bd mappings) must be
+ multiples of the page size. Existing mappings in
+ the address range will be replaced. Use of this
+ option is discouraged.
+
+ Finally, the following flags are also provided for source compatibility
+ with code written for other operating systems, but are not recommended
+ for use in new OpenBSD code:
+
+ MAP_COPY Modifications are private and, unlike MAP_PRIVATE,
+ modifications made by others are not visible. On
+ OpenBSD this behaves just like MAP_PRIVATE.
+
+ MAP_FILE Mapped from a regular file, character special file,
+ or block special file specified by file descriptor
+ _\bf_\bd. On OpenBSD and all systems conforming to IEEE
+ Std 1003.1-2008 (``POSIX.1'') this is the default
+ mapping type and need not be specified.
+
+ MAP_HASSEMAPHORE
+ Notify the kernel that the region may contain
+ semaphores and that special handling may be
+ necessary. On OpenBSD this flag is ignored.
+
+ MAP_INHERIT Permit regions to be inherited across exec(3) system
+ calls. On OpenBSD this flag is ignored.
+
+ MAP_TRYFIXED Attempt to use the hint provided by _\ba_\bd_\bd_\br. On
+ OpenBSD this is the default behavior.
+
+ The close(2) function does not unmap pages; see munmap(2) for further
+ information.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bmm\bma\bap\bp() function returns a pointer to the mapped region if successful;
+ otherwise the value MAP_FAILED is returned and the global variable _\be_\br_\br_\bn_\bo
+ is set to indicate the error. A successful return from m\bmm\bma\bap\bp() will never
+ return the value MAP_FAILED.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmm\bma\bap\bp() will fail if:
+
+ [EACCES] The flag PROT_READ was specified as part of the _\bp_\br_\bo_\bt
+ parameter and _\bf_\bd was not open for reading. The flags
+ MAP_SHARED and PROT_WRITE were specified as part of
+ the _\bf_\bl_\ba_\bg_\bs and _\bp_\br_\bo_\bt parameters and _\bf_\bd was not open for
+ writing.
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EINVAL] MAP_PRIVATE and MAP_SHARED were both specified.
+
+ [EINVAL] MAP_FIXED was specified and the _\ba_\bd_\bd_\br parameter was not
+ page aligned.
+
+ [EINVAL] _\ba_\bd_\bd_\br and _\bl_\be_\bn specified a region that would extend
+ beyond the end of the address space.
+
+ [EINVAL] _\bf_\bd did not specify a regular, character special, or
+ block special file.
+
+ [EINVAL] The allocation _\bl_\be_\bn was 0.
+
+ [ENOMEM] MAP_FIXED was specified and the _\ba_\bd_\bd_\br parameter wasn't
+ available. MAP_ANON was specified and insufficient
+ memory was available.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), mincore(2), mlock(2), mprotect(2), mquery(2), msync(2),
+ munmap(2), getpagesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmm\bma\bap\bp() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmm\bma\bap\bp() system call first appeared in 4.1cBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that references to pages
+ beyond the end of a mapped object shall generate a SIGBUS signal;
+ however, OpenBSD generates a SIGSEGV signal in this case instead.
+
+ Additionally, IEEE Std 1003.1-2008 (``POSIX.1'') specifies that m\bmm\bma\bap\bp()
+ shall fail with EINVAL if neither MAP_PRIVATE nor MAP_SHARED is specified
+ by _\bf_\bl_\ba_\bg_\bs; however, for compatibility with old programs, OpenBSD instead
+ defaults to MAP_SHARED for mappings of character special files, and to
+ MAP_PRIVATE for all other mappings. New programs should not rely on this
+ behavior.
+
+B\bBU\bUG\bGS\bS
+ Due to a limitation of the current vm system (see uvm(9)), mapping
+ descriptors PROT_WRITE without also specifying PROT_READ is useless
+ (results in a segmentation fault when first accessing the mapping). This
+ means that such descriptors must be opened with O_RDWR, which requires
+ both read and write permissions on the underlying object.
+
+N\bNA\bAM\bME\bE
+ m\bmo\bou\bun\bnt\bt, u\bun\bnm\bmo\bou\bun\bnt\bt - mount or dismount a filesystem
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmo\bou\bun\bnt\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\by_\bp_\be, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bv_\bo_\bi_\bd _\b*_\bd_\ba_\bt_\ba);
+
+ _\bi_\bn_\bt
+ u\bun\bnm\bmo\bou\bun\bnt\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmo\bou\bun\bnt\bt() function grafts a filesystem object onto the system file tree
+ at the point _\bd_\bi_\br. The argument _\bd_\ba_\bt_\ba describes the filesystem object to
+ be mounted. The argument _\bt_\by_\bp_\be tells the kernel how to interpret _\bd_\ba_\bt_\ba
+ (see _\bt_\by_\bp_\be below). The contents of the filesystem become available
+ through the new mount point _\bd_\bi_\br. Any files in _\bd_\bi_\br at the time of a
+ successful mount are swept under the carpet, so to speak, and are
+ unavailable until the filesystem is unmounted.
+
+ The following _\bf_\bl_\ba_\bg_\bs may be specified to suppress default semantics which
+ affect filesystem access.
+
+ MNT_RDONLY The filesystem should be treated as read-only: even the
+ superuser may not write to it.
+
+ MNT_NOATIME Do not update the access time on files in the filesystem
+ unless the modification or status change times are also
+ being updated.
+
+ MNT_NOEXEC Do not allow files to be executed from the filesystem.
+
+ MNT_NOSUID Do not honor setuid or setgid bits on files when
+ executing them.
+
+ MNT_NODEV Do not interpret special files on the filesystem.
+
+ MNT_SYNCHRONOUS All I/O to the filesystem should be done synchronously.
+
+ MNT_ASYNC All I/O to the filesystem should be done asynchronously.
+
+ MNT_SOFTDEP Use soft dependencies. Applies to FFS filesystems only
+ (see 'softdep' in mount(8)).
+
+ The flag MNT_UPDATE indicates that the mount command is being applied to
+ an already mounted filesystem. This allows the mount flags to be changed
+ without requiring that the filesystem be unmounted and remounted. Some
+ filesystems may not allow all flags to be changed. For example, most
+ filesystems will not allow a change from read-write to read-only.
+
+ The _\bt_\by_\bp_\be argument defines the type of the filesystem. The types of
+ filesystems known to the system are defined in <_\bs_\by_\bs_\b/_\bm_\bo_\bu_\bn_\bt_\b._\bh>. _\bd_\ba_\bt_\ba is a
+ pointer to a structure that contains the type specific arguments to
+ mount. The currently supported types of filesystems and their type
+ specific data are:
+
+ MOUNT_CD9660
+ struct iso_args {
+ char *fspec; /* block special device to mount */
+ struct export_args export_info;
+ /* network export info */
+ int flags; /* mounting flags, see below */
+ };
+ #define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
+ #define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
+ #define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
+ #define ISOFSMNT_NOJOLIET 0x00000008 /* disable Joliet Ext.*/
+ #define ISOFSMNT_SESS 0x00000010 /* use iso_args.sess */
+
+ MOUNT_FFS
+ struct ufs_args {
+ char *fspec; /* block special file to mount */
+ struct export_args export_info;
+ /* network export information */
+ };
+
+ MOUNT_MFS
+ struct mfs_args {
+ char *fspec; /* name to export for statfs */
+ struct export_args export_info;
+ /* if we can export an MFS */
+ caddr_t base; /* base of filesystem in mem */
+ u_long size; /* size of filesystem */
+ };
+
+ MOUNT_MSDOS
+ struct msdosfs_args {
+ char *fspec; /* blocks special holding fs to mount */
+ struct export_args export_info;
+ /* network export information */
+ uid_t uid; /* uid that owns msdosfs files */
+ gid_t gid; /* gid that owns msdosfs files */
+ mode_t mask; /* mask to be applied for msdosfs perms */
+ int flags; /* see below */
+ };
+
+ /*
+ * Msdosfs mount options:
+ */
+ #define MSDOSFSMNT_SHORTNAME 1 /* Force old DOS short names only */
+ #define MSDOSFSMNT_LONGNAME 2 /* Force Win'95 long names */
+ #define MSDOSFSMNT_NOWIN95 4 /* Completely ignore Win95 entries */
+
+ MOUNT_NFS
+ struct nfs_args {
+ int version; /* args structure version */
+ struct sockaddr *addr; /* file server address */
+ int addrlen; /* length of address */
+ int sotype; /* Socket type */
+ int proto; /* and Protocol */
+ u_char *fh; /* File handle to be mounted */
+ int fhsize; /* Size, in bytes, of fh */
+ int flags; /* flags */
+ int wsize; /* write size in bytes */
+ int rsize; /* read size in bytes */
+ int readdirsize; /* readdir size in bytes */
+ int timeo; /* initial timeout in .1 secs */
+ int retrans; /* times to retry send */
+ int maxgrouplist; /* Max. size of group list */
+ int readahead; /* # of blocks to readahead */
+ int leaseterm; /* Term (sec) of lease */
+ int deadthresh; /* Retrans threshold */
+ char *hostname; /* server's name */
+ int acregmin; /* Attr cache file recently modified */
+ int acregmax; /* ac file not recently modified */
+ int acdirmin; /* ac for dir recently modified */
+ int acdirmax; /* ac for dir not recently modified */
+ };
+
+ MOUNT_NTFS
+ struct ntfs_args {
+ char *fspec; /* block special device to mount */
+ struct export_args export_info;
+ /* network export information */
+ uid_t uid; /* uid that owns ntfs files */
+ gid_t gid; /* gid that owns ntfs files */
+ mode_t mode; /* mask to be applied for ntfs perms */
+ u_long flag; /* additional flags */
+ };
+
+ /*
+ * ntfs mount options:
+ */
+ #define NTFS_MFLAG_CASEINS 0x00000001
+ #define NTFS_MFLAG_ALLNAMES 0x00000002
+
+ MOUNT_UDF
+ struct udf_args {
+ char *fspec; /* block special device to mount */
+ };
+
+ The u\bun\bnm\bmo\bou\bun\bnt\bt() function call disassociates the filesystem from the
+ specified mount point _\bd_\bi_\br.
+
+ The _\bf_\bl_\ba_\bg_\bs argument may specify MNT_FORCE to specify that the filesystem
+ should be forcibly unmounted even if files are still active. Active
+ special devices continue to work, but any further accesses to any other
+ active files result in errors even if the filesystem is later remounted.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmo\bou\bun\bnt\bt() will fail when one of the following occurs:
+
+ [EPERM] The caller is not the superuser.
+
+ [ENAMETOOLONG] The path name exceeded {MNAMELEN} characters.
+
+ [ELOOP] Too many symbolic links were encountered in translating a
+ pathname.
+
+ [ENOENT] A component of _\bd_\bi_\br does not exist.
+
+ [ENOTDIR] A component of _\bn_\ba_\bm_\be is not a directory, or a path prefix
+ of _\bs_\bp_\be_\bc_\bi_\ba_\bl is not a directory.
+
+ [EINVAL] An argument given was invalid.
+
+ [EBUSY] Another process currently holds a reference to _\bd_\bi_\br.
+
+ [EFAULT] _\bd_\bi_\br points outside the process's allocated address space.
+
+ [EOPNOTSUPP] _\bt_\by_\bp_\be is not supported by the kernel.
+
+ The following errors can occur for a ``ufs'' filesystem mount:
+
+ [ENODEV] A component of ufs_args _\bf_\bs_\bp_\be_\bc does not exist.
+
+ [ENOTBLK] _\bf_\bs_\bp_\be_\bc is not a block device.
+
+ [ENXIO] The major device number of _\bf_\bs_\bp_\be_\bc is out of range (this
+ indicates no device driver exists for the associated
+ hardware).
+
+ [EBUSY] _\bf_\bs_\bp_\be_\bc is already mounted.
+
+ [EINVAL] The super block for the filesystem had a bad magic number, an
+ out of range block size, or an invalid combination of flags.
+
+ [ENOMEM] Not enough memory was available to read the cylinder group
+ information for the filesystem.
+
+ [EIO] An I/O error occurred while reading the super block or
+ cylinder group information.
+
+ [EFAULT] _\bf_\bs_\bp_\be_\bc points outside the process's allocated address space.
+
+ [EROFS] The filesystem was not unmounted cleanly and MNT_FORCE was not
+ specified.
+
+ [EROFS] An attempt was made to mount a 4.2BSD filesystem without the
+ MNT_RDONLY flag.
+
+ The following errors can occur for an _\bN_\bF_\bS filesystem mount:
+
+ [ETIMEDOUT] _\bN_\bF_\bS timed out trying to contact the server.
+
+ [EFAULT] Some part of the information described by nfs_args points
+ outside the process's allocated address space.
+
+ The following errors can occur for a _\bm_\bf_\bs filesystem mount:
+
+ [EMFILE] No space remains in the mount table.
+
+ [EINVAL] The super block for the filesystem had a bad magic number or an
+ out of range block size.
+
+ [ENOMEM] Not enough memory was available to read the cylinder group
+ information for the filesystem.
+
+ [EIO] A paging error occurred while reading the super block or
+ cylinder group information.
+
+ [EFAULT] _\bN_\ba_\bm_\be points outside the process's allocated address space.
+
+ u\bun\bnm\bmo\bou\bun\bnt\bt() may fail with one of the following errors:
+
+ [EPERM] The caller is not the superuser.
+
+ [ENOTDIR] A component of the path is not a directory.
+
+ [EINVAL] An argument given was invalid.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters,
+ or an entire pathname (including the terminating NUL)
+ exceeded PATH_MAX bytes.
+
+ [ELOOP] Too many symbolic links were encountered in translating
+ the pathname.
+
+ [EINVAL] The requested directory is not in the mount table.
+
+ [EBUSY] A process is holding a reference to a file located on the
+ filesystem.
+
+ [EIO] An I/O error occurred while writing cached filesystem
+ information.
+
+ [EFAULT] _\bd_\bi_\br points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ statfs(2), mfs(8), mount(8), umount(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmo\bou\bun\bnt\bt() and u\bun\bnm\bmo\bou\bun\bnt\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The _\bf_\bl_\ba_\bg_\bs argument is supported by m\bmo\bou\bun\bnt\bt() since Version 5 AT&T
+ UNIX and by u\bun\bnm\bmo\bou\bun\bnt\bt() since 4.3BSD-Reno. The current calling convention
+ involving _\bt_\by_\bp_\be and _\bd_\ba_\bt_\ba arguments was introduced by 4.3BSD-Reno as well.
+
+B\bBU\bUG\bGS\bS
+ Some of the error codes need translation to more obvious messages.
+
+N\bNA\bAM\bME\bE
+ m\bmp\bpr\bro\bot\bte\bec\bct\bt - control the protection of pages
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmp\bpr\bro\bot\bte\bec\bct\bt(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bp_\br_\bo_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmp\bpr\bro\bot\bte\bec\bct\bt() system call sets the access protections for the pages that
+ contain the address range _\ba_\bd_\bd_\br through _\ba_\bd_\bd_\br + _\bl_\be_\bn - 1 (inclusive). If
+ _\bl_\be_\bn is 0, no action is taken on the page that contains _\ba_\bd_\bd_\br.
+
+ The protections (region accessibility) are specified in the _\bp_\br_\bo_\bt
+ argument. It should either be PROT_NONE (no permissions) or the bitwise
+ OR of one or more of the following values:
+
+ PROT_EXEC Pages may be executed.
+ PROT_READ Pages may be read.
+ PROT_WRITE Pages may be written.
+
+ Not all implementations will guarantee protection on a page basis; the
+ granularity of protection changes may be as large as an entire region.
+ Nor will all implementations guarantee to give exactly the requested
+ permissions; more permissions may be granted than requested by _\bp_\br_\bo_\bt.
+ However, if PROT_WRITE was not specified then the page will not be
+ writable.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmp\bpr\bro\bot\bte\bec\bct\bt() will fail if:
+
+ [EACCES] The process does not have sufficient access to the
+ underlying memory object to provide the requested
+ protection.
+
+ [ENOMEM] The process has locked future pages with
+ m\bml\blo\boc\bck\bka\bal\bll\bl(_\bM_\bC_\bL_\b__\bF_\bU_\bT_\bU_\bR_\bE), a page being protected is not
+ currently accessible, and making it accessible and
+ locked would exceed process or system limits.
+
+ [EINVAL] The _\bp_\br_\bo_\bt argument is invalid or the specified address
+ range would wrap around.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), mincore(2), msync(2), munmap(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmp\bpr\bro\bot\bte\bec\bct\bt() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmp\bpr\bro\bot\bte\bec\bct\bt() function first appeared in 4.4BSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The OpenBSD implementation of m\bmp\bpr\bro\bot\bte\bec\bct\bt() does not require _\ba_\bd_\bd_\br to be
+ page-aligned, although other implementations may.
+
+N\bNA\bAM\bME\bE
+ m\bmq\bqu\bue\ber\bry\by - provide mapping hints to applications
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd _\b*
+ m\bmq\bqu\bue\ber\bry\by(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bp_\br_\bo_\bt, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bi_\bn_\bt _\bf_\bd,
+ _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmq\bqu\bue\ber\bry\by() system call checks the existing memory mappings of a process
+ and returns hints to the caller about where to put a memory mapping.
+ This hint can be later used when performing memory mappings with the
+ mmap(2) system call with MAP_FIXED in the flags. The _\ba_\bd_\bd_\br argument
+ should be a memory location that which the caller specifies the preferred
+ address. The _\bs_\bi_\bz_\be argument specifies the requested size of the memory
+ area the caller is looking for. The _\bf_\bd and _\bo_\bf_\bf arguments specify the
+ file that will be mapped and the offset in it, this is the same as the
+ corresponding arguments to mmap(2).
+
+ The behavior of the function depends on the _\bf_\bl_\ba_\bg_\bs argument. If set to
+ MAP_FIXED the pointer _\ba_\bd_\bd_\br is used as a fixed hint and m\bmq\bqu\bue\ber\bry\by() will
+ return MAP_FAILED and set _\be_\br_\br_\bn_\bo to ENOMEM if there is not _\bs_\bi_\bz_\be bytes free
+ after that address. Otherwise it will return the hint addr. If no flags
+ are set m\bmq\bqu\bue\ber\bry\by() will use _\ba_\bd_\bd_\br as a starting point in memory and will
+ search forward to find a memory area with _\bs_\bi_\bz_\be bytes free and that will
+ be suitable for creating a mapping for the file and offset specified in
+ the _\bf_\bd and _\bo_\bf_\bf arguments. When no such area can be found m\bmq\bqu\bue\ber\bry\by() will
+ return and set _\be_\br_\br_\bn_\bo to indicate the error.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ When a memory range satisfying the request is found m\bmq\bqu\bue\ber\bry\by() returns the
+ available address. Otherwise, MAP_FAILED is returned and _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmq\bqu\bue\ber\bry\by() will fail if:
+
+ [EINVAL] MAP_FIXED was specified and the requested memory area
+ is unavailable.
+
+ [ENOMEM] There was not enough memory left after the hint
+ specified.
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mmap(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bmq\bqu\bue\ber\bry\by() function should not be used in portable applications.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmq\bqu\bue\ber\bry\by() function first appeared in OpenBSD 3.4.
+
+N\bNA\bAM\bME\bE
+ m\bms\bsg\bgc\bct\btl\bl - message control operations
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bms\bsg\bg.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bms\bsg\bgc\bct\btl\bl(_\bi_\bn_\bt _\bm_\bs_\bq_\bi_\bd, _\bi_\bn_\bt _\bc_\bm_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bq_\bi_\bd_\b__\bd_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bms\bsg\bgc\bct\btl\bl() system call performs some control operations on the message
+ queue specified by _\bm_\bs_\bq_\bi_\bd.
+
+ Each message queue has a data structure associated with it, parts of
+ which may be altered by m\bms\bsg\bgc\bct\btl\bl() and parts of which determine the actions
+ of m\bms\bsg\bgc\bct\btl\bl(). The data structure is defined in <_\bs_\by_\bs_\b/_\bm_\bs_\bg_\b._\bh> and contains
+ (amongst others) the following members:
+
+ struct msqid_ds {
+ struct ipc_perm msg_perm; /* msg queue permission bits */
+ u_long msg_cbytes; /* # of bytes in use on the queue */
+ u_long msg_qnum; /* # of msgs in the queue */
+ u_long msg_qbytes; /* max # of bytes on the queue */
+ pid_t msg_lspid; /* pid of last msgsnd() */
+ pid_t msg_lrpid; /* pid of last msgrcv() */
+ time_t msg_stime; /* time of last msgsnd() */
+ time_t msg_rtime; /* time of last msgrcv() */
+ time_t msg_ctime; /* time of last msgctl() */
+ };
+
+ The _\bi_\bp_\bc_\b__\bp_\be_\br_\bm structure used inside the _\bm_\bs_\bq_\bi_\bd_\b__\bd_\bs structure is defined in
+ <_\bs_\by_\bs_\b/_\bi_\bp_\bc_\b._\bh> and looks like this:
+
+ struct ipc_perm {
+ uid_t cuid; /* creator user id */
+ gid_t cgid; /* creator group id */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ mode_t mode; /* permission (9 bits, see chmod(2)) */
+ u_short seq; /* sequence # (to generate unique id) */
+ key_t key; /* user specified msg/sem/shm key */
+ };
+
+ The operation to be performed by m\bms\bsg\bgc\bct\btl\bl() is specified in _\bc_\bm_\bd and is one
+ of:
+
+ IPC_STAT Gather information about the message queue and place it in the
+ structure pointed to by _\bb_\bu_\bf.
+
+ IPC_SET Set the value of the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd, _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd, _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be
+ and _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs fields in the structure associated with _\bm_\bs_\bq_\bi_\bd.
+ The values are taken from the corresponding fields in the
+ structure pointed to by _\bb_\bu_\bf. This operation can only be
+ executed by the superuser, or a process that has an effective
+ user ID equal to either _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd in the
+ data structure associated with the message queue. The value
+ of _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs can only be increased by the superuser. Values
+ for _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs that exceed the system limit (MSGMNB from
+ <_\bs_\by_\bs_\b/_\bm_\bs_\bg_\b._\bh>) are silently truncated to that limit.
+
+ IPC_RMID Remove the message queue specified by _\bm_\bs_\bq_\bi_\bd and destroy the
+ data associated with it. Only the superuser or a process with
+ an effective UID equal to the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd
+ values in the data structure associated with the queue can do
+ this.
+
+ The permission to read from or write to a message queue (see msgsnd(2)
+ and msgrcv(2)) is determined by the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be field in the same way
+ as is done with files (see chmod(2)), but the effective UID can match
+ either the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd field or the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd field, and the
+ effective GID can match either _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd or _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bms\bsg\bgc\bct\btl\bl() will fail if:
+
+ [EPERM] _\bc_\bm_\bd is equal to IPC_SET or IPC_RMID and the caller is
+ not the superuser, nor does the effective UID match
+ either the _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd or _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd fields of the
+ data structure associated with the message queue.
+
+ An attempt is made to increase the value of _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs
+ through IPC_SET but the caller is not the superuser.
+
+ [EACCES] The command is IPC_STAT and the caller has no read
+ permission for this message queue.
+
+ [EINVAL] _\bm_\bs_\bq_\bi_\bd is not a valid message queue identifier.
+
+ _\bc_\bm_\bd is not a valid command.
+
+ [EFAULT] _\bb_\bu_\bf specifies an invalid address.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ msgget(2), msgrcv(2), msgsnd(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ Message queues appeared in AT&T System V Release 1 UNIX.
+
+N\bNA\bAM\bME\bE
+ m\bms\bsg\bgg\bge\bet\bt - get message queue
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bms\bsg\bg.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bms\bsg\bgg\bge\bet\bt(_\bk_\be_\by_\b__\bt _\bk_\be_\by, _\bi_\bn_\bt _\bm_\bs_\bg_\bf_\bl_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ m\bms\bsg\bgg\bge\bet\bt() returns the message queue identifier associated with _\bk_\be_\by. A
+ message queue identifier is a unique integer greater than zero.
+
+ A message queue is created if either _\bk_\be_\by is equal to IPC_PRIVATE, or _\bk_\be_\by
+ does not have a message queue identifier associated with it, and the
+ IPC_CREAT bit is set in _\bm_\bs_\bg_\bf_\bl_\bg.
+
+ If a new message queue is created, the data structure associated with it
+ (the _\bm_\bs_\bq_\bi_\bd_\b__\bd_\bs structure, see msgctl(2)) is initialized as follows:
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd and _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd are set to the effective UID of the
+ calling process.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd and _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd are set to the effective GID of the
+ calling process.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be is set to the lower 9 bits of _\bm_\bs_\bg_\bf_\bl_\bg.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bc_\bb_\by_\bt_\be_\bs, _\bm_\bs_\bg_\b__\bq_\bn_\bu_\bm, _\bm_\bs_\bg_\b__\bl_\bs_\bp_\bi_\bd, _\bm_\bs_\bg_\b__\bl_\br_\bp_\bi_\bd, _\bm_\bs_\bg_\b__\br_\bt_\bi_\bm_\be, and _\bm_\bs_\bg_\b__\bs_\bt_\bi_\bm_\be
+ are set to 0.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs is set to the system wide maximum value for the number of
+ bytes in a queue (MSGMNB).
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bc_\bt_\bi_\bm_\be is set to the current time.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion a positive message queue identifier is
+ returned. Otherwise, -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EACCES] A message queue is already associated with _\bk_\be_\by and the
+ caller has no permission to access it.
+
+ [EEXIST] Both IPC_CREAT and IPC_EXCL are set in _\bm_\bs_\bg_\bf_\bl_\bg, and a
+ message queue is already associated with _\bk_\be_\by.
+
+ [ENOSPC] A new message queue could not be created because the
+ system limit for the number of message queues has been
+ reached.
+
+ [ENOENT] IPC_CREAT was not set in _\bm_\bs_\bg_\bf_\bl_\bg and no message queue
+ associated with _\bk_\be_\by was found.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ msgctl(2), msgrcv(2), msgsnd(2), ftok(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ Message queues appeared in AT&T System V Release 1 UNIX.
+
+N\bNA\bAM\bME\bE
+ m\bms\bsg\bgr\brc\bcv\bv - receive a message from a message queue
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bms\bsg\bg.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bms\bsg\bgr\brc\bcv\bv(_\bi_\bn_\bt _\bm_\bs_\bq_\bi_\bd, _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg_\bp, _\bs_\bi_\bz_\be_\b__\bt _\bm_\bs_\bg_\bs_\bz, _\bl_\bo_\bn_\bg _\bm_\bs_\bg_\bt_\by_\bp, _\bi_\bn_\bt _\bm_\bs_\bg_\bf_\bl_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bms\bsg\bgr\brc\bcv\bv() function receives a message from the message queue specified
+ in _\bm_\bs_\bq_\bi_\bd, and places it into the structure pointed to by _\bm_\bs_\bg_\bp. This
+ structure should consist of the following members:
+
+ long mtype; /* message type */
+ char mtext[1]; /* body of message */
+
+ _\bm_\bt_\by_\bp_\be is an integer greater than 0 that can be used for selecting
+ messages, _\bm_\bt_\be_\bx_\bt is an array of bytes, with a size up to that of the
+ system limit (MSGMAX).
+
+ The value of _\bm_\bs_\bg_\bt_\by_\bp has one of the following meanings:
+
+ +\b+\bo\bo _\bm_\bs_\bg_\bt_\by_\bp is greater than 0. The first message of type _\bm_\bs_\bg_\bt_\by_\bp will be
+ received.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\bt_\by_\bp is equal to 0. The first message on the queue will be
+ received.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\bt_\by_\bp is less than 0. The first message of the lowest message type
+ that is less than or equal to the absolute value of _\bm_\bs_\bg_\bt_\by_\bp will be
+ received.
+
+ _\bm_\bs_\bg_\bs_\bz specifies the maximum length of the requested message. If the
+ received message has a length greater than _\bm_\bs_\bg_\bs_\bz it will be silently
+ truncated if the MSG_NOERROR flag is set in _\bm_\bs_\bg_\bf_\bl_\bg, otherwise an error
+ will be returned.
+
+ If no matching message is present on the message queue specified by
+ _\bm_\bs_\bq_\bi_\bd, the behavior of m\bms\bsg\bgr\brc\bcv\bv() depends on whether the IPC_NOWAIT flag is
+ set in _\bm_\bs_\bg_\bf_\bl_\bg or not. If IPC_NOWAIT is set, m\bms\bsg\bgr\brc\bcv\bv() will immediately
+ return a value of -1, and set _\be_\br_\br_\bn_\bo to EAGAIN. If IPC_NOWAIT is not set,
+ the calling process will be blocked until:
+
+ +\b+\bo\bo A message of the requested type becomes available on the message
+ queue.
+
+ +\b+\bo\bo The message queue is removed, in which case -1 will be returned, and
+ _\be_\br_\br_\bn_\bo set to EINVAL.
+
+ +\b+\bo\bo A signal is received and caught. -1 is returned, and _\be_\br_\br_\bn_\bo set to
+ EINTR.
+
+ If a message is successfully received, the data structure associated with
+ _\bm_\bs_\bq_\bi_\bd is updated as follows:
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bc_\bb_\by_\bt_\be_\bs is decremented by the size of the message.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bl_\br_\bp_\bi_\bd is set to the pid of the caller.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bl_\br_\bt_\bi_\bm_\be is set to the current time.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bq_\bn_\bu_\bm is decremented by 1.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, m\bms\bsg\bgr\brc\bcv\bv() returns the number of bytes received
+ into the _\bm_\bt_\be_\bx_\bt field of the structure pointed to by _\bm_\bs_\bg_\bp. Otherwise, -1
+ is returned, and _\be_\br_\br_\bn_\bo set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bms\bsg\bgr\brc\bcv\bv() will fail if:
+
+ [EINVAL] _\bm_\bs_\bq_\bi_\bd is not a valid message queue identifier.
+
+ _\bm_\bs_\bg_\bs_\bz is less than 0.
+
+ [E2BIG] A matching message was received, but its size was
+ greater than _\bm_\bs_\bg_\bs_\bz and the MSG_NOERROR flag was not
+ set in _\bm_\bs_\bg_\bf_\bl_\bg.
+
+ [EACCES] The calling process does not have read access to the
+ message queue.
+
+ [EFAULT] _\bm_\bs_\bg_\bp points to an invalid address.
+
+ [EINTR] The system call was interrupted by the delivery of a
+ signal.
+
+ [ENOMSG] There is no message of the requested type available on
+ the message queue, and IPC_NOWAIT is set in _\bm_\bs_\bg_\bf_\bl_\bg.
+
+ [EIDRM] The message queue was removed while m\bms\bsg\bgr\brc\bcv\bv() was
+ waiting for a message of the requested type to become
+ available on it.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ msgctl(2), msgget(2), msgsnd(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ Message queues appeared in AT&T System V Release 1 UNIX.
+
+N\bNA\bAM\bME\bE
+ m\bms\bsg\bgs\bsn\bnd\bd - send a message to a message queue
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bms\bsg\bg.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bms\bsg\bgs\bsn\bnd\bd(_\bi_\bn_\bt _\bm_\bs_\bq_\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg_\bp, _\bs_\bi_\bz_\be_\b__\bt _\bm_\bs_\bg_\bs_\bz, _\bi_\bn_\bt _\bm_\bs_\bg_\bf_\bl_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bms\bsg\bgs\bsn\bnd\bd() function sends a message to the message queue specified by
+ _\bm_\bs_\bq_\bi_\bd. _\bm_\bs_\bg_\bp points to a structure containing the message. This
+ structure should consist of the following members:
+
+ long mtype; /* message type */
+ char mtext[1]; /* body of message */
+
+ _\bm_\bt_\by_\bp_\be is an integer greater than 0 that can be used for selecting
+ messages (see msgrcv(2)); _\bm_\bt_\be_\bx_\bt is an array of _\bm_\bs_\bg_\bs_\bz bytes, with a size
+ between 0 and that of the system limit (MSGMAX).
+
+ If the number of bytes already on the message queue plus _\bm_\bs_\bg_\bs_\bz is bigger
+ than the maximum number of bytes on the message queue (_\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs,
+ see msgctl(2)), or the number of messages on all queues system-wide is
+ already equal to the system limit, _\bm_\bs_\bg_\bf_\bl_\bg determines the action of
+ m\bms\bsg\bgs\bsn\bnd\bd(). If _\bm_\bs_\bg_\bf_\bl_\bg has IPC_NOWAIT mask set in it, the call will return
+ immediately. If _\bm_\bs_\bg_\bf_\bl_\bg does not have IPC_NOWAIT set in it, the call will
+ block until:
+
+ +\b+\bo\bo The condition which caused the call to block does no longer exist.
+ The message will be sent.
+
+ +\b+\bo\bo The message queue is removed, in which case -1 will be returned, and
+ _\be_\br_\br_\bn_\bo is set to EINVAL.
+
+ +\b+\bo\bo The caller catches a signal. The call returns with _\be_\br_\br_\bn_\bo set to
+ EINTR.
+
+ After a successful call, the data structure associated with the message
+ queue is updated in the following way:
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bc_\bb_\by_\bt_\be_\bs is incremented by the size of the message.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bq_\bn_\bu_\bm is incremented by 1.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bl_\bs_\bp_\bi_\bd is set to the pid of the calling process.
+
+ +\b+\bo\bo _\bm_\bs_\bg_\b__\bs_\bt_\bi_\bm_\be is set to the current time.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bms\bsg\bgs\bsn\bnd\bd() will fail if:
+
+ [EINVAL] _\bm_\bs_\bq_\bi_\bd is not a valid message queue identifier.
+
+ _\bm_\bs_\bg_\bs_\bz is greater than _\bm_\bs_\bg_\b__\bq_\bb_\by_\bt_\be_\bs.
+
+ [EACCES] The calling process does not have write access to the
+ message queue.
+
+ [EAGAIN] There was no space for this message either on the
+ queue, or in the whole system, and IPC_NOWAIT was set
+ in _\bm_\bs_\bg_\bf_\bl_\bg.
+
+ [EFAULT] _\bm_\bs_\bg_\bp points to an invalid address.
+
+ [EINTR] The system call was interrupted by the delivery of a
+ signal.
+
+ [EIDRM] The message queue was removed while m\bms\bsg\bgs\bsn\bnd\bd() was
+ waiting for a resource to become available in order to
+ deliver the message.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ msgctl(2), msgget(2), msgrcv(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ Message queues appeared in AT&T System V Release 1 UNIX.
+
+N\bNA\bAM\bME\bE
+ m\bms\bsy\byn\bnc\bc - synchronize a mapped region
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bms\bsy\byn\bnc\bc(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bms\bsy\byn\bnc\bc() system call writes all pages with shared modifications in the
+ specified region of the process's address space back to permanent
+ storage, and, if requested, invalidates cached data mapped in the region.
+ If _\bl_\be_\bn is 0, all modified pages within the region containing _\ba_\bd_\bd_\br will be
+ flushed; if _\bl_\be_\bn is non-zero, only modified pages containing _\ba_\bd_\bd_\br and
+ _\bl_\be_\bn_\b-_\b1 succeeding locations will be flushed. Any required synchronization
+ of memory caches will also take place at this time. Filesystem
+ operations on a file that is mapped for shared modifications are
+ unpredictable except after an m\bms\bsy\byn\bnc\bc().
+
+ The _\bf_\bl_\ba_\bg_\bs argument is the bitwise OR of zero or more of the following
+ values:
+
+ MS_ASYNC Perform asynchronous writes.
+ MS_SYNC Perform synchronous writes.
+ MS_INVALIDATE Invalidate cached data after writing.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The following errors may be reported:
+
+ [EBUSY] The MS_INVALIDATE flag was specified and a portion of
+ the specified region was locked with mlock(2).
+
+ [EINVAL] The specified _\bf_\bl_\ba_\bg_\bs argument was invalid.
+
+ [EINVAL] The _\ba_\bd_\bd_\br parameter was not page aligned or _\ba_\bd_\bd_\br and
+ _\bs_\bi_\bz_\be specify a region that would extend beyond the end
+ of the address space.
+
+ [ENOMEM] Addresses in the specified region are outside the
+ range allowed for the address space of the process, or
+ specify one or more pages which are unmapped.
+
+ [EIO] An I/O error occurred while writing.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), mincore(2), minherit(2), mprotect(2), munmap(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bms\bsy\byn\bnc\bc() function first appeared in 4.4BSD. It was modified to
+ conform to IEEE Std 1003.1b-1993 (``POSIX.1b'')
+
+B\bBU\bUG\bGS\bS
+ Writes are currently done synchronously even if the MS_ASYNC flag is
+ specified.
+
+N\bNA\bAM\bME\bE
+ m\bml\blo\boc\bck\bk, m\bmu\bun\bnl\blo\boc\bck\bk - lock (unlock) physical pages in memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bml\blo\boc\bck\bk(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ m\bmu\bun\bnl\blo\boc\bck\bk(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bml\blo\boc\bck\bk() system call locks into memory the physical pages associated
+ with the virtual address range starting at _\ba_\bd_\bd_\br for _\bl_\be_\bn bytes. The
+ m\bmu\bun\bnl\blo\boc\bck\bk() call unlocks pages previously locked by one or more m\bml\blo\boc\bck\bk()
+ calls. For both, the _\ba_\bd_\bd_\br parameter should be aligned to a multiple of
+ the page size. If the _\bl_\be_\bn parameter is not a multiple of the page size,
+ it will be rounded up to be so. The entire range must be allocated.
+
+ After an m\bml\blo\boc\bck\bk() call, the indicated pages will cause neither a non-
+ resident page nor address-translation fault until they are unlocked.
+ They may still cause protection-violation faults or TLB-miss faults on
+ architectures with software-managed TLBs. The physical pages remain in
+ memory until all locked mappings for the pages are removed. Multiple
+ processes may have the same physical pages locked via their own virtual
+ address mappings. A single process may likewise have pages multiply
+ locked via different virtual mappings of the same pages or via nested
+ m\bml\blo\boc\bck\bk() calls on the same address range. Unlocking is performed
+ explicitly by m\bmu\bun\bnl\blo\boc\bck\bk() or implicitly by a call to munmap(2) which
+ deallocates the unmapped address range. Locked mappings are not
+ inherited by the child process after a fork(2).
+
+ Since physical memory is a potentially scarce resource, processes are
+ limited in how much they can lock down. A single process can m\bml\blo\boc\bck\bk() the
+ minimum of a system-wide ``wired pages'' limit and the per-process
+ RLIMIT_MEMLOCK resource limit.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bml\blo\boc\bck\bk() and m\bmu\bun\bnl\blo\boc\bck\bk() functions return the value 0 if successful;
+ otherwise the value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bml\blo\boc\bck\bk() will fail if:
+
+ [EINVAL] The address given is not page aligned or the length is
+ negative.
+
+ [EAGAIN] Locking the indicated range would exceed either the
+ system or per-process limit for locked memory.
+
+ [ENOMEM] Some portion of the indicated address range is not
+ allocated. There was an error faulting/mapping a
+ page.
+
+ m\bmu\bun\bnl\blo\boc\bck\bk() will fail if:
+
+ [EINVAL] The address given is not page aligned or _\ba_\bd_\bd_\br and _\bs_\bi_\bz_\be
+ specify a region that would extend beyond the end of
+ the address space.
+
+ [ENOMEM] Some portion of the indicated address range is not
+ allocated. Some portion of the indicated address
+ range is not locked.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fork(2), mincore(2), minherit(2), mlockall(2), mmap(2), munmap(2),
+ setrlimit(2), getpagesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bml\blo\boc\bck\bk() and m\bmu\bun\bnl\blo\boc\bck\bk() functions first appeared in 4.4BSD.
+
+B\bBU\bUG\bGS\bS
+ Unlike Sun's implementation, multiple m\bml\blo\boc\bck\bk() calls on the same address
+ range require the corresponding number of m\bmu\bun\bnl\blo\boc\bck\bk() calls to actually
+ unlock the pages, i.e., m\bml\blo\boc\bck\bk() nests. This should be considered a
+ consequence of the implementation and not a feature.
+
+ The per-process resource limit is a limit on the amount of virtual memory
+ locked, while the system-wide limit is for the number of locked physical
+ pages. Hence a process with two distinct locked mappings of the same
+ physical page counts as 2 pages against the per-process limit and as only
+ a single page in the system limit.
+
+N\bNA\bAM\bME\bE
+ m\bml\blo\boc\bck\bka\bal\bll\bl, m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl - lock (unlock) the address space of a process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bml\blo\boc\bck\bka\bal\bll\bl(_\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bi_\bn_\bt
+ m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() system call locks into memory the physical pages
+ associated with the address space of a process until the address space is
+ unlocked, the process exits, or execs another program image.
+
+ The following flags affect the behavior of m\bml\blo\boc\bck\bka\bal\bll\bl():
+
+ MCL_CURRENT Lock all pages currently mapped into the process's address
+ space.
+
+ MCL_FUTURE Lock all pages mapped into the process's address space in
+ the future, at the time the mapping is established. Note
+ that this may cause future mappings to fail if those
+ mappings cause resource limits to be exceeded.
+
+ Since physical memory is a potentially scarce resource, processes are
+ limited in how much they can lock down. A single process can lock the
+ minimum of a system-wide ``wired pages'' limit and the per-process
+ RLIMIT_MEMLOCK resource limit.
+
+ The m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() call unlocks any locked memory regions in the process
+ address space. Any regions mapped after an m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() call will not be
+ locked.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions return the value 0 if
+ successful; otherwise the value -1 is returned and the global variable
+ _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bml\blo\boc\bck\bka\bal\bll\bl() will fail if:
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs argument is zero or includes unimplemented
+ flags.
+
+ [ENOMEM] Locking all of the pages currently mapped would exceed
+ either the system or per-process limit for locked
+ memory.
+
+ [EAGAIN] Some or all of the memory mapped into the process's
+ address space could not be locked when the call was
+ made.
+
+ [EPERM] The calling process does not have the appropriate
+ privileges to perform the requested operation.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mincore(2), mlock(2), mmap(2), munmap(2), setrlimit(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bml\blo\boc\bck\bka\bal\bll\bl() and m\bmu\bun\bnl\blo\boc\bck\bka\bal\bll\bl() functions first appeared in OpenBSD 2.9.
+
+B\bBU\bUG\bGS\bS
+ The per-process resource limit is a limit on the amount of virtual memory
+ locked, while the system-wide limit is for the number of locked physical
+ pages. Hence a process with two distinct locked mappings of the same
+ physical page counts as 2 pages against the per-process limit and only as
+ a single page in the system limit.
+
+N\bNA\bAM\bME\bE
+ m\bmu\bun\bnm\bma\bap\bp - remove a mapping
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmu\bun\bnm\bma\bap\bp(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmu\bun\bnm\bma\bap\bp() system call deletes the mappings for the specified address
+ range, and causes further references to addresses within the range to
+ generate invalid memory references.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmu\bun\bnm\bma\bap\bp() will fail if:
+
+ [EINVAL] The _\ba_\bd_\bd_\br parameter was not page aligned, _\ba_\bd_\bd_\br and _\bl_\be_\bn
+ specify a region that would extend beyond the end of
+ the address space, or some part of the region being
+ unmapped is not part of the currently valid address
+ space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ madvise(2), mincore(2), mlock(2), mlockall(2), mmap(2), mprotect(2),
+ msync(2), getpagesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmu\bun\bnm\bma\bap\bp() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ n\bna\ban\bno\bos\bsl\ble\bee\bep\bp - high resolution sleep
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ n\bna\ban\bno\bos\bsl\ble\bee\bep\bp(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\br_\be_\bm_\ba_\bi_\bn_\bd_\be_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() suspends execution of the calling process for the duration
+ specified by _\bt_\bi_\bm_\be_\bo_\bu_\bt. An unmasked signal will cause it to terminate the
+ sleep early, regardless of the SA_RESTART value on the interrupting
+ signal.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() function returns because the requested duration has
+ elapsed, the value returned will be zero.
+
+ If the n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() function returns due to the delivery of a signal, the
+ value returned will be -1, and the global variable _\be_\br_\br_\bn_\bo will be set to
+ indicate the interruption. If _\br_\be_\bm_\ba_\bi_\bn_\bd_\be_\br is non-null, the timespec
+ structure it references is updated to contain the unslept amount (the
+ requested duration minus the duration actually slept).
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ If any of the following conditions occur, the n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() function shall
+ return -1 and set _\be_\br_\br_\bn_\bo to the corresponding value.
+
+ [EINTR] k\bkq\bqu\bue\beu\bue\be was interrupted by the delivery of a signal.
+
+ [EINVAL] _\bt_\bi_\bm_\be_\bo_\bu_\bt specified a nanosecond value less than zero or
+ greater than 1000 million, or a second value less than
+ zero or greater than 100 million.
+
+ [EFAULT] Either _\bt_\bi_\bm_\be_\bo_\bu_\bt or _\br_\be_\bm_\ba_\bi_\bn_\bd_\be_\br points to memory that is
+ not a valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sleep(1), sleep(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of this system call, s\bsl\ble\bee\bep\bp(), appeared in Version 3 AT&T
+ UNIX, but was removed when alarm(3) was introduced into Version 7 AT&T
+ UNIX. The n\bna\ban\bno\bos\bsl\ble\bee\bep\bp() system call has been available since NetBSD 1.3
+ and was ported to OpenBSD 2.1 and FreeBSD 3.0.
+
+N\bNA\bAM\bME\bE
+ n\bnf\bfs\bss\bsv\bvc\bc - NFS services
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<n\bnf\bfs\bs/\b/n\bnf\bfs\bs.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ n\bnf\bfs\bss\bsv\bvc\bc(_\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bv_\bo_\bi_\bd _\b*_\ba_\br_\bg_\bs_\bt_\br_\bu_\bc_\bt_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The n\bnf\bfs\bss\bsv\bvc\bc() function is used by NFS daemons to pass information into the
+ kernel and also to enter the kernel as a server daemon. The _\bf_\bl_\ba_\bg_\bs
+ argument consists of several bits that show what action is to be taken
+ once in the kernel and the _\ba_\br_\bg_\bs_\bt_\br_\bu_\bc_\bt_\bp points to one of two structures
+ depending on which bits are set in flags.
+
+ To enter an nfsd(8) daemon into the kernel, n\bnf\bfs\bss\bsv\bvc\bc() is called with the
+ flag NFSSVC_NFSD and a pointer to a structure:
+
+ struct nfsd_srvargs {
+ struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
+ uid_t nsd_uid; /* Effective uid mapped to cred */
+ u_int32_t nsd_haddr; /* IP address of client */
+ struct xucred nsd_cr; /* Cred. uid maps to */
+ int nsd_authlen; /* Length of auth string (ret) */
+ u_char *nsd_authstr; /* Auth string (ret) */
+ int nsd_verflen; /* and the verifier */
+ u_char *nsd_verfstr;
+ struct timeval nsd_timestamp; /* timestamp from verifier */
+ u_int32_t nsd_ttl; /* credential ttl (sec) */
+ };
+
+ To add further sockets for processing by the nfsd(8) server daemons the
+ master nfsd(8) daemon calls n\bnf\bfs\bss\bsv\bvc\bc() with the flag NFSSVC_ADDSOCK and a
+ pointer to a structure:
+
+ struct nfsd_args {
+ int sock; /* Socket to serve */
+ caddr_t name; /* Client address for connection based sockets */
+ int namelen; /* Length of name */
+ };
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Normally n\bnf\bfs\bss\bsv\bvc\bc does not return unless the server is terminated by a
+ signal when a value of 0 is returned. Otherwise, -1 is returned and the
+ global variable _\be_\br_\br_\bn_\bo is set to specify the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The caller is not the superuser.
+
+ [EINVAL] The flag argument consisted of incompatible or
+ otherwise unsupported bits.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mount_nfs(8), nfsd(8), sysctl(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The n\bnf\bfs\bss\bsv\bvc\bc function first appeared in 4.4BSD.
+
+B\bBU\bUG\bGS\bS
+ The n\bnf\bfs\bss\bsv\bvc\bc system call is designed specifically for the NFS support
+ daemons and as such is specific to their requirements. Several fields of
+ the argument structures are assumed to be valid and sometimes to be
+ unchanged from a previous call, such that n\bnf\bfs\bss\bsv\bvc\bc() must be used with
+ extreme care.
+
+N\bNA\bAM\bME\bE
+ o\bop\bpe\ben\bn, o\bop\bpe\ben\bna\bat\bt - open or create a file for reading or writing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ o\bop\bpe\ben\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\b._\b._\b.);
+
+ _\bi_\bn_\bt
+ o\bop\bpe\ben\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The file name specified by _\bp_\ba_\bt_\bh is opened for reading and/or writing as
+ specified by the argument _\bf_\bl_\ba_\bg_\bs and the file descriptor returned to the
+ calling process. The _\bf_\bl_\ba_\bg_\bs argument may indicate the file is to be
+ created if it does not exist (by specifying the O_CREAT flag), in which
+ case the file is created with a mode specified by an additional argument
+ of type _\bm_\bo_\bd_\be_\b__\bt as described in chmod(2) and modified by the process'
+ umask value (see umask(2)).
+
+ The _\bf_\bl_\ba_\bg_\bs specified are a bitwise OR of the following values. Exactly
+ one of the first three values (file access modes) must be specified:
+
+ O_RDONLY Open for reading only.
+ O_WRONLY Open for writing only.
+ O_RDWR Open for reading and writing.
+
+ Any combination of the following flags may additionally be used:
+
+ O_NONBLOCK Do not block on open or for data to become available.
+ O_APPEND Append on each write.
+ O_CREAT Create file if it does not exist. An additional
+ argument of type _\bm_\bo_\bd_\be_\b__\bt must be supplied to the call.
+ O_TRUNC Truncate size to 0.
+ O_EXCL Error if O_CREAT is set and file exists.
+ O_SYNC Perform synchronous I/O operations.
+ O_SHLOCK Atomically obtain a shared lock.
+ O_EXLOCK Atomically obtain an exclusive lock.
+ O_NOFOLLOW If last path element is a symlink, don't follow it.
+ O_CLOEXEC Set FD_CLOEXEC (the close-on-exec flag) on the new
+ file descriptor.
+ O_DIRECTORY Error if _\bp_\ba_\bt_\bh does not name a directory.
+
+ Opening a file with O_APPEND set causes each write on the file to be
+ appended to the end. If O_TRUNC and a writing mode are specified and the
+ file exists, the file is truncated to zero length. If O_EXCL is set with
+ O_CREAT and the file already exists, o\bop\bpe\ben\bn() returns an error. This may
+ be used to implement a simple exclusive access locking mechanism. If
+ either of O_EXCL or O_NOFOLLOW are set and the last component of the
+ pathname is a symbolic link, o\bop\bpe\ben\bn() will fail even if the symbolic link
+ points to a non-existent name. If the O_NONBLOCK flag is specified, do
+ not wait for the device or file to be ready or available. If the o\bop\bpe\ben\bn()
+ call would result in the process being blocked for some reason (e.g.,
+ waiting for carrier on a dialup line), o\bop\bpe\ben\bn() returns immediately. This
+ flag also has the effect of making all subsequent I/O on the open file
+ non-blocking. If the O_SYNC flag is set, all I/O operations on the file
+ will be done synchronously.
+
+ A FIFO should either be opened with O_RDONLY or with O_WRONLY. The
+ behavior for opening a FIFO with O_RDWR is undefined.
+
+ When opening a file, a lock with flock(2) semantics can be obtained by
+ setting O_SHLOCK for a shared lock, or O_EXLOCK for an exclusive lock.
+ If creating a file with O_CREAT, the request for the lock will never fail
+ (provided that the underlying filesystem supports locking).
+
+ If o\bop\bpe\ben\bn() is successful, the file pointer used to mark the current
+ position within the file is set to the beginning of the file.
+
+ When a new file is created it is given the group of the directory which
+ contains it.
+
+ The new descriptor is set to remain open across execve(2) system calls;
+ see close(2) and fcntl(2).
+
+ The system imposes a limit on the number of file descriptors open
+ simultaneously by one process. getdtablesize(3) returns the current
+ system limit.
+
+ The o\bop\bpe\ben\bna\bat\bt() function is equivalent to o\bop\bpe\ben\bn() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the file to be opened is determined relative
+ to the directory associated with file descriptor _\bf_\bd instead of the
+ current working directory.
+
+ If o\bop\bpe\ben\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to o\bop\bpe\ben\bn().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, o\bop\bpe\ben\bn() returns a non-negative integer, termed a file
+ descriptor. Otherwise, a value of -1 is returned and _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The o\bop\bpe\ben\bn() and o\bop\bpe\ben\bna\bat\bt() functions will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENOTDIR] O_DIRECTORY is specified and _\bp_\ba_\bt_\bh does not name a
+ directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] O_CREAT is not set and the named file does not exist.
+
+ [ENOENT] A component of the path name that must exist does not
+ exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The required permissions (for reading and/or writing)
+ are denied for the given _\bf_\bl_\ba_\bg_\bs.
+
+ [EACCES] O_CREAT is specified, the file does not exist, and the
+ directory in which it is to be created does not permit
+ writing.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname, or the O_NOFOLLOW flag was
+ specified and the target is a symbolic link.
+
+ [EISDIR] The named file is a directory, and the arguments
+ specify it is to be opened for writing.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs specified for opening the file are not
+ valid.
+
+ [EROFS] The named file resides on a read-only file system, and
+ the file is to be modified.
+
+ [EMFILE] The process has already reached its limit for open
+ file descriptors.
+
+ [ENFILE] The system file table is full.
+
+ [ENXIO] The named file is a character special or block special
+ file, and the device associated with this special file
+ does not exist.
+
+ [ENXIO] The named file is a FIFO, the O_NONBLOCK and O_WRONLY
+ flags are set, and no process has the file open for
+ reading.
+
+ [EINTR] The o\bop\bpe\ben\bn() operation was interrupted by a signal.
+
+ [EOPNOTSUPP] O_SHLOCK or O_EXLOCK is specified but the underlying
+ filesystem does not support locking.
+
+ [EWOULDBLOCK] O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is
+ specified and the file is already locked.
+
+ [ENOSPC] O_CREAT is specified, the file does not exist, and the
+ directory in which the entry for the new file is being
+ placed cannot be extended because there is no space
+ left on the file system containing the directory.
+
+ [ENOSPC] O_CREAT is specified, the file does not exist, and
+ there are no free inodes on the file system on which
+ the file is being created.
+
+ [EDQUOT] O_CREAT is specified, the file does not exist, and the
+ directory in which the entry for the new file is being
+ placed cannot be extended because the user's quota of
+ disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] O_CREAT is specified, the file does not exist, and the
+ user's quota of inodes on the file system on which the
+ file is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode for O_CREAT.
+
+ [ETXTBSY] The file is a pure procedure (shared text) file that
+ is being executed and the o\bop\bpe\ben\bn() call requests write
+ access.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EEXIST] O_CREAT and O_EXCL were specified and the file exists.
+
+ [EPERM] The file named by _\bp_\ba_\bt_\bh is flagged append-only but
+ O_APPEND was not specified in _\bf_\bl_\ba_\bg_\bs.
+
+ [EOPNOTSUPP] An attempt was made to open a socket (not currently
+ implemented).
+
+ [EBUSY] An attempt was made to open a terminal device that
+ requires exclusive access and the specified device has
+ already be opened.
+
+ Additionally, the o\bop\bpe\ben\bna\bat\bt() function will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chflags(2), chmod(2), close(2), dup(2), flock(2), lseek(2), read(2),
+ umask(2), write(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The o\bop\bpe\ben\bn() and o\bop\bpe\ben\bna\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ POSIX specifies three different flavors for synchronous I/O: O_SYNC,
+ O_DSYNC, and O_RSYNC. In OpenBSD, these are all equivalent.
+
+ The O_SHLOCK and O_EXLOCK flags are non-standard extensions and should
+ not be used if portability is of concern.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An o\bop\bpe\ben\bn() system call first appeared in Version 1 AT&T UNIX. The _\bf_\bl_\ba_\bg_\bs
+ argument has been supported since 4.2BSD. Before that, a dedicated
+ c\bcr\bre\bea\bat\bt() system call had to be used to create new files; it appeared in
+ Version 1 AT&T UNIX, was deprecated in 4.3BSD-Reno, and removed in
+ OpenBSD 5.0.
+
+ The o\bop\bpe\ben\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The O_TRUNC flag requires that one of O_RDWR or O_WRONLY also be
+ specified, else EINVAL is returned.
+
+N\bNA\bAM\bME\bE
+ o\bop\bpe\ben\bn, o\bop\bpe\ben\bna\bat\bt - open or create a file for reading or writing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ o\bop\bpe\ben\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\b._\b._\b.);
+
+ _\bi_\bn_\bt
+ o\bop\bpe\ben\bna\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The file name specified by _\bp_\ba_\bt_\bh is opened for reading and/or writing as
+ specified by the argument _\bf_\bl_\ba_\bg_\bs and the file descriptor returned to the
+ calling process. The _\bf_\bl_\ba_\bg_\bs argument may indicate the file is to be
+ created if it does not exist (by specifying the O_CREAT flag), in which
+ case the file is created with a mode specified by an additional argument
+ of type _\bm_\bo_\bd_\be_\b__\bt as described in chmod(2) and modified by the process'
+ umask value (see umask(2)).
+
+ The _\bf_\bl_\ba_\bg_\bs specified are a bitwise OR of the following values. Exactly
+ one of the first three values (file access modes) must be specified:
+
+ O_RDONLY Open for reading only.
+ O_WRONLY Open for writing only.
+ O_RDWR Open for reading and writing.
+
+ Any combination of the following flags may additionally be used:
+
+ O_NONBLOCK Do not block on open or for data to become available.
+ O_APPEND Append on each write.
+ O_CREAT Create file if it does not exist. An additional
+ argument of type _\bm_\bo_\bd_\be_\b__\bt must be supplied to the call.
+ O_TRUNC Truncate size to 0.
+ O_EXCL Error if O_CREAT is set and file exists.
+ O_SYNC Perform synchronous I/O operations.
+ O_SHLOCK Atomically obtain a shared lock.
+ O_EXLOCK Atomically obtain an exclusive lock.
+ O_NOFOLLOW If last path element is a symlink, don't follow it.
+ O_CLOEXEC Set FD_CLOEXEC (the close-on-exec flag) on the new
+ file descriptor.
+ O_DIRECTORY Error if _\bp_\ba_\bt_\bh does not name a directory.
+
+ Opening a file with O_APPEND set causes each write on the file to be
+ appended to the end. If O_TRUNC and a writing mode are specified and the
+ file exists, the file is truncated to zero length. If O_EXCL is set with
+ O_CREAT and the file already exists, o\bop\bpe\ben\bn() returns an error. This may
+ be used to implement a simple exclusive access locking mechanism. If
+ either of O_EXCL or O_NOFOLLOW are set and the last component of the
+ pathname is a symbolic link, o\bop\bpe\ben\bn() will fail even if the symbolic link
+ points to a non-existent name. If the O_NONBLOCK flag is specified, do
+ not wait for the device or file to be ready or available. If the o\bop\bpe\ben\bn()
+ call would result in the process being blocked for some reason (e.g.,
+ waiting for carrier on a dialup line), o\bop\bpe\ben\bn() returns immediately. This
+ flag also has the effect of making all subsequent I/O on the open file
+ non-blocking. If the O_SYNC flag is set, all I/O operations on the file
+ will be done synchronously.
+
+ A FIFO should either be opened with O_RDONLY or with O_WRONLY. The
+ behavior for opening a FIFO with O_RDWR is undefined.
+
+ When opening a file, a lock with flock(2) semantics can be obtained by
+ setting O_SHLOCK for a shared lock, or O_EXLOCK for an exclusive lock.
+ If creating a file with O_CREAT, the request for the lock will never fail
+ (provided that the underlying filesystem supports locking).
+
+ If o\bop\bpe\ben\bn() is successful, the file pointer used to mark the current
+ position within the file is set to the beginning of the file.
+
+ When a new file is created it is given the group of the directory which
+ contains it.
+
+ The new descriptor is set to remain open across execve(2) system calls;
+ see close(2) and fcntl(2).
+
+ The system imposes a limit on the number of file descriptors open
+ simultaneously by one process. getdtablesize(3) returns the current
+ system limit.
+
+ The o\bop\bpe\ben\bna\bat\bt() function is equivalent to o\bop\bpe\ben\bn() except that where _\bp_\ba_\bt_\bh
+ specifies a relative path, the file to be opened is determined relative
+ to the directory associated with file descriptor _\bf_\bd instead of the
+ current working directory.
+
+ If o\bop\bpe\ben\bna\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to o\bop\bpe\ben\bn().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, o\bop\bpe\ben\bn() returns a non-negative integer, termed a file
+ descriptor. Otherwise, a value of -1 is returned and _\be_\br_\br_\bn_\bo is set to
+ indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The o\bop\bpe\ben\bn() and o\bop\bpe\ben\bna\bat\bt() functions will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENOTDIR] O_DIRECTORY is specified and _\bp_\ba_\bt_\bh does not name a
+ directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] O_CREAT is not set and the named file does not exist.
+
+ [ENOENT] A component of the path name that must exist does not
+ exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The required permissions (for reading and/or writing)
+ are denied for the given _\bf_\bl_\ba_\bg_\bs.
+
+ [EACCES] O_CREAT is specified, the file does not exist, and the
+ directory in which it is to be created does not permit
+ writing.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname, or the O_NOFOLLOW flag was
+ specified and the target is a symbolic link.
+
+ [EISDIR] The named file is a directory, and the arguments
+ specify it is to be opened for writing.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs specified for opening the file are not
+ valid.
+
+ [EROFS] The named file resides on a read-only file system, and
+ the file is to be modified.
+
+ [EMFILE] The process has already reached its limit for open
+ file descriptors.
+
+ [ENFILE] The system file table is full.
+
+ [ENXIO] The named file is a character special or block special
+ file, and the device associated with this special file
+ does not exist.
+
+ [ENXIO] The named file is a FIFO, the O_NONBLOCK and O_WRONLY
+ flags are set, and no process has the file open for
+ reading.
+
+ [EINTR] The o\bop\bpe\ben\bn() operation was interrupted by a signal.
+
+ [EOPNOTSUPP] O_SHLOCK or O_EXLOCK is specified but the underlying
+ filesystem does not support locking.
+
+ [EWOULDBLOCK] O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is
+ specified and the file is already locked.
+
+ [ENOSPC] O_CREAT is specified, the file does not exist, and the
+ directory in which the entry for the new file is being
+ placed cannot be extended because there is no space
+ left on the file system containing the directory.
+
+ [ENOSPC] O_CREAT is specified, the file does not exist, and
+ there are no free inodes on the file system on which
+ the file is being created.
+
+ [EDQUOT] O_CREAT is specified, the file does not exist, and the
+ directory in which the entry for the new file is being
+ placed cannot be extended because the user's quota of
+ disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EDQUOT] O_CREAT is specified, the file does not exist, and the
+ user's quota of inodes on the file system on which the
+ file is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode for O_CREAT.
+
+ [ETXTBSY] The file is a pure procedure (shared text) file that
+ is being executed and the o\bop\bpe\ben\bn() call requests write
+ access.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EEXIST] O_CREAT and O_EXCL were specified and the file exists.
+
+ [EPERM] The file named by _\bp_\ba_\bt_\bh is flagged append-only but
+ O_APPEND was not specified in _\bf_\bl_\ba_\bg_\bs.
+
+ [EOPNOTSUPP] An attempt was made to open a socket (not currently
+ implemented).
+
+ [EBUSY] An attempt was made to open a terminal device that
+ requires exclusive access and the specified device has
+ already be opened.
+
+ Additionally, the o\bop\bpe\ben\bna\bat\bt() function will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chflags(2), chmod(2), close(2), dup(2), flock(2), lseek(2), read(2),
+ umask(2), write(2), getdtablesize(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The o\bop\bpe\ben\bn() and o\bop\bpe\ben\bna\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ POSIX specifies three different flavors for synchronous I/O: O_SYNC,
+ O_DSYNC, and O_RSYNC. In OpenBSD, these are all equivalent.
+
+ The O_SHLOCK and O_EXLOCK flags are non-standard extensions and should
+ not be used if portability is of concern.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ An o\bop\bpe\ben\bn() system call first appeared in Version 1 AT&T UNIX. The _\bf_\bl_\ba_\bg_\bs
+ argument has been supported since 4.2BSD. Before that, a dedicated
+ c\bcr\bre\bea\bat\bt() system call had to be used to create new files; it appeared in
+ Version 1 AT&T UNIX, was deprecated in 4.3BSD-Reno, and removed in
+ OpenBSD 5.0.
+
+ The o\bop\bpe\ben\bna\bat\bt() system call has been available since OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The O_TRUNC flag requires that one of O_RDWR or O_WRONLY also be
+ specified, else EINVAL is returned.
+
+N\bNA\bAM\bME\bE
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf, f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf - get configurable pathname variables
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bl_\bo_\bn_\bg
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bn_\ba_\bm_\be);
+
+ _\bl_\bo_\bn_\bg
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf(_\bi_\bn_\bt _\bf_\bd, _\bi_\bn_\bt _\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf() and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf() functions provide a method for
+ applications to determine the current value of a configurable system
+ limit or option variable associated with a pathname or file descriptor.
+
+ For p\bpa\bat\bth\bhc\bco\bon\bnf\bf, the _\bp_\ba_\bt_\bh argument is the name of a file or directory. For
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf, the _\bf_\bd argument is an open file descriptor. The _\bn_\ba_\bm_\be argument
+ specifies the system variable to be queried. Symbolic constants for each
+ name value are found in the include file <_\bu_\bn_\bi_\bs_\bt_\bd_\b._\bh>.
+
+ The available values are as follows:
+
+ _PC_LINK_MAX
+ The maximum file link count.
+
+ _PC_MAX_CANON
+ The maximum number of bytes in a terminal canonical input line.
+
+ _PC_MAX_INPUT
+ The maximum number of bytes for which space is available in a
+ terminal input queue.
+
+ _PC_NAME_MAX
+ The maximum number of bytes in a file name.
+
+ _PC_PATH_MAX
+ The maximum number of bytes in a pathname.
+
+ _PC_PIPE_BUF
+ The maximum number of bytes which will be written atomically to a
+ pipe.
+
+ _PC_CHOWN_RESTRICTED
+ Returns 1 if appropriate privileges are required for the chown(2)
+ system call, otherwise 0. IEEE Std 1003.1-2001 (``POSIX.1'')
+ requires appropriate privilege in all cases, but this behavior
+ was optional in prior editions of the standard.
+
+ _PC_NO_TRUNC
+ Returns 1 if attempts to use pathname components longer than
+ {NAME_MAX} will result in an [ENAMETOOLONG] error; otherwise,
+ such components will be truncated to {NAME_MAX}. IEEE Std
+ 1003.1-2001 (``POSIX.1'') requires the error in all cases, but
+ this behavior was optional in prior editions of the standard, and
+ some non-POSIX-compliant file systems do not support this
+ behavior.
+
+ _PC_VDISABLE
+ Returns the terminal character disabling value.
+
+ _PC_2_SYMLINKS
+ Returns 1 if the filesystem supports the creation of symbolic
+ links within the specified directory; the meaning of
+ _PC_2_SYMLINKS is unspecified for non-directory files.
+
+ _PC_ALLOC_SIZE_MIN
+ Minimum number of bytes of storage allocated for any portion of a
+ file.
+
+ _PC_ASYNC_IO
+ Returns 1 if asynchronous I/O is supported, otherwise 0.
+
+ _PC_FILESIZEBITS
+ Number of bits needed to represent the maximum file size.
+
+ _PC_PRIO_IO
+ Returns 1 if prioritized I/O is supported, otherwise 0.
+
+ _PC_REC_INCR_XFER_SIZE
+ Recommended increment for file transfer sizes between
+ _PC_REC_MIN_XFER_SIZE and _PC_REC_MAX_XFER_SIZE.
+
+ _PC_REC_MAX_XFER_SIZE
+ Maximum recommended file transfer size.
+
+ _PC_REC_MIN_XFER_SIZE
+ Minimum recommended file transfer size.
+
+ _PC_REC_XFER_ALIGN
+ Recommended file transfer buffer alignment.
+
+ _PC_SYMLINK_MAX
+ Maximum number of bytes in a symbolic link.
+
+ _PC_SYNC_IO
+ Returns 1 if synchronized I/O is supported, otherwise 0.
+
+ _PC_TIMESTAMP_RESOLUTION
+ The resolution in nanoseconds of file timestamps.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the call to p\bpa\bat\bth\bhc\bco\bon\bnf\bf or f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf is not successful, -1 is returned
+ and _\be_\br_\br_\bn_\bo is set appropriately. Otherwise, if the variable is associated
+ with functionality that does not have a limit in the system, -1 is
+ returned and _\be_\br_\br_\bn_\bo is not modified. Otherwise, the current variable
+ value is returned.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ If any of the following conditions occur, the p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf
+ functions shall return -1 and set _\be_\br_\br_\bn_\bo to the corresponding value.
+
+ [EINVAL] The value of the _\bn_\ba_\bm_\be argument is invalid.
+
+ [EINVAL] The implementation does not support an association of
+ the variable name with the associated file.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ p\bpa\bat\bth\bhc\bco\bon\bnf\bf() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters
+ (but see _PC_NO_TRUNC above), or an entire pathname
+ (including the terminating NUL) exceeded PATH_MAX
+ bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sysconf(3), sysctl(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpa\bat\bth\bhc\bco\bon\bnf\bf and f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf functions first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ p\bpi\bip\bpe\be, p\bpi\bip\bpe\be2\b2 - create descriptor pair for interprocess communication
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpi\bip\bpe\be(_\bi_\bn_\bt _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b2_\b]);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpi\bip\bpe\be2\b2(_\bi_\bn_\bt _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b2_\b], _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The p\bpi\bip\bpe\be() function creates a _\bp_\bi_\bp_\be, which is an object allowing
+ unidirectional data flow, and allocates a pair of file descriptors. The
+ first descriptor connects to the _\br_\be_\ba_\bd _\be_\bn_\bd of the pipe, and the second
+ connects to the _\bw_\br_\bi_\bt_\be _\be_\bn_\bd, so that data written to _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b1_\b] appears on
+ (i.e., can be read from) _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b0_\b]. This allows the output of one
+ program to be sent to another program: the source's standard output is
+ set up to be the write end of the pipe, and the sink's standard input is
+ set up to be the read end of the pipe. The pipe itself persists until
+ all its associated descriptors are closed.
+
+ A pipe whose read or write end has been closed is considered _\bw_\bi_\bd_\bo_\bw_\be_\bd.
+ Writing on such a pipe causes the writing process to receive a SIGPIPE
+ signal. Widowing a pipe is the only way to deliver end-of-file to a
+ reader: after the reader consumes any buffered data, reading a widowed
+ pipe returns a zero count.
+
+ The p\bpi\bip\bpe\be2\b2() function is identical to p\bpi\bip\bpe\be() except that the non-blocking
+ I/O mode on both ends of the pipe is determined by the O_NONBLOCK flag in
+ the _\bf_\bl_\ba_\bg_\bs argument and the close-on-exec flag on both the new file
+ descriptors is determined by the O_CLOEXEC flag in the _\bf_\bl_\ba_\bg_\bs argument.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ p\bpi\bip\bpe\be() and p\bpi\bip\bpe\be2\b2() will succeed unless:
+
+ [EMFILE] Too many descriptors are active.
+
+ [ENFILE] The system file table is full.
+
+ [EFAULT] The _\bf_\bi_\bl_\bd_\be_\bs buffer is in an invalid area of the
+ process's address space.
+
+ In addition, p\bpi\bip\bpe\be2\b2() may return the following error:
+
+ [EINVAL] _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sh(1), fork(2), read(2), socketpair(2), write(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpi\bip\bpe\be() function conforms to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ p\bpi\bip\bpe\be2\b2() function is expected to conform to a future revision of that
+ standard.
+
+ As an extension, the pipe provided is actually capable of moving data
+ bidirectionally. This is compatible with SVR4. However, this is non-
+ POSIX behaviour which should not be relied on, for reasons of
+ portability.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A p\bpi\bip\bpe\be() function call appeared in Version 3 AT&T UNIX. Since Version 4
+ AT&T UNIX, it allocates two distinct file descriptors. The p\bpi\bip\bpe\be2\b2()
+ function appeared in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ p\bpi\bip\bpe\be, p\bpi\bip\bpe\be2\b2 - create descriptor pair for interprocess communication
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpi\bip\bpe\be(_\bi_\bn_\bt _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b2_\b]);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpi\bip\bpe\be2\b2(_\bi_\bn_\bt _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b2_\b], _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The p\bpi\bip\bpe\be() function creates a _\bp_\bi_\bp_\be, which is an object allowing
+ unidirectional data flow, and allocates a pair of file descriptors. The
+ first descriptor connects to the _\br_\be_\ba_\bd _\be_\bn_\bd of the pipe, and the second
+ connects to the _\bw_\br_\bi_\bt_\be _\be_\bn_\bd, so that data written to _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b1_\b] appears on
+ (i.e., can be read from) _\bf_\bi_\bl_\bd_\be_\bs_\b[_\b0_\b]. This allows the output of one
+ program to be sent to another program: the source's standard output is
+ set up to be the write end of the pipe, and the sink's standard input is
+ set up to be the read end of the pipe. The pipe itself persists until
+ all its associated descriptors are closed.
+
+ A pipe whose read or write end has been closed is considered _\bw_\bi_\bd_\bo_\bw_\be_\bd.
+ Writing on such a pipe causes the writing process to receive a SIGPIPE
+ signal. Widowing a pipe is the only way to deliver end-of-file to a
+ reader: after the reader consumes any buffered data, reading a widowed
+ pipe returns a zero count.
+
+ The p\bpi\bip\bpe\be2\b2() function is identical to p\bpi\bip\bpe\be() except that the non-blocking
+ I/O mode on both ends of the pipe is determined by the O_NONBLOCK flag in
+ the _\bf_\bl_\ba_\bg_\bs argument and the close-on-exec flag on both the new file
+ descriptors is determined by the O_CLOEXEC flag in the _\bf_\bl_\ba_\bg_\bs argument.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ p\bpi\bip\bpe\be() and p\bpi\bip\bpe\be2\b2() will succeed unless:
+
+ [EMFILE] Too many descriptors are active.
+
+ [ENFILE] The system file table is full.
+
+ [EFAULT] The _\bf_\bi_\bl_\bd_\be_\bs buffer is in an invalid area of the
+ process's address space.
+
+ In addition, p\bpi\bip\bpe\be2\b2() may return the following error:
+
+ [EINVAL] _\bf_\bl_\ba_\bg_\bs is invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sh(1), fork(2), read(2), socketpair(2), write(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpi\bip\bpe\be() function conforms to IEEE Std 1003.1-2008 (``POSIX.1''). The
+ p\bpi\bip\bpe\be2\b2() function is expected to conform to a future revision of that
+ standard.
+
+ As an extension, the pipe provided is actually capable of moving data
+ bidirectionally. This is compatible with SVR4. However, this is non-
+ POSIX behaviour which should not be relied on, for reasons of
+ portability.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A p\bpi\bip\bpe\be() function call appeared in Version 3 AT&T UNIX. Since Version 4
+ AT&T UNIX, it allocates two distinct file descriptors. The p\bpi\bip\bpe\be2\b2()
+ function appeared in OpenBSD 5.7.
+
+N\bNA\bAM\bME\bE
+ p\bpo\bol\bll\bl, p\bpp\bpo\bol\bll\bl - synchronous I/O multiplexing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<p\bpo\bol\bll\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpo\bol\bll\bl(_\bs_\bt_\br_\bu_\bc_\bt _\bp_\bo_\bl_\bl_\bf_\bd _\b*_\bf_\bd_\bs, _\bn_\bf_\bd_\bs_\b__\bt _\bn_\bf_\bd_\bs, _\bi_\bn_\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ _\bi_\bn_\bt
+ p\bpp\bpo\bol\bll\bl(_\bs_\bt_\br_\bu_\bc_\bt _\bp_\bo_\bl_\bl_\bf_\bd _\b*_\bf_\bd_\bs, _\bn_\bf_\bd_\bs_\b__\bt _\bn_\bf_\bd_\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bm_\ba_\bs_\bk);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ p\bpo\bol\bll\bl() provides a mechanism for multiplexing I/O across a set of file
+ descriptors. It is similar in function to select(2). Unlike select(2),
+ however, it is possible to only pass in data corresponding to the file
+ descriptors for which events are wanted. This makes p\bpo\bol\bll\bl() more
+ efficient than select(2) in most cases.
+
+ The arguments are as follows:
+
+ _\bf_\bd_\bs Points to an array of _\bp_\bo_\bl_\bl_\bf_\bd structures, which are defined as:
+
+ struct pollfd {
+ int fd;
+ short events;
+ short revents;
+ };
+
+ The _\bf_\bd member is an open file descriptor. If _\bf_\bd is -1, the
+ _\bp_\bo_\bl_\bl_\bf_\bd structure is considered unused, and _\br_\be_\bv_\be_\bn_\bt_\bs will be
+ cleared.
+
+ The _\be_\bv_\be_\bn_\bt_\bs and _\br_\be_\bv_\be_\bn_\bt_\bs members are bitmasks of conditions to
+ monitor and conditions found, respectively.
+
+ _\bn_\bf_\bd_\bs An unsigned integer specifying the number of _\bp_\bo_\bl_\bl_\bf_\bd structures
+ in the array.
+
+ _\bt_\bi_\bm_\be_\bo_\bu_\bt Maximum interval to wait for the poll to complete, in
+ milliseconds. If this value is 0, p\bpo\bol\bll\bl() will return
+ immediately. If this value is INFTIM (-1), p\bpo\bol\bll\bl() will block
+ indefinitely until a condition is found.
+
+ The calling process sets the _\be_\bv_\be_\bn_\bt_\bs bitmask and p\bpo\bol\bll\bl() sets the _\br_\be_\bv_\be_\bn_\bt_\bs
+ bitmask. Each call to p\bpo\bol\bll\bl() resets the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask for accuracy.
+ The condition flags in the bitmasks are defined as:
+
+ POLLIN Data other than high-priority data may be read without
+ blocking.
+
+ POLLRDNORM Normal data may be read without blocking.
+
+ POLLRDBAND Priority data may be read without blocking.
+
+ POLLNORM Same as POLLRDNORM. This flag is provided for source code
+ compatibility with older programs and should not be used in
+ new code.
+
+ POLLPRI High-priority data may be read without blocking.
+
+ POLLOUT Normal data may be written without blocking.
+
+ POLLWRNORM Same as POLLOUT.
+
+ POLLWRBAND Priority data may be written.
+
+ POLLERR An error has occurred on the device or socket. This flag is
+ only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask; it is ignored in the
+ _\be_\bv_\be_\bn_\bt_\bs member.
+
+ POLLHUP The device or socket has been disconnected. This event and
+ POLLOUT are mutually-exclusive; a descriptor can never be
+ writable if a hangup has occurred. However, this event and
+ POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not mutually-
+ exclusive. This flag is only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask;
+ it is ignored in the _\be_\bv_\be_\bn_\bt_\bs member.
+
+ POLLNVAL The corresponding file descriptor is invalid. This flag is
+ only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask; it is ignored in the
+ _\be_\bv_\be_\bn_\bt_\bs member.
+
+ The significance and semantics of normal, priority, and high-priority
+ data are device-specific.
+
+ In addition to I/O multiplexing, p\bpo\bol\bll\bl() can be used to generate simple
+ timeouts. This functionality may be achieved by passing a null pointer
+ for _\bf_\bd_\bs.
+
+ The p\bpp\bpo\bol\bll\bl() function is similar to p\bpo\bol\bll\bl() except that it specifies the
+ timeout using a timespec structure, and a null pointer is used to specify
+ an indefinite timeout instead of INFTIM. Also, if _\bm_\ba_\bs_\bk is a non-null
+ pointer, p\bpp\bpo\bol\bll\bl() atomically sets the calling thread's signal mask to the
+ signal set pointed to by _\bm_\ba_\bs_\bk for the duration of the function call. In
+ this case, the original signal mask will be restored before p\bpp\bpo\bol\bll\bl()
+ returns.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon error, p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() return -1 and set the global variable
+ _\be_\br_\br_\bn_\bo to indicate the error. If the timeout interval was reached before
+ any events occurred, they return 0. Otherwise, they return the number of
+ _\bp_\bo_\bl_\bl_\bf_\bd structures for which _\br_\be_\bv_\be_\bn_\bt_\bs is non-zero.
+
+I\bID\bDI\bIO\bOM\bMS\bS
+ Care must be taken when converting code from select(2) to p\bpo\bol\bll\bl() as they
+ have slightly different semantics. The first semantic difference is
+ that, unlike select(2), p\bpo\bol\bll\bl() has a way of indicating that one or more
+ file descriptors is invalid by setting a flag in the _\br_\be_\bv_\be_\bn_\bt_\bs field of
+ corresponding entry of _\bf_\bd_\bs, whereas select(2) returns an error (-1) if
+ any of the descriptors with bits set in the _\bf_\bd_\b__\bs_\be_\bt are invalid. The
+ second difference is that on EOF there is no guarantee that POLLIN will
+ be set in _\br_\be_\bv_\be_\bn_\bt_\bs, the caller must also check for POLLHUP. This differs
+ from select(2) where EOF is considered as a read event.
+
+ Consider the following usage of select(2) that implements a read from the
+ standard input with a 60 second time out:
+
+ struct timeval timeout;
+ fd_set readfds;
+ char buf[BUFSIZ];
+ int nready;
+
+ timeout.tv_sec = 60;
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(STDIN_FILENO);
+ nready = select(STDIN_FILENO + 1, &readfds, NULL, NULL, &timeout);
+ if (nready == -1)
+ err(1, "select");
+ if (nready == 0)
+ errx(1, "time out");
+ if (FD_ISSET(STDIN_FILENO, &readfds)) {
+ if (read(STDIN_FILENO, buf, sizeof(buf)) == -1)
+ err(1, "read");
+ }
+
+ This can be converted to p\bpo\bol\bll\bl() as follows:
+
+ struct pollfd pdf[1];
+ char buf[BUFSIZ];
+ int nready;
+
+ pfd[0].fd = STDIN_FILENO;
+ pfd[0].events = POLLIN;
+ nready = poll(pfd, 1, 60 * 1000);
+ if (nready == -1)
+ err(1, "poll");
+ if (nready == 0)
+ errx(1, "time out");
+ if ((pfd[0].revents & (POLLERR|POLLNVAL)))
+ errx(1, "bad fd %d", pfd[0].fd);
+ if ((pfd[0].revents & (POLLIN|POLLHUP)))
+ if (read(STDIN_FILENO, buf, sizeof(buf)) == -1)
+ err(1, "read");
+ }
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() will fail if:
+
+ [EFAULT] _\bf_\bd_\bs points outside the process's allocated address
+ space.
+
+ [EINTR] A signal was caught before any polled events occurred
+ and before the timeout elapsed.
+
+ [EINVAL] _\bn_\bf_\bd_\bs was greater than the number of available file
+ descriptors.
+
+ [EINVAL] The timeout passed was invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), getrlimit(2), read(2), select(2), write(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpo\bol\bll\bl() function is compliant with the IEEE Std 1003.1-2008
+ (``POSIX.1'') specification. The p\bpp\bpo\bol\bll\bl() function is a Linux extension.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A p\bpo\bol\bll\bl() system call appeared in AT&T System V Release 3 UNIX. The
+ p\bpp\bpo\bol\bll\bl() function appeared in OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ The POLLWRBAND flag is accepted but ignored by the kernel.
+
+ Because OpenBSD does not implement STREAMS, there is no distinction
+ between some of the fields in the _\be_\bv_\be_\bn_\bt_\bs and _\br_\be_\bv_\be_\bn_\bt_\bs bitmasks. As a
+ result, the POLLIN, POLLNORM, and POLLRDNORM flags are equivalent.
+
+ Internally to the kernel, p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() work poorly if multiple
+ processes wait on the same file descriptor.
+
+N\bNA\bAM\bME\bE
+ m\bma\bad\bdv\bvi\bis\bse\be, p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be - give advice about use of memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmm\bma\ban\bn.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bma\bad\bdv\bvi\bis\bse\be(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bb_\be_\bh_\ba_\bv);
+
+ _\bi_\bn_\bt
+ p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bb_\be_\bh_\ba_\bv);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bma\bad\bdv\bvi\bis\bse\be() system call allows a process that has knowledge of its
+ memory behavior to describe it to the system. The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be()
+ interface has the same effect, but returns the error value instead of
+ only setting _\be_\br_\br_\bn_\bo.
+
+ The possible behaviors are:
+
+ MADV_NORMAL No further special treatment needed.
+
+ MADV_RANDOM Expect random page access patterns.
+
+ MADV_SEQUENTIAL Expect sequential page references.
+
+ MADV_WILLNEED The pages will be referenced soon.
+
+ MADV_DONTNEED The pages will not be referenced soon.
+
+ MADV_SPACEAVAIL Ensure that resources are reserved.
+
+ MADV_FREE The pages don't contain any useful data and can be
+ recycled.
+
+ Portable programs that call the p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() interface should use the
+ aliases POSIX_MADV_NORMAL, POSIX_MADV_RANDOM, POSIX_MADV_SEQUENTIAL,
+ POSIX_MADV_WILLNEED, and POSIX_MADV_DONTNEED rather than the flags
+ described above.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The m\bma\bad\bdv\bvi\bis\bse\be() function returns the value 0 if successful; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+ If successful, the p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() function will return zero. Otherwise
+ an error number will be returned to indicate the error.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mincore(2), minherit(2), mprotect(2), msync(2), munmap(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be() system call conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bma\bad\bdv\bvi\bis\bse\be() function first appeared in 4.4BSD. The p\bpo\bos\bsi\bix\bx_\b_m\bma\bad\bdv\bvi\bis\bse\be()
+ function first appeared in OpenBSD 4.8.
+
+B\bBU\bUG\bGS\bS
+ The MADV_WILLNEED behavior is ignored. The MADV_SPACEAVAIL behavior is
+ not implemented and will always fail.
+
+N\bNA\bAM\bME\bE
+ p\bpo\bol\bll\bl, p\bpp\bpo\bol\bll\bl - synchronous I/O multiplexing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<p\bpo\bol\bll\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpo\bol\bll\bl(_\bs_\bt_\br_\bu_\bc_\bt _\bp_\bo_\bl_\bl_\bf_\bd _\b*_\bf_\bd_\bs, _\bn_\bf_\bd_\bs_\b__\bt _\bn_\bf_\bd_\bs, _\bi_\bn_\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ _\bi_\bn_\bt
+ p\bpp\bpo\bol\bll\bl(_\bs_\bt_\br_\bu_\bc_\bt _\bp_\bo_\bl_\bl_\bf_\bd _\b*_\bf_\bd_\bs, _\bn_\bf_\bd_\bs_\b__\bt _\bn_\bf_\bd_\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bm_\ba_\bs_\bk);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ p\bpo\bol\bll\bl() provides a mechanism for multiplexing I/O across a set of file
+ descriptors. It is similar in function to select(2). Unlike select(2),
+ however, it is possible to only pass in data corresponding to the file
+ descriptors for which events are wanted. This makes p\bpo\bol\bll\bl() more
+ efficient than select(2) in most cases.
+
+ The arguments are as follows:
+
+ _\bf_\bd_\bs Points to an array of _\bp_\bo_\bl_\bl_\bf_\bd structures, which are defined as:
+
+ struct pollfd {
+ int fd;
+ short events;
+ short revents;
+ };
+
+ The _\bf_\bd member is an open file descriptor. If _\bf_\bd is -1, the
+ _\bp_\bo_\bl_\bl_\bf_\bd structure is considered unused, and _\br_\be_\bv_\be_\bn_\bt_\bs will be
+ cleared.
+
+ The _\be_\bv_\be_\bn_\bt_\bs and _\br_\be_\bv_\be_\bn_\bt_\bs members are bitmasks of conditions to
+ monitor and conditions found, respectively.
+
+ _\bn_\bf_\bd_\bs An unsigned integer specifying the number of _\bp_\bo_\bl_\bl_\bf_\bd structures
+ in the array.
+
+ _\bt_\bi_\bm_\be_\bo_\bu_\bt Maximum interval to wait for the poll to complete, in
+ milliseconds. If this value is 0, p\bpo\bol\bll\bl() will return
+ immediately. If this value is INFTIM (-1), p\bpo\bol\bll\bl() will block
+ indefinitely until a condition is found.
+
+ The calling process sets the _\be_\bv_\be_\bn_\bt_\bs bitmask and p\bpo\bol\bll\bl() sets the _\br_\be_\bv_\be_\bn_\bt_\bs
+ bitmask. Each call to p\bpo\bol\bll\bl() resets the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask for accuracy.
+ The condition flags in the bitmasks are defined as:
+
+ POLLIN Data other than high-priority data may be read without
+ blocking.
+
+ POLLRDNORM Normal data may be read without blocking.
+
+ POLLRDBAND Priority data may be read without blocking.
+
+ POLLNORM Same as POLLRDNORM. This flag is provided for source code
+ compatibility with older programs and should not be used in
+ new code.
+
+ POLLPRI High-priority data may be read without blocking.
+
+ POLLOUT Normal data may be written without blocking.
+
+ POLLWRNORM Same as POLLOUT.
+
+ POLLWRBAND Priority data may be written.
+
+ POLLERR An error has occurred on the device or socket. This flag is
+ only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask; it is ignored in the
+ _\be_\bv_\be_\bn_\bt_\bs member.
+
+ POLLHUP The device or socket has been disconnected. This event and
+ POLLOUT are mutually-exclusive; a descriptor can never be
+ writable if a hangup has occurred. However, this event and
+ POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not mutually-
+ exclusive. This flag is only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask;
+ it is ignored in the _\be_\bv_\be_\bn_\bt_\bs member.
+
+ POLLNVAL The corresponding file descriptor is invalid. This flag is
+ only valid in the _\br_\be_\bv_\be_\bn_\bt_\bs bitmask; it is ignored in the
+ _\be_\bv_\be_\bn_\bt_\bs member.
+
+ The significance and semantics of normal, priority, and high-priority
+ data are device-specific.
+
+ In addition to I/O multiplexing, p\bpo\bol\bll\bl() can be used to generate simple
+ timeouts. This functionality may be achieved by passing a null pointer
+ for _\bf_\bd_\bs.
+
+ The p\bpp\bpo\bol\bll\bl() function is similar to p\bpo\bol\bll\bl() except that it specifies the
+ timeout using a timespec structure, and a null pointer is used to specify
+ an indefinite timeout instead of INFTIM. Also, if _\bm_\ba_\bs_\bk is a non-null
+ pointer, p\bpp\bpo\bol\bll\bl() atomically sets the calling thread's signal mask to the
+ signal set pointed to by _\bm_\ba_\bs_\bk for the duration of the function call. In
+ this case, the original signal mask will be restored before p\bpp\bpo\bol\bll\bl()
+ returns.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon error, p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() return -1 and set the global variable
+ _\be_\br_\br_\bn_\bo to indicate the error. If the timeout interval was reached before
+ any events occurred, they return 0. Otherwise, they return the number of
+ _\bp_\bo_\bl_\bl_\bf_\bd structures for which _\br_\be_\bv_\be_\bn_\bt_\bs is non-zero.
+
+I\bID\bDI\bIO\bOM\bMS\bS
+ Care must be taken when converting code from select(2) to p\bpo\bol\bll\bl() as they
+ have slightly different semantics. The first semantic difference is
+ that, unlike select(2), p\bpo\bol\bll\bl() has a way of indicating that one or more
+ file descriptors is invalid by setting a flag in the _\br_\be_\bv_\be_\bn_\bt_\bs field of
+ corresponding entry of _\bf_\bd_\bs, whereas select(2) returns an error (-1) if
+ any of the descriptors with bits set in the _\bf_\bd_\b__\bs_\be_\bt are invalid. The
+ second difference is that on EOF there is no guarantee that POLLIN will
+ be set in _\br_\be_\bv_\be_\bn_\bt_\bs, the caller must also check for POLLHUP. This differs
+ from select(2) where EOF is considered as a read event.
+
+ Consider the following usage of select(2) that implements a read from the
+ standard input with a 60 second time out:
+
+ struct timeval timeout;
+ fd_set readfds;
+ char buf[BUFSIZ];
+ int nready;
+
+ timeout.tv_sec = 60;
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(STDIN_FILENO);
+ nready = select(STDIN_FILENO + 1, &readfds, NULL, NULL, &timeout);
+ if (nready == -1)
+ err(1, "select");
+ if (nready == 0)
+ errx(1, "time out");
+ if (FD_ISSET(STDIN_FILENO, &readfds)) {
+ if (read(STDIN_FILENO, buf, sizeof(buf)) == -1)
+ err(1, "read");
+ }
+
+ This can be converted to p\bpo\bol\bll\bl() as follows:
+
+ struct pollfd pdf[1];
+ char buf[BUFSIZ];
+ int nready;
+
+ pfd[0].fd = STDIN_FILENO;
+ pfd[0].events = POLLIN;
+ nready = poll(pfd, 1, 60 * 1000);
+ if (nready == -1)
+ err(1, "poll");
+ if (nready == 0)
+ errx(1, "time out");
+ if ((pfd[0].revents & (POLLERR|POLLNVAL)))
+ errx(1, "bad fd %d", pfd[0].fd);
+ if ((pfd[0].revents & (POLLIN|POLLHUP)))
+ if (read(STDIN_FILENO, buf, sizeof(buf)) == -1)
+ err(1, "read");
+ }
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() will fail if:
+
+ [EFAULT] _\bf_\bd_\bs points outside the process's allocated address
+ space.
+
+ [EINTR] A signal was caught before any polled events occurred
+ and before the timeout elapsed.
+
+ [EINVAL] _\bn_\bf_\bd_\bs was greater than the number of available file
+ descriptors.
+
+ [EINVAL] The timeout passed was invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), getrlimit(2), read(2), select(2), write(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The p\bpo\bol\bll\bl() function is compliant with the IEEE Std 1003.1-2008
+ (``POSIX.1'') specification. The p\bpp\bpo\bol\bll\bl() function is a Linux extension.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A p\bpo\bol\bll\bl() system call appeared in AT&T System V Release 3 UNIX. The
+ p\bpp\bpo\bol\bll\bl() function appeared in OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ The POLLWRBAND flag is accepted but ignored by the kernel.
+
+ Because OpenBSD does not implement STREAMS, there is no distinction
+ between some of the fields in the _\be_\bv_\be_\bn_\bt_\bs and _\br_\be_\bv_\be_\bn_\bt_\bs bitmasks. As a
+ result, the POLLIN, POLLNORM, and POLLRDNORM flags are equivalent.
+
+ Internally to the kernel, p\bpo\bol\bll\bl() and p\bpp\bpo\bol\bll\bl() work poorly if multiple
+ processes wait on the same file descriptor.
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bd, r\bre\bea\bad\bdv\bv, p\bpr\bre\bea\bad\bd, p\bpr\bre\bea\bad\bdv\bv - read input
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bea\bad\bd() attempts to read _\bn_\bb_\by_\bt_\be_\bs of data from the object referenced by the
+ descriptor _\bd into the buffer pointed to by _\bb_\bu_\bf. r\bre\bea\bad\bdv\bv() performs the
+ same action, but scatters the input data into the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() perform the same functions, but read
+ from the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the file
+ pointer.
+
+ For r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory where data should be placed. r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will always
+ fill an area completely before proceeding to the next.
+
+ On objects capable of seeking, the r\bre\bea\bad\bd() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from r\bre\bea\bad\bd(),
+ the pointer is incremented by the number of bytes actually read.
+
+ Objects that are not capable of seeking always read from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ Upon successful completion, r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() return
+ the number of bytes actually read and placed in the buffer. The system
+ guarantees to read the number of bytes requested if the descriptor
+ references a normal file that has that many bytes left before the end-of-
+ file, but in no other case.
+
+ Note that r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of bytes actually read is returned. Upon
+ reading end-of-file, zero is returned. Otherwise, a -1 is returned and
+ the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() will succeed unless:
+
+ [EBADF] _\bd is not a valid file or socket descriptor open for
+ reading.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EINTR] A read from a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data arrived.
+
+ In addition, r\bre\bea\bad\bd() and r\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ were ready to be read.
+
+ [ENOTCONN] The file is a socket associated with a connection-
+ oriented protocol and has not been connected.
+
+ [EIO] The process is a member of a background process
+ attempting to read from its controlling terminal, the
+ process is ignoring or blocking the SIGTTIN signal or
+ the process group is orphaned.
+
+ r\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bd() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dup(2), fcntl(2), open(2), pipe(2), poll(2), select(2), socket(2),
+ socketpair(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), and p\bpr\bre\bea\bad\bd() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A r\bre\bea\bad\bd() system call first appeared in Version 1 AT&T UNIX; r\bre\bea\bad\bdv\bv() in
+ 4.1cBSD; p\bpr\bre\bea\bad\bd() in AT&T System V Release 4 UNIX; and p\bpr\bre\bea\bad\bdv\bv() in
+ OpenBSD 2.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free r\bre\bea\bad\bd() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bd, r\bre\bea\bad\bdv\bv, p\bpr\bre\bea\bad\bd, p\bpr\bre\bea\bad\bdv\bv - read input
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bea\bad\bd() attempts to read _\bn_\bb_\by_\bt_\be_\bs of data from the object referenced by the
+ descriptor _\bd into the buffer pointed to by _\bb_\bu_\bf. r\bre\bea\bad\bdv\bv() performs the
+ same action, but scatters the input data into the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() perform the same functions, but read
+ from the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the file
+ pointer.
+
+ For r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory where data should be placed. r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will always
+ fill an area completely before proceeding to the next.
+
+ On objects capable of seeking, the r\bre\bea\bad\bd() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from r\bre\bea\bad\bd(),
+ the pointer is incremented by the number of bytes actually read.
+
+ Objects that are not capable of seeking always read from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ Upon successful completion, r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() return
+ the number of bytes actually read and placed in the buffer. The system
+ guarantees to read the number of bytes requested if the descriptor
+ references a normal file that has that many bytes left before the end-of-
+ file, but in no other case.
+
+ Note that r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of bytes actually read is returned. Upon
+ reading end-of-file, zero is returned. Otherwise, a -1 is returned and
+ the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() will succeed unless:
+
+ [EBADF] _\bd is not a valid file or socket descriptor open for
+ reading.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EINTR] A read from a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data arrived.
+
+ In addition, r\bre\bea\bad\bd() and r\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ were ready to be read.
+
+ [ENOTCONN] The file is a socket associated with a connection-
+ oriented protocol and has not been connected.
+
+ [EIO] The process is a member of a background process
+ attempting to read from its controlling terminal, the
+ process is ignoring or blocking the SIGTTIN signal or
+ the process group is orphaned.
+
+ r\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bd() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dup(2), fcntl(2), open(2), pipe(2), poll(2), select(2), socket(2),
+ socketpair(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), and p\bpr\bre\bea\bad\bd() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A r\bre\bea\bad\bd() system call first appeared in Version 1 AT&T UNIX; r\bre\bea\bad\bdv\bv() in
+ 4.1cBSD; p\bpr\bre\bea\bad\bd() in AT&T System V Release 4 UNIX; and p\bpr\bre\bea\bad\bdv\bv() in
+ OpenBSD 2.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free r\bre\bea\bad\bd() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ p\bpr\bro\bof\bfi\bil\bl - control process profiling
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpr\bro\bof\bfi\bil\bl(_\bc_\bh_\ba_\br _\b*_\bs_\ba_\bm_\bp_\bl_\be_\bs, _\bs_\bi_\bz_\be_\b__\bt _\bs_\bi_\bz_\be, _\bu_\b__\bl_\bo_\bn_\bg _\bo_\bf_\bf_\bs_\be_\bt, _\bu_\b__\bi_\bn_\bt _\bs_\bc_\ba_\bl_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The p\bpr\bro\bof\bfi\bil\bl() function enables or disables program counter profiling of
+ the current process. If profiling is enabled, then at every clock tick,
+ the kernel updates an appropriate count in the _\bs_\ba_\bm_\bp_\bl_\be_\bs buffer.
+
+ The buffer _\bs_\ba_\bm_\bp_\bl_\be_\bs contains _\bs_\bi_\bz_\be bytes and is divided into a series of
+ 16-bit bins. Each bin counts the number of times the program counter was
+ in a particular address range in the process when a clock tick occurred
+ while profiling was enabled. For a given program counter address, the
+ number of the corresponding bin is given by the relation:
+
+ [(pc - offset) / 2] * scale / 65536
+
+ The _\bo_\bf_\bf_\bs_\be_\bt parameter is the lowest address at which the kernel takes
+ program counter samples. The _\bs_\bc_\ba_\bl_\be parameter ranges from 1 to 65536 and
+ can be used to change the span of the bins. A scale of 65536 maps each
+ bin to 2 bytes of address range; a scale of 32768 gives 4 bytes, 16384
+ gives 8 bytes and so on. Intermediate values provide approximate
+ intermediate ranges. A _\bs_\bc_\ba_\bl_\be value of 0 disables profiling.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the _\bs_\bc_\ba_\bl_\be value is nonzero and the buffer _\bs_\ba_\bm_\bp_\bl_\be_\bs contains an illegal
+ address, p\bpr\bro\bof\bfi\bil\bl() returns -1, profiling is terminated, and _\be_\br_\br_\bn_\bo is set
+ appropriately. Otherwise, p\bpr\bro\bof\bfi\bil\bl() returns 0.
+
+F\bFI\bIL\bLE\bES\bS
+ _\b/_\bu_\bs_\br_\b/_\bl_\bi_\bb_\b/_\bg_\bc_\br_\bt_\b0_\b._\bo profiling C run-time startup file
+ _\bg_\bm_\bo_\bn_\b._\bo_\bu_\bt conventional name for profiling output file
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The following error may be reported:
+
+ [EFAULT] The buffer _\bs_\ba_\bm_\bp_\bl_\be_\bs contains an invalid address.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ gprof(1)
+
+B\bBU\bUG\bGS\bS
+ This routine should be named p\bpr\bro\bof\bfi\bil\ble\be().
+
+ The _\bs_\ba_\bm_\bp_\bl_\be_\bs argument should really be a vector of type _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bs_\bh_\bo_\br_\bt.
+
+ The format of the gmon.out file is undocumented.
+
+N\bNA\bAM\bME\bE
+ s\bse\bel\ble\bec\bct\bt, p\bps\bse\bel\ble\bec\bct\bt - synchronous I/O multiplexing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bse\bel\ble\bec\bct\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bel\ble\bec\bct\bt(_\bi_\bn_\bt _\bn_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\br_\be_\ba_\bd_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ _\bi_\bn_\bt
+ p\bps\bse\bel\ble\bec\bct\bt(_\bi_\bn_\bt _\bn_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\br_\be_\ba_\bd_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt, _\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bm_\ba_\bs_\bk);
+
+ F\bFD\bD_\b_S\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_C\bCL\bLR\bR(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_I\bIS\bSS\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_Z\bZE\bER\bRO\bO(_\b&_\bf_\bd_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bel\ble\bec\bct\bt() examines the I/O descriptor sets whose addresses are passed in
+ _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, and _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs to see if some of their descriptors are
+ ready for reading, are ready for writing, or have an exceptional
+ condition pending, respectively. The first _\bn_\bf_\bd_\bs descriptors are checked
+ in each set; i.e., the descriptors from 0 through _\bn_\bf_\bd_\bs-1 in the
+ descriptor sets are examined. On return, s\bse\bel\ble\bec\bct\bt() replaces the given
+ descriptor sets with subsets consisting of those descriptors that are
+ ready for the requested operation. s\bse\bel\ble\bec\bct\bt() returns the total number of
+ ready descriptors in all the sets.
+
+ The descriptor sets are stored as bit fields in arrays of integers. The
+ following macros are provided for manipulating such descriptor sets:
+ F\bFD\bD_\b_Z\bZE\bER\bRO\bO(_\b&_\bf_\bd_\bs_\be_\bt) initializes a descriptor set _\bf_\bd_\bs_\be_\bt to the null set.
+ F\bFD\bD_\b_S\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) includes a particular descriptor _\bf_\bd in _\bf_\bd_\bs_\be_\bt.
+ F\bFD\bD_\b_C\bCL\bLR\bR(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) removes _\bf_\bd from _\bf_\bd_\bs_\be_\bt. F\bFD\bD_\b_I\bIS\bSS\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) is non-
+ zero if _\bf_\bd is a member of _\bf_\bd_\bs_\be_\bt, zero otherwise. The behavior of these
+ macros is undefined if a descriptor value is less than zero or greater
+ than or equal to FD_SETSIZE, which is normally at least equal to the
+ maximum number of descriptors supported by the system.
+
+ If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a non-null pointer, it specifies a maximum interval to wait
+ for the selection to complete. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a null pointer, the select
+ blocks indefinitely. To effect a poll, the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument should be
+ non-null, pointing to a zero-valued timeval structure. _\bt_\bi_\bm_\be_\bo_\bu_\bt is not
+ changed by s\bse\bel\ble\bec\bct\bt(), and may be reused on subsequent calls; however, it
+ is good style to re-initialize it before each invocation of s\bse\bel\ble\bec\bct\bt().
+
+ Any of _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, and _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs may be given as null pointers if
+ no descriptors are of interest.
+
+ The p\bps\bse\bel\ble\bec\bct\bt() function is similar to s\bse\bel\ble\bec\bct\bt() except that it specifies
+ the timeout using a timespec structure. Also, if _\bm_\ba_\bs_\bk is a non-null
+ pointer, p\bps\bse\bel\ble\bec\bct\bt() atomically sets the calling thread's signal mask to
+ the signal set pointed to by _\bm_\ba_\bs_\bk for the duration of the function call.
+ In this case, the original signal mask will be restored before p\bps\bse\bel\ble\bec\bct\bt()
+ returns.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, s\bse\bel\ble\bec\bct\bt() and p\bps\bse\bel\ble\bec\bct\bt() return the number of ready
+ descriptors that are contained in the descriptor sets. If a descriptor
+ is included in multiple descriptor sets, each inclusion is counted
+ separately. If the time limit expires before any descriptors become
+ ready, they return 0.
+
+ Otherwise, if s\bse\bel\ble\bec\bct\bt() or p\bps\bse\bel\ble\bec\bct\bt() return with an error, including one
+ due to an interrupted call, they return -1, and the descriptor sets will
+ be unmodified.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ An error return from s\bse\bel\ble\bec\bct\bt() or p\bps\bse\bel\ble\bec\bct\bt() indicates:
+
+ [EFAULT] One or more of _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, or _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs points
+ outside the process's allocated address space.
+
+ [EBADF] One of the descriptor sets specified an invalid
+ descriptor.
+
+ [EINTR] A signal was delivered before the time limit expired
+ and before any of the selected descriptors became
+ ready.
+
+ [EINVAL] The specified time limit is invalid. One of its
+ components is negative or too large.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), clock_gettime(2), connect(2), gettimeofday(2), poll(2),
+ read(2), recv(2), send(2), write(2), getdtablesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bel\ble\bec\bct\bt() system call first appeared in 4.1cBSD. The p\bps\bse\bel\ble\bec\bct\bt() system
+ call has been available since OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ Although the provision of getdtablesize(3) was intended to allow user
+ programs to be written independent of the kernel limit on the number of
+ open files, the dimension of a sufficiently large bit field for select
+ remains a problem. The default bit size of _\bf_\bd_\b__\bs_\be_\bt is based on the symbol
+ FD_SETSIZE (currently 1024), but that is somewhat smaller than the
+ current kernel limit to the number of open files. However, in order to
+ accommodate programs which might potentially use a larger number of open
+ files with select, it is possible to increase this size within a program
+ by providing a larger definition of FD_SETSIZE before the inclusion of
+ any headers. The kernel will cope, and the userland libraries provided
+ with the system are also ready for large numbers of file descriptors.
+
+ Alternatively, to be really safe, it is possible to allocate _\bf_\bd_\b__\bs_\be_\bt bit-
+ arrays dynamically. The idea is to permit a program to work properly
+ even if it is execve(2)'d with 4000 file descriptors pre-allocated. The
+ following illustrates the technique which is used by userland libraries:
+
+ fd_set *fdsr;
+ int max = fd;
+
+ fdsr = calloc(howmany(max+1, NFDBITS), sizeof(fd_mask));
+ if (fdsr == NULL) {
+ ...
+ return (-1);
+ }
+ FD_SET(fd, fdsr);
+ n = select(max+1, fdsr, NULL, NULL, &tv);
+ ...
+ free(fdsr);
+
+ Alternatively, it is possible to use the poll(2) interface. poll(2) is
+ more efficient when the size of s\bse\bel\ble\bec\bct\bt()'s _\bf_\bd_\b__\bs_\be_\bt bit-arrays are very
+ large, and for fixed numbers of file descriptors one need not size and
+ dynamically allocate a memory object.
+
+ s\bse\bel\ble\bec\bct\bt() should probably have been designed to return the time remaining
+ from the original timeout, if any, by modifying the time value in place.
+ Even though some systems stupidly act in this different way, it is
+ unlikely this semantic will ever be commonly implemented, as the change
+ causes massive source code compatibility problems. Furthermore, recent
+ new standards have dictated the current behaviour. In general, due to
+ the existence of those brain-damaged non-conforming systems, it is unwise
+ to assume that the timeout value will be unmodified by the s\bse\bel\ble\bec\bct\bt() call,
+ and the caller should reinitialize it on each invocation. Calculating
+ the delta is easily done by calling gettimeofday(2) before and after the
+ call to s\bse\bel\ble\bec\bct\bt(), and using t\bti\bim\bme\ber\brs\bsu\bub\bb() (as described in getitimer(2)).
+
+ Internally to the kernel, s\bse\bel\ble\bec\bct\bt() and p\bps\bse\bel\ble\bec\bct\bt() work poorly if multiple
+ processes wait on the same file descriptor. Given that, it is rather
+ surprising to see that many daemons are written that way.
+
+N\bNA\bAM\bME\bE
+ p\bpt\btr\bra\bac\bce\be - process tracing and debugging
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpt\btr\bra\bac\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ p\bpt\btr\bra\bac\bce\be(_\bi_\bn_\bt _\br_\be_\bq_\bu_\be_\bs_\bt, _\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bc_\ba_\bd_\bd_\br_\b__\bt _\ba_\bd_\bd_\br, _\bi_\bn_\bt _\bd_\ba_\bt_\ba);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ p\bpt\btr\bra\bac\bce\be() provides tracing and debugging facilities. It allows one
+ process (the _\bt_\br_\ba_\bc_\bi_\bn_\bg process) to control another (the _\bt_\br_\ba_\bc_\be_\bd process).
+ Most of the time, the traced process runs normally, but when it receives
+ a signal (see sigaction(2)), it stops. The tracing process is expected
+ to notice this via wait(2) or the delivery of a SIGCHLD signal, examine
+ the state of the stopped process, and cause it to terminate or continue
+ as appropriate. p\bpt\btr\bra\bac\bce\be() is the mechanism by which all this happens.
+ p\bpt\btr\bra\bac\bce\be() is only available on kernels compiled with the P\bPT\bTR\bRA\bAC\bCE\bE option.
+
+ The _\br_\be_\bq_\bu_\be_\bs_\bt argument specifies what operation is being performed; the
+ meaning of the rest of the arguments depends on the operation, but except
+ for one special case noted below, all p\bpt\btr\bra\bac\bce\be() calls are made by the
+ tracing process, and the _\bp_\bi_\bd argument specifies the process ID of the
+ traced process. _\br_\be_\bq_\bu_\be_\bs_\bt can be:
+
+ PT_TRACE_ME This request is the only one used by the traced process; it
+ declares that the process expects to be traced by its
+ parent. All the other arguments are ignored. (If the
+ parent process does not expect to trace the child, it will
+ probably be rather confused by the results; once the traced
+ process stops, it cannot be made to continue except via
+ p\bpt\btr\bra\bac\bce\be().) When a process has used this request and calls
+ execve(2) or any of the routines built on it (such as
+ execv(3)), it will stop before executing the first
+ instruction of the new image. Also, any setuid or setgid
+ bits on the executable being executed will be ignored.
+
+ PT_READ_I, PT_READ_D
+ These requests read a single int of data from the traced
+ process' address space. Traditionally, p\bpt\btr\bra\bac\bce\be() has
+ allowed for machines with distinct address spaces for
+ instruction and data, which is why there are two requests:
+ conceptually, PT_READ_I reads from the instruction space
+ and PT_READ_D reads from the data space. In the current
+ OpenBSD implementation, these two requests are completely
+ identical. The _\ba_\bd_\bd_\br argument specifies the address (in the
+ traced process' virtual address space) at which the read is
+ to be done. This address does not have to meet any
+ alignment constraints. The value read is returned as the
+ return value from p\bpt\btr\bra\bac\bce\be().
+
+ PT_WRITE_I, PT_WRITE_D
+ These requests parallel PT_READ_I and PT_READ_D, except
+ that they write rather than read. The _\bd_\ba_\bt_\ba argument
+ supplies the value to be written.
+
+ PT_CONTINUE The traced process continues execution. _\ba_\bd_\bd_\br is an address
+ specifying the place where execution is to be resumed (a
+ new value for the program counter), or (caddr_t)1 to
+ indicate that execution is to pick up where it left off.
+ _\bd_\ba_\bt_\ba provides a signal number to be delivered to the traced
+ process as it resumes execution, or 0 if no signal is to be
+ sent.
+
+ PT_KILL The traced process terminates, as if PT_CONTINUE had been
+ used with SIGKILL given as the signal to be delivered.
+
+ PT_ATTACH This request allows a process to gain control of an
+ otherwise unrelated process and begin tracing it. It does
+ not need any cooperation from the to-be-traced process. In
+ this case, _\bp_\bi_\bd specifies the process ID of the to-be-traced
+ process, and the other two arguments are ignored. This
+ request requires that the target process must have the same
+ real UID as the tracing process, and that it must not be
+ executing a set-user-ID or set-group-ID executable.
+ Additionally, if the kern.global_ptrace sysctl is 0, then
+ the target process must be a descendent of the tracing
+ process. (If the tracing process is running as root, these
+ restrictions do not apply.) The tracing process will see
+ the newly traced process stop and may then control it as if
+ it had been traced all along.
+
+ PT_DETACH This request is like PT_CONTINUE, except that it does not
+ allow specifying an alternate place to continue execution,
+ and after it succeeds, the traced process is no longer
+ traced and continues execution normally.
+
+ PT_IO This request is a more general interface that can be used
+ instead of PT_READ_D, PT_WRITE_D, PT_READ_I and PT_WRITE_I.
+ The I/O request is encoded in a ``struct ptrace_io_desc''
+ defined as:
+
+ struct ptrace_io_desc {
+ int piod_op;
+ void *piod_offs;
+ void *piod_addr;
+ size_t piod_len;
+ };
+
+ Where _\bp_\bi_\bo_\bd_\b__\bo_\bf_\bf_\bs is the offset within the traced process
+ where the I/O operation should be made, _\bp_\bi_\bo_\bd_\b__\ba_\bd_\bd_\br is the
+ buffer in the parent and _\bp_\bi_\bo_\bd_\b__\bl_\be_\bn is the length of the I/O
+ request. The _\bp_\bi_\bo_\bd_\b__\bo_\bp member specifies what operation needs
+ to be done. Possible values are:
+
+ PIOD_READ_D
+ PIOD_WRITE_D
+ PIOD_READ_I
+ PIOD_WRITE_I
+ PIOD_READ_AUXV
+
+ See also the description of PT_READ_I for the difference
+ between D and I spaces. The PIOD_READ_AUXV operation can
+ be used to read from the ELF auxiliary vector. A pointer
+ to the descriptor is passed in _\ba_\bd_\bd_\br. On return the
+ _\bp_\bi_\bo_\bd_\b__\bl_\be_\bn field in the descriptor will be updated with the
+ actual number of bytes transferred. If the requested I/O
+ couldn't be successfully performed p\bpt\btr\bra\bac\bce\be() will return -1
+ and set _\be_\br_\br_\bn_\bo.
+
+ PT_SET_EVENT_MASK
+ This request can be used to specify which events in the
+ traced process should be reported to the tracing process.
+ These events are specified in a ``struct ptrace_event''
+ defined as:
+
+ typedef struct ptrace_event {
+ int pe_set_event;
+ } ptrace_event_t;
+
+ Where _\bp_\be_\b__\bs_\be_\bt_\b__\be_\bv_\be_\bn_\bt is the set of events to be reported.
+ This set is formed by OR'ing together the following values:
+
+ PTRACE_FORK Report fork(2).
+
+ A pointer to this structure is passed in _\ba_\bd_\bd_\br. The _\bd_\ba_\bt_\ba
+ argument should be set to sizeof(struct ptrace_event).
+
+ PT_GET_EVENT_MASK
+ This request can be used to determine which events in the
+ traced process will be reported. The information is read
+ into the ``struct ptrace_event'' pointed to by _\ba_\bd_\bd_\br. The
+ _\bd_\ba_\bt_\ba argument should be set to sizeof(struct ptrace_event).
+
+ PT_GET_PROCESS_STATE
+ This request reads the state information associated with
+ the event that stopped the traced process. The information
+ is reported in a ``struct ptrace_state'' defined as:
+
+ typedef struct ptrace_state {
+ int pe_report_event;
+ pid_t pe_other_pid;
+ } ptrace_state_t;
+
+ Where _\bp_\be_\b__\br_\be_\bp_\bo_\br_\bt_\b__\be_\bv_\be_\bn_\bt is the event being reported. If the
+ event being reported is PTRACE_FORK, _\bp_\be_\b__\bo_\bt_\bh_\be_\br_\b__\bp_\bi_\bd will be
+ set to the process ID of the other end of the fork. A
+ pointer to this structure is passed in _\ba_\bd_\bd_\br. The _\bd_\ba_\bt_\ba
+ argument should be set to sizeof(struct ptrace_state).
+
+ Additionally, machine-specific requests can exist. Depending on the
+ architecture, the following requests may be available under OpenBSD:
+
+ PT_GETREGS (all platforms)
+ This request reads the traced process' machine registers
+ into the ``struct reg'' (defined in <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>)
+ pointed to by _\ba_\bd_\bd_\br.
+
+ PT_SETREGS (all platforms)
+ This request is the converse of PT_GETREGS; it loads the
+ traced process' machine registers from the ``struct reg''
+ (defined in <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>) pointed to by _\ba_\bd_\bd_\br.
+
+ PT_STEP (not available on sparc and sparc64)
+ The traced process continues execution, as in request
+ PT_CONTINUE; however, execution stops as soon as possible
+ after execution of at least one instruction (single-step).
+
+ PT_GETFPREGS (not available on aviion, luna88k, sgi and vax)
+ This request reads the traced process' floating-point
+ registers into the ``struct fpreg'' (defined in
+ <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>) pointed to by _\ba_\bd_\bd_\br.
+
+ PT_SETFPREGS (not available on aviion, luna88k, sgi and vax)
+ This request is the converse of PT_GETFPREGS; it loads the
+ traced process' floating-point registers from the ``struct
+ fpreg'' (defined in <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>) pointed to by _\ba_\bd_\bd_\br.
+
+ PT_GETXMMREGS (i386 only)
+ This request reads the traced process' XMM registers into
+ the ``struct xmmregs'' (defined in <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>) pointed
+ to by _\ba_\bd_\bd_\br.
+
+ PT_SETXMMREGS (i386 only)
+ This request is the converse of PT_GETXMMREGS; it loads the
+ traced process' XMM registers from the ``struct xmmregs''
+ (defined in <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\br_\be_\bg_\b._\bh>) pointed to by _\ba_\bd_\bd_\br.
+
+ PT_WCOOKIE (sparc and sparc64 only)
+ This request reads the traced process' `window cookie' into
+ the int pointed to by _\ba_\bd_\bd_\br. The window cookie needs to be
+ `XOR'ed' to stack-saved program counters.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ Some requests can cause p\bpt\btr\bra\bac\bce\be() to return -1 as a non-error value; to
+ disambiguate, _\be_\br_\br_\bn_\bo is set to zero and this should be checked. The
+ possible errors are:
+
+ [ESRCH]
+ No process having the specified process ID exists.
+
+ [EINVAL]
+ +\b+\bo\bo A process attempted to use PT_ATTACH on itself.
+ +\b+\bo\bo The _\br_\be_\bq_\bu_\be_\bs_\bt was not one of the legal requests.
+ +\b+\bo\bo The signal number (in _\bd_\ba_\bt_\ba) to PT_CONTINUE was neither 0 nor a
+ legal signal number.
+ +\b+\bo\bo PT_GETREGS, PT_SETREGS, PT_GETFPREGS, or PT_SETFPREGS was
+ attempted on a process with no valid register set. (This is
+ normally true only of system processes.)
+
+ [EBUSY]
+ +\b+\bo\bo PT_ATTACH was attempted on a process that was already being
+ traced.
+ +\b+\bo\bo A request attempted to manipulate a process that was being
+ traced by some process other than the one making the request.
+ +\b+\bo\bo A request (other than PT_ATTACH) specified a process that
+ wasn't stopped.
+
+ [EPERM]
+ +\b+\bo\bo A request (other than PT_ATTACH) attempted to manipulate a
+ process that wasn't being traced at all.
+ +\b+\bo\bo An attempt was made to use PT_ATTACH on a process in violation
+ of the requirements listed under PT_ATTACH above.
+ +\b+\bo\bo An attempt was made to use PT_ATTACH on a system process.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpt\btr\bra\bac\bce\be() system call first appeared in Version 6 AT&T UNIX.
+
+B\bBU\bUG\bGS\bS
+ On several RISC architectures (such as aviion, luna88k, sparc and
+ sparc64), the PC is set to the provided PC value for PT_CONTINUE and
+ similar calls, and the remainder of the execution pipeline registers are
+ set to the following instructions, even if the instruction at PC is a
+ branch instruction. Using PT_GETREGS and PT_SETREGS to modify the PC,
+ passing (caddr_t)1 to p\bpt\btr\bra\bac\bce\be(), should be able to sidestep this.
+
+N\bNA\bAM\bME\bE
+ w\bwr\bri\bit\bte\be, w\bwr\bri\bit\bte\bev\bv, p\bpw\bwr\bri\bit\bte\be, p\bpw\bwr\bri\bit\bte\bev\bv - write output
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ w\bwr\bri\bit\bte\be() attempts to write _\bn_\bb_\by_\bt_\be_\bs of data to the object referenced by the
+ descriptor _\bd from the buffer pointed to by _\bb_\bu_\bf. w\bwr\bri\bit\bte\bev\bv() performs the
+ same action, but gathers the output data from the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() perform the same functions, but
+ write to the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the
+ file pointer.
+
+ For w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory from which data should be written. w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will
+ always write a complete area before proceeding to the next.
+
+ On objects capable of seeking, the w\bwr\bri\bit\bte\be() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from w\bwr\bri\bit\bte\be(),
+ the pointer is incremented by the number of bytes which were written. If
+ a file was opened with the O_APPEND flag (see open(2)), calls to w\bwr\bri\bit\bte\be()
+ or w\bwr\bri\bit\bte\bev\bv() will automatically set the pointer to the end of the file
+ before writing.
+
+ Objects that are not capable of seeking always write from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ If the real user is not the superuser, then w\bwr\bri\bit\bte\be() clears the set-user-
+ ID bit on a file. This prevents penetration of system security by a user
+ who ``captures'' a writable set-user-ID file owned by the superuser.
+
+ If w\bwr\bri\bit\bte\be() succeeds it will update the st_ctime and st_mtime fields of
+ the file's meta-data (see stat(2)).
+
+ When using non-blocking I/O on objects such as sockets that are subject
+ to flow control, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may write fewer bytes than
+ requested; the return value must be noted, and the remainder of the
+ operation should be retried when possible.
+
+ Note that w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion the number of bytes which were written is
+ returned. Otherwise, a -1 is returned and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwr\bri\bit\bte\be(), p\bpw\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\bev\bv() will fail and the file pointer
+ will remain unchanged if:
+
+ [EBADF] _\bd is not a valid descriptor open for writing.
+
+ [EFBIG] An attempt was made to write a file that exceeds the
+ process's file size limit or the maximum file size.
+
+ [ENOSPC] There is no free space remaining on the file system
+ containing the file.
+
+ [EDQUOT] The user's quota of disk blocks on the file system
+ containing the file has been exhausted.
+
+ [EINTR] A write to a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data could be
+ written.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ In addition, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may return the following errors:
+
+ [EPIPE] An attempt is made to write to a pipe that is not open
+ for reading by any process.
+
+ [EPIPE] An attempt is made to write to a socket of type
+ SOCK_STREAM that is not connected to a peer socket.
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ could be written immediately.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [EDESTADDRREQ] The destination is no longer available when writing to
+ a UNIX-domain datagram socket on which connect(2) had
+ been used to set a destination address.
+
+ [EIO] The process is a member of a background process
+ attempting to write to its controlling terminal,
+ TOSTOP is set on the terminal, the process isn't
+ ignoring the SIGTTOUT signal and the thread isn't
+ blocking the SIGTTOUT signal, and either the process
+ was created with vfork(2) and hasn't successfully
+ executed one of the exec functions or the process
+ group is orphaned.
+
+ w\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\be() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() may return the following error:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+ [ENOBUFS] The system lacked sufficient buffer space or a queue
+ was full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), lseek(2), open(2), pipe(2), poll(2), select(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\be() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpw\bwr\bri\bit\bte\bev\bv() function call appeared in OpenBSD 2.7. The p\bpw\bwr\bri\bit\bte\be()
+ function call appeared in AT&T System V Release 4 UNIX. The w\bwr\bri\bit\bte\bev\bv()
+ function call appeared in 4.2BSD. The w\bwr\bri\bit\bte\be() function call appeared in
+ Version 2 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = write(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free w\bwr\bri\bit\bte\be() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = write(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ w\bwr\bri\bit\bte\be, w\bwr\bri\bit\bte\bev\bv, p\bpw\bwr\bri\bit\bte\be, p\bpw\bwr\bri\bit\bte\bev\bv - write output
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ w\bwr\bri\bit\bte\be() attempts to write _\bn_\bb_\by_\bt_\be_\bs of data to the object referenced by the
+ descriptor _\bd from the buffer pointed to by _\bb_\bu_\bf. w\bwr\bri\bit\bte\bev\bv() performs the
+ same action, but gathers the output data from the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() perform the same functions, but
+ write to the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the
+ file pointer.
+
+ For w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory from which data should be written. w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will
+ always write a complete area before proceeding to the next.
+
+ On objects capable of seeking, the w\bwr\bri\bit\bte\be() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from w\bwr\bri\bit\bte\be(),
+ the pointer is incremented by the number of bytes which were written. If
+ a file was opened with the O_APPEND flag (see open(2)), calls to w\bwr\bri\bit\bte\be()
+ or w\bwr\bri\bit\bte\bev\bv() will automatically set the pointer to the end of the file
+ before writing.
+
+ Objects that are not capable of seeking always write from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ If the real user is not the superuser, then w\bwr\bri\bit\bte\be() clears the set-user-
+ ID bit on a file. This prevents penetration of system security by a user
+ who ``captures'' a writable set-user-ID file owned by the superuser.
+
+ If w\bwr\bri\bit\bte\be() succeeds it will update the st_ctime and st_mtime fields of
+ the file's meta-data (see stat(2)).
+
+ When using non-blocking I/O on objects such as sockets that are subject
+ to flow control, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may write fewer bytes than
+ requested; the return value must be noted, and the remainder of the
+ operation should be retried when possible.
+
+ Note that w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion the number of bytes which were written is
+ returned. Otherwise, a -1 is returned and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwr\bri\bit\bte\be(), p\bpw\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\bev\bv() will fail and the file pointer
+ will remain unchanged if:
+
+ [EBADF] _\bd is not a valid descriptor open for writing.
+
+ [EFBIG] An attempt was made to write a file that exceeds the
+ process's file size limit or the maximum file size.
+
+ [ENOSPC] There is no free space remaining on the file system
+ containing the file.
+
+ [EDQUOT] The user's quota of disk blocks on the file system
+ containing the file has been exhausted.
+
+ [EINTR] A write to a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data could be
+ written.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ In addition, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may return the following errors:
+
+ [EPIPE] An attempt is made to write to a pipe that is not open
+ for reading by any process.
+
+ [EPIPE] An attempt is made to write to a socket of type
+ SOCK_STREAM that is not connected to a peer socket.
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ could be written immediately.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [EDESTADDRREQ] The destination is no longer available when writing to
+ a UNIX-domain datagram socket on which connect(2) had
+ been used to set a destination address.
+
+ [EIO] The process is a member of a background process
+ attempting to write to its controlling terminal,
+ TOSTOP is set on the terminal, the process isn't
+ ignoring the SIGTTOUT signal and the thread isn't
+ blocking the SIGTTOUT signal, and either the process
+ was created with vfork(2) and hasn't successfully
+ executed one of the exec functions or the process
+ group is orphaned.
+
+ w\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\be() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() may return the following error:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+ [ENOBUFS] The system lacked sufficient buffer space or a queue
+ was full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), lseek(2), open(2), pipe(2), poll(2), select(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\be() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpw\bwr\bri\bit\bte\bev\bv() function call appeared in OpenBSD 2.7. The p\bpw\bwr\bri\bit\bte\be()
+ function call appeared in AT&T System V Release 4 UNIX. The w\bwr\bri\bit\bte\bev\bv()
+ function call appeared in 4.2BSD. The w\bwr\bri\bit\bte\be() function call appeared in
+ Version 2 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = write(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free w\bwr\bri\bit\bte\be() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = write(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ q\bqu\buo\bot\bta\bac\bct\btl\bl - manipulate filesystem quotas
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\buf\bfs\bs/\b/u\buf\bfs\bs/\b/q\bqu\buo\bot\bta\ba.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ q\bqu\buo\bot\bta\bac\bct\btl\bl(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bc_\bm_\bd, _\bi_\bn_\bt _\bi_\bd, _\bc_\bh_\ba_\br _\b*_\ba_\bd_\bd_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The q\bqu\buo\bot\bta\bac\bct\btl\bl() call enables, disables and manipulates filesystem quotas.
+ A quota control command given by _\bc_\bm_\bd operates on the given filename _\bp_\ba_\bt_\bh
+ for the given user _\bi_\bd. The address of an optional command specific data
+ structure, _\ba_\bd_\bd_\br, may be given; its interpretation is discussed below with
+ each command.
+
+ Currently quotas are supported only for the ``ffs'' filesystem. For
+ ``ffs'', a command is composed of a primary command (see below) and a
+ command type used to interpret the _\bi_\bd. Types are supported for
+ interpretation of user identifiers and group identifiers. The ``ffs''
+ specific commands are:
+
+ Q_QUOTAON Enable disk quotas for the filesystem specified by _\bp_\ba_\bt_\bh. The
+ command type specifies the type of the quotas being enabled.
+ The _\ba_\bd_\bd_\br argument specifies a file from which to take the
+ quotas. The quota file must exist; it is normally created
+ with the quotacheck(8) program. The _\bi_\bd argument is unused.
+ Only the superuser may turn quotas on.
+
+ Q_QUOTAOFF
+ Disable disk quotas for the filesystem specified by _\bp_\ba_\bt_\bh. The
+ command type specifies the type of the quotas being disabled.
+ The _\ba_\bd_\bd_\br and _\bi_\bd arguments are unused. Only the superuser may
+ turn quotas off.
+
+ Q_GETQUOTA
+ Get disk quota limits and current usage for the user or group
+ (as determined by the command type) with identifier _\bi_\bd. _\ba_\bd_\bd_\br
+ is a pointer to a struct dqblk structure.
+
+ Q_SETQUOTA
+ Set disk quota limits for the user or group (as determined by
+ the command type) with identifier _\bi_\bd. _\ba_\bd_\bd_\br is a pointer to a
+ struct dqblk structure. The usage fields of struct dqblk
+ structure are ignored. This call is restricted to the
+ superuser.
+
+ Q_SETUSE Set disk usage limits for the user or group (as determined by
+ the command type) with identifier _\bi_\bd. _\ba_\bd_\bd_\br is a pointer to a
+ struct dqblk structure. Only the usage fields are used. This
+ call is restricted to the superuser.
+
+ Q_SYNC Update the on-disk copy of quota usages. The command type
+ specifies which type of quotas are to be updated. The _\bi_\bd and
+ _\ba_\bd_\bd_\br parameters are ignored.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ A q\bqu\buo\bot\bta\bac\bct\btl\bl() call will fail if:
+
+ [EOPNOTSUPP] The kernel has not been compiled with the QUOTA
+ option.
+
+ [EUSERS] The quota table cannot be expanded.
+
+ [EINVAL] _\bc_\bm_\bd or the command type is invalid.
+
+ [EACCES] In Q_QUOTAON, the quota file is not a plain file.
+
+ [EACCES] Search permission is denied for a component of a path
+ prefix.
+
+ [ENOTDIR] A component of a path prefix was not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A filename does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating a pathname.
+
+ [EROFS] In Q_QUOTAON, the quota file resides on a read-only
+ filesystem.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ a file containing quotas.
+
+ [EFAULT] An invalid _\ba_\bd_\bd_\br was supplied; the associated structure
+ could not be copied in or out of the kernel.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EPERM] The call was privileged and the caller was not the
+ superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ quota(1), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The q\bqu\buo\bot\bta\bac\bct\btl\bl() function call appeared in 4.3BSD-Reno.
+
+B\bBU\bUG\bGS\bS
+ There should be some way to integrate this call with the resource limit
+ interface provided by setrlimit(2) and getrlimit(2).
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bd, r\bre\bea\bad\bdv\bv, p\bpr\bre\bea\bad\bd, p\bpr\bre\bea\bad\bdv\bv - read input
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bea\bad\bd() attempts to read _\bn_\bb_\by_\bt_\be_\bs of data from the object referenced by the
+ descriptor _\bd into the buffer pointed to by _\bb_\bu_\bf. r\bre\bea\bad\bdv\bv() performs the
+ same action, but scatters the input data into the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() perform the same functions, but read
+ from the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the file
+ pointer.
+
+ For r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory where data should be placed. r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will always
+ fill an area completely before proceeding to the next.
+
+ On objects capable of seeking, the r\bre\bea\bad\bd() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from r\bre\bea\bad\bd(),
+ the pointer is incremented by the number of bytes actually read.
+
+ Objects that are not capable of seeking always read from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ Upon successful completion, r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() return
+ the number of bytes actually read and placed in the buffer. The system
+ guarantees to read the number of bytes requested if the descriptor
+ references a normal file that has that many bytes left before the end-of-
+ file, but in no other case.
+
+ Note that r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of bytes actually read is returned. Upon
+ reading end-of-file, zero is returned. Otherwise, a -1 is returned and
+ the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() will succeed unless:
+
+ [EBADF] _\bd is not a valid file or socket descriptor open for
+ reading.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EINTR] A read from a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data arrived.
+
+ In addition, r\bre\bea\bad\bd() and r\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ were ready to be read.
+
+ [ENOTCONN] The file is a socket associated with a connection-
+ oriented protocol and has not been connected.
+
+ [EIO] The process is a member of a background process
+ attempting to read from its controlling terminal, the
+ process is ignoring or blocking the SIGTTIN signal or
+ the process group is orphaned.
+
+ r\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bd() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dup(2), fcntl(2), open(2), pipe(2), poll(2), select(2), socket(2),
+ socketpair(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), and p\bpr\bre\bea\bad\bd() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A r\bre\bea\bad\bd() system call first appeared in Version 1 AT&T UNIX; r\bre\bea\bad\bdv\bv() in
+ 4.1cBSD; p\bpr\bre\bea\bad\bd() in AT&T System V Release 4 UNIX; and p\bpr\bre\bea\bad\bdv\bv() in
+ OpenBSD 2.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free r\bre\bea\bad\bd() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk, r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt - read value of a symbolic link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\br_\be_\bs_\bt_\br_\bi_\bc_\bt _\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\br_\be_\bs_\bt_\br_\bi_\bc_\bt _\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bs_\bi_\bz);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bs_\bi_\bz);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() function places the contents of the symbolic link _\bp_\ba_\bt_\bh in
+ the buffer _\bb_\bu_\bf, which has size _\bb_\bu_\bf_\bs_\bi_\bz. r\bre\bea\bad\bdl\bli\bin\bnk\bk does not append a NUL
+ character to _\bb_\bu_\bf.
+
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() function is equivalent to r\bre\bea\bad\bdl\bli\bin\bnk\bk() except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the symbolic link whose contents are read
+ is determined relative to the directory associated with file descriptor
+ _\bf_\bd instead of the current working directory.
+
+ If r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used and
+ the behavior is identical to a call to r\bre\bea\bad\bdl\bli\bin\bnk\bk().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns the count of characters placed in the buffer if it
+ succeeds, or a -1 if an error occurs, placing the error code in the
+ global variable _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk() and r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EINVAL] The named file is not a symbolic link.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EFAULT] _\bb_\bu_\bf or _\bp_\ba_\bt_\bh extends outside the process's allocated
+ address space.
+
+ Additionally, r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ lstat(2), stat(2), symlink(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() and r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() system call first appeared in 4.1cBSD. The r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt()
+ system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk, r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt - read value of a symbolic link
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\br_\be_\bs_\bt_\br_\bi_\bc_\bt _\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\br_\be_\bs_\bt_\br_\bi_\bc_\bt _\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bs_\bi_\bz);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bc_\bh_\ba_\br _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bb_\bu_\bf_\bs_\bi_\bz);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() function places the contents of the symbolic link _\bp_\ba_\bt_\bh in
+ the buffer _\bb_\bu_\bf, which has size _\bb_\bu_\bf_\bs_\bi_\bz. r\bre\bea\bad\bdl\bli\bin\bnk\bk does not append a NUL
+ character to _\bb_\bu_\bf.
+
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() function is equivalent to r\bre\bea\bad\bdl\bli\bin\bnk\bk() except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the symbolic link whose contents are read
+ is determined relative to the directory associated with file descriptor
+ _\bf_\bd instead of the current working directory.
+
+ If r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used and
+ the behavior is identical to a call to r\bre\bea\bad\bdl\bli\bin\bnk\bk().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns the count of characters placed in the buffer if it
+ succeeds, or a -1 if an error occurs, placing the error code in the
+ global variable _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk() and r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EINVAL] The named file is not a symbolic link.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EFAULT] _\bb_\bu_\bf or _\bp_\ba_\bt_\bh extends outside the process's allocated
+ address space.
+
+ Additionally, r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ lstat(2), stat(2), symlink(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() and r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bea\bad\bdl\bli\bin\bnk\bk() system call first appeared in 4.1cBSD. The r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt()
+ system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ r\bre\bea\bad\bd, r\bre\bea\bad\bdv\bv, p\bpr\bre\bea\bad\bd, p\bpr\bre\bea\bad\bdv\bv - read input
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bd(_\bi_\bn_\bt _\bd, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpr\bre\bea\bad\bdv\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bea\bad\bd() attempts to read _\bn_\bb_\by_\bt_\be_\bs of data from the object referenced by the
+ descriptor _\bd into the buffer pointed to by _\bb_\bu_\bf. r\bre\bea\bad\bdv\bv() performs the
+ same action, but scatters the input data into the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() perform the same functions, but read
+ from the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the file
+ pointer.
+
+ For r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory where data should be placed. r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will always
+ fill an area completely before proceeding to the next.
+
+ On objects capable of seeking, the r\bre\bea\bad\bd() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from r\bre\bea\bad\bd(),
+ the pointer is incremented by the number of bytes actually read.
+
+ Objects that are not capable of seeking always read from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ Upon successful completion, r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() return
+ the number of bytes actually read and placed in the buffer. The system
+ guarantees to read the number of bytes requested if the descriptor
+ references a normal file that has that many bytes left before the end-of-
+ file, but in no other case.
+
+ Note that r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the number of bytes actually read is returned. Upon
+ reading end-of-file, zero is returned. Otherwise, a -1 is returned and
+ the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), p\bpr\bre\bea\bad\bd(), and p\bpr\bre\bea\bad\bdv\bv() will succeed unless:
+
+ [EBADF] _\bd is not a valid file or socket descriptor open for
+ reading.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+ [EINTR] A read from a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data arrived.
+
+ In addition, r\bre\bea\bad\bd() and r\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ were ready to be read.
+
+ [ENOTCONN] The file is a socket associated with a connection-
+ oriented protocol and has not been connected.
+
+ [EIO] The process is a member of a background process
+ attempting to read from its controlling terminal, the
+ process is ignoring or blocking the SIGTTIN signal or
+ the process group is orphaned.
+
+ r\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bd() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpr\bre\bea\bad\bd() and p\bpr\bre\bea\bad\bdv\bv() may return the following errors:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ r\bre\bea\bad\bdv\bv() and p\bpr\bre\bea\bad\bdv\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dup(2), fcntl(2), open(2), pipe(2), poll(2), select(2), socket(2),
+ socketpair(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bea\bad\bd(), r\bre\bea\bad\bdv\bv(), and p\bpr\bre\bea\bad\bd() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A r\bre\bea\bad\bd() system call first appeared in Version 1 AT&T UNIX; r\bre\bea\bad\bdv\bv() in
+ 4.1cBSD; p\bpr\bre\bea\bad\bd() in AT&T System V Release 4 UNIX; and p\bpr\bre\bea\bad\bdv\bv() in
+ OpenBSD 2.7.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free r\bre\bea\bad\bd() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ r\bre\beb\bbo\boo\bot\bt - reboot system or halt processor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\beb\bbo\boo\bot\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\beb\bbo\boo\bot\bt(_\bi_\bn_\bt _\bh_\bo_\bw_\bt_\bo);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\beb\bbo\boo\bot\bt() reboots the system. Only the superuser may reboot a machine on
+ demand. However, a reboot is invoked automatically in the event of
+ unrecoverable system failures.
+
+ _\bh_\bo_\bw_\bt_\bo is a mask of options; the system call interface allows the
+ following options, defined in the include file <_\bs_\by_\bs_\b/_\br_\be_\bb_\bo_\bo_\bt_\b._\bh>, to be
+ passed to the new kernel or the new bootstrap and init programs.
+
+ RB_AUTOBOOT The default, causing the system to reboot in its usual
+ fashion.
+
+ RB_ASKNAME Interpreted by the bootstrap program itself, causing it to
+ prompt on the console as to what file should be booted.
+ Normally, the system is booted from the file
+ ``_\bx_\bx(0,0)bsd'', where _\bx_\bx is the default disk name, without
+ prompting for the file name.
+
+ RB_DFLTROOT Use the compiled in root device. Normally, the system uses
+ the device from which it was booted as the root device if
+ possible. (The default behavior is dependent on the
+ ability of the bootstrap program to determine the drive
+ from which it was loaded, which is not possible on all
+ systems.)
+
+ RB_DUMP Dump kernel memory before rebooting; see savecore(8) for
+ more information.
+
+ RB_HALT The processor is simply halted; no reboot takes place.
+
+ RB_POWERDOWN If used in conjunction with RB_HALT, and if the system
+ hardware supports the function, the system will be powered
+ off.
+
+ RB_USERREQ By default, the system will halt if r\bre\beb\bbo\boo\bot\bt() is called
+ during startup (before the system has finished
+ autoconfiguration), even if RB_HALT is not specified. This
+ is because panic(9)s during startup will probably just
+ repeat on the next boot. Use of this option implies that
+ the user has requested the action specified (for example,
+ using the ddb(4) b\bbo\boo\bot\bt r\bre\beb\bbo\boo\bot\bt command), so the system will
+ reboot if a halt is not explicitly requested.
+
+ RB_INITNAME An option allowing the specification of an init program
+ (see init(8)) other than _\b/_\bs_\bb_\bi_\bn_\b/_\bi_\bn_\bi_\bt to be run when the
+ system reboots. This switch is not currently available.
+
+ RB_KDB Load the symbol table and enable a built-in debugger in the
+ system. This option will have no useful function if the
+ kernel is not configured for debugging. Several other
+ options have different meaning if combined with this
+ option, although their use may not be possible via the
+ r\bre\beb\bbo\boo\bot\bt() call. See ddb(4) for more information.
+
+ RB_NOSYNC Normally, the disks are sync'd (see sync(8)) before the
+ processor is halted or rebooted. This option may be useful
+ if file system changes have been made manually or if the
+ processor is on fire.
+
+ RB_RDONLY Initially mount the root file system read-only. This is
+ currently the default, and this option has been deprecated.
+
+ RB_SINGLE Normally, the reboot procedure involves an automatic disk
+ consistency check and then multi-user operations.
+ RB_SINGLE prevents this, booting the system with a single-
+ user shell on the console. RB_SINGLE is actually
+ interpreted by the init(8) program in the newly booted
+ system.
+
+ When no options are given (i.e., RB_AUTOBOOT is used), the
+ system is rebooted from file _\b/_\bb_\bs_\bd in the root file system
+ of unit 0 of a disk chosen in a processor specific way. An
+ automatic consistency check of the disks is normally
+ performed (see fsck(8)).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, this call never returns. Otherwise, a -1 is returned and
+ an error is returned in the global variable _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The caller is not the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ddb(4), crash(8), halt(8), init(8), reboot(8), savecore(8), boot(9),
+ panic(9)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\beb\bbo\boo\bot\bt() system call finally appeared in 4.0BSD.
+
+B\bBU\bUG\bGS\bS
+ Not all platforms support all possible arguments.
+
+N\bNA\bAM\bME\bE
+ r\bre\bec\bcv\bv, r\bre\bec\bcv\bvf\bfr\bro\bom\bm, r\bre\bec\bcv\bvm\bms\bsg\bg - receive a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bv(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bf_\br_\bo_\bm,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bf_\br_\bo_\bm_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm() and r\bre\bec\bcv\bvm\bms\bsg\bg() are used to receive messages from a socket, _\bs,
+ and may be used to receive data on a socket whether or not it is
+ connection-oriented.
+
+ If _\bf_\br_\bo_\bm is non-null and the socket is not connection-oriented, the source
+ address of the message is filled in. _\bf_\br_\bo_\bm_\bl_\be_\bn is a value-result
+ parameter, initialized to the size of the buffer associated with _\bf_\br_\bo_\bm,
+ and modified on return to indicate the actual size of the address stored
+ there.
+
+ The r\bre\bec\bcv\bv() call is normally used only on a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd socket (see
+ connect(2)) and is identical to r\bre\bec\bcv\bvf\bfr\bro\bom\bm() with a null _\bf_\br_\bo_\bm parameter.
+ As it is redundant, it may not be supported in future releases.
+
+ On successful completion, all three routines return the number of message
+ bytes read. If a message is too long to fit in the supplied buffer,
+ excess bytes may be discarded depending on the type of socket the message
+ is received from (see socket(2)).
+
+ If no messages are available at the socket, the receive call waits for a
+ message to arrive, unless the socket is nonblocking (see fcntl(2)) in
+ which case the value -1 is returned and the external variable _\be_\br_\br_\bn_\bo set
+ to EAGAIN. The receive calls normally return any data available, up to
+ the requested amount, rather than waiting for receipt of the full amount
+ requested; this behavior is affected by the socket-level options
+ SO_RCVLOWAT and SO_RCVTIMEO described in getsockopt(2).
+
+ The select(2) or poll(2) system calls may be used to determine when more
+ data arrive.
+
+ The _\bf_\bl_\ba_\bg_\bs argument is the bitwise OR of zero or more of the following
+ values:
+
+ MSG_OOB process out-of-band data
+ MSG_PEEK peek at incoming message
+ MSG_WAITALL wait for full request or error
+ MSG_DONTWAIT don't block
+ MSG_CMSG_CLOEXEC set the close-on-exec flag on received file
+ descriptors
+
+ The MSG_OOB flag requests receipt of out-of-band data that would not be
+ received in the normal data stream. Some protocols place expedited data
+ at the head of the normal data queue, and thus this flag cannot be used
+ with such protocols. The MSG_PEEK flag causes the receive operation to
+ return data from the beginning of the receive queue without removing that
+ data from the queue. Thus, a subsequent receive call will return the
+ same data. The MSG_WAITALL flag requests that the operation block until
+ the full request is satisfied. However, the call may still return less
+ data than requested if a signal is caught, an error or disconnect occurs,
+ or the next data to be received is of a different type than that
+ returned. The MSG_DONTWAIT flag requests the call to return when it
+ would block otherwise. If no data is available, _\be_\br_\br_\bn_\bo is set to EAGAIN.
+ This flag is not available in strict ANSI or C99 compilation mode. The
+ MSG_CMSG_CLOEXEC requests that any file descriptors received as ancillary
+ data with r\bre\bec\bcv\bvm\bms\bsg\bg() (see below) have their close-on-exec flag set.
+
+ The r\bre\bec\bcv\bvm\bms\bsg\bg() call uses a _\bm_\bs_\bg_\bh_\bd_\br structure to minimize the number of
+ directly supplied parameters. This structure has the following form, as
+ defined in <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>:
+
+ struct msghdr {
+ void *msg_name; /* optional address */
+ socklen_t msg_namelen; /* size of address */
+ struct iovec *msg_iov; /* scatter/gather array */
+ unsigned int msg_iovlen; /* # elements in msg_iov */
+ void *msg_control; /* ancillary data, see below */
+ socklen_t msg_controllen; /* ancillary data buffer len */
+ int msg_flags; /* flags on received message */
+ };
+
+ Here _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be and _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be_\bl_\be_\bn specify the source address if the socket is
+ unconnected; _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be may be given as a null pointer if no names are
+ desired or required. _\bm_\bs_\bg_\b__\bi_\bo_\bv and _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn describe scatter gather
+ locations, as discussed in read(2). _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl, which has length
+ _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl_\bl_\be_\bn, points to a buffer for other protocol control related
+ messages or other miscellaneous ancillary data. The messages are of the
+ form:
+
+ struct cmsghdr {
+ socklen_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+ /* followed by u_char cmsg_data[]; */
+ };
+
+ See CMSG_DATA(3) for how these messages are constructed and decomposed.
+
+ Open file descriptors are now passed as ancillary data for AF_UNIX domain
+ and socketpair(2) sockets, with _\bc_\bm_\bs_\bg_\b__\bl_\be_\bv_\be_\bl set to SOL_SOCKET and
+ _\bc_\bm_\bs_\bg_\b__\bt_\by_\bp_\be set to SCM_RIGHTS.
+
+ The _\bm_\bs_\bg_\b__\bf_\bl_\ba_\bg_\bs field is set on return according to the message received.
+ It will contain zero or more of the following values:
+
+ MSG_OOB Returned to indicate that expedited or out-of-band data
+ was received.
+ MSG_EOR Indicates end-of-record; the data returned completed a
+ record (generally used with sockets of type
+ SOCK_SEQPACKET).
+ MSG_TRUNC Indicates that the trailing portion of a datagram was
+ discarded because the datagram was larger than the
+ buffer supplied.
+ MSG_CTRUNC Indicates that some control data were discarded due to
+ lack of space in the buffer for ancillary data.
+ MSG_BCAST Indicates that the packet was received as broadcast.
+ MSG_MCAST Indicates that the packet was received as multicast.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ These calls return the number of bytes received, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() fail if:
+
+ [EBADF] The argument _\bs is an invalid descriptor.
+
+ [ENOTCONN] The socket is associated with a connection-oriented
+ protocol and has not been connected (see connect(2) and
+ accept(2)).
+
+ [ENOTSOCK] The argument _\bs does not refer to a socket.
+
+ [EAGAIN] The socket is marked non-blocking, and the receive
+ operation would block, or a receive timeout had been set,
+ and the timeout expired before data were received.
+
+ [EINTR] The receive was interrupted by delivery of a signal
+ before any data were available.
+
+ [EFAULT] The receive buffer pointer(s) point outside the process's
+ address space.
+
+ [EHOSTUNREACH] A socket operation was attempted to an unreachable host.
+
+ [EHOSTDOWN] A socket operation failed because the destination host
+ was down.
+
+ [ENETDOWN] A socket operation encountered a dead network.
+
+ [ECONNREFUSED] The socket is associated with a connection-oriented
+ protocol and the connection was forcefully rejected (see
+ connect(2)).
+
+ In addition, r\bre\bec\bcv\bv() and r\bre\bec\bcv\bvf\bfr\bro\bom\bm() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ And r\bre\bec\bcv\bvm\bms\bsg\bg() may return one of the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMSGSIZE] The receiving program did not have sufficient free
+ file descriptor slots. The descriptors are closed and
+ any pending data can be returned by another call to
+ r\bre\bec\bcv\bvm\bms\bsg\bg().
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), fcntl(2), getsockopt(2), poll(2), read(2), select(2),
+ socket(2), socketpair(2), CMSG_DATA(3), sockatmark(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT, MSG_BCAST, and MSG_MCAST
+ flags are extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bec\bcv\bv() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ r\bre\bec\bcv\bv, r\bre\bec\bcv\bvf\bfr\bro\bom\bm, r\bre\bec\bcv\bvm\bms\bsg\bg - receive a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bv(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bf_\br_\bo_\bm,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bf_\br_\bo_\bm_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm() and r\bre\bec\bcv\bvm\bms\bsg\bg() are used to receive messages from a socket, _\bs,
+ and may be used to receive data on a socket whether or not it is
+ connection-oriented.
+
+ If _\bf_\br_\bo_\bm is non-null and the socket is not connection-oriented, the source
+ address of the message is filled in. _\bf_\br_\bo_\bm_\bl_\be_\bn is a value-result
+ parameter, initialized to the size of the buffer associated with _\bf_\br_\bo_\bm,
+ and modified on return to indicate the actual size of the address stored
+ there.
+
+ The r\bre\bec\bcv\bv() call is normally used only on a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd socket (see
+ connect(2)) and is identical to r\bre\bec\bcv\bvf\bfr\bro\bom\bm() with a null _\bf_\br_\bo_\bm parameter.
+ As it is redundant, it may not be supported in future releases.
+
+ On successful completion, all three routines return the number of message
+ bytes read. If a message is too long to fit in the supplied buffer,
+ excess bytes may be discarded depending on the type of socket the message
+ is received from (see socket(2)).
+
+ If no messages are available at the socket, the receive call waits for a
+ message to arrive, unless the socket is nonblocking (see fcntl(2)) in
+ which case the value -1 is returned and the external variable _\be_\br_\br_\bn_\bo set
+ to EAGAIN. The receive calls normally return any data available, up to
+ the requested amount, rather than waiting for receipt of the full amount
+ requested; this behavior is affected by the socket-level options
+ SO_RCVLOWAT and SO_RCVTIMEO described in getsockopt(2).
+
+ The select(2) or poll(2) system calls may be used to determine when more
+ data arrive.
+
+ The _\bf_\bl_\ba_\bg_\bs argument is the bitwise OR of zero or more of the following
+ values:
+
+ MSG_OOB process out-of-band data
+ MSG_PEEK peek at incoming message
+ MSG_WAITALL wait for full request or error
+ MSG_DONTWAIT don't block
+ MSG_CMSG_CLOEXEC set the close-on-exec flag on received file
+ descriptors
+
+ The MSG_OOB flag requests receipt of out-of-band data that would not be
+ received in the normal data stream. Some protocols place expedited data
+ at the head of the normal data queue, and thus this flag cannot be used
+ with such protocols. The MSG_PEEK flag causes the receive operation to
+ return data from the beginning of the receive queue without removing that
+ data from the queue. Thus, a subsequent receive call will return the
+ same data. The MSG_WAITALL flag requests that the operation block until
+ the full request is satisfied. However, the call may still return less
+ data than requested if a signal is caught, an error or disconnect occurs,
+ or the next data to be received is of a different type than that
+ returned. The MSG_DONTWAIT flag requests the call to return when it
+ would block otherwise. If no data is available, _\be_\br_\br_\bn_\bo is set to EAGAIN.
+ This flag is not available in strict ANSI or C99 compilation mode. The
+ MSG_CMSG_CLOEXEC requests that any file descriptors received as ancillary
+ data with r\bre\bec\bcv\bvm\bms\bsg\bg() (see below) have their close-on-exec flag set.
+
+ The r\bre\bec\bcv\bvm\bms\bsg\bg() call uses a _\bm_\bs_\bg_\bh_\bd_\br structure to minimize the number of
+ directly supplied parameters. This structure has the following form, as
+ defined in <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>:
+
+ struct msghdr {
+ void *msg_name; /* optional address */
+ socklen_t msg_namelen; /* size of address */
+ struct iovec *msg_iov; /* scatter/gather array */
+ unsigned int msg_iovlen; /* # elements in msg_iov */
+ void *msg_control; /* ancillary data, see below */
+ socklen_t msg_controllen; /* ancillary data buffer len */
+ int msg_flags; /* flags on received message */
+ };
+
+ Here _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be and _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be_\bl_\be_\bn specify the source address if the socket is
+ unconnected; _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be may be given as a null pointer if no names are
+ desired or required. _\bm_\bs_\bg_\b__\bi_\bo_\bv and _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn describe scatter gather
+ locations, as discussed in read(2). _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl, which has length
+ _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl_\bl_\be_\bn, points to a buffer for other protocol control related
+ messages or other miscellaneous ancillary data. The messages are of the
+ form:
+
+ struct cmsghdr {
+ socklen_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+ /* followed by u_char cmsg_data[]; */
+ };
+
+ See CMSG_DATA(3) for how these messages are constructed and decomposed.
+
+ Open file descriptors are now passed as ancillary data for AF_UNIX domain
+ and socketpair(2) sockets, with _\bc_\bm_\bs_\bg_\b__\bl_\be_\bv_\be_\bl set to SOL_SOCKET and
+ _\bc_\bm_\bs_\bg_\b__\bt_\by_\bp_\be set to SCM_RIGHTS.
+
+ The _\bm_\bs_\bg_\b__\bf_\bl_\ba_\bg_\bs field is set on return according to the message received.
+ It will contain zero or more of the following values:
+
+ MSG_OOB Returned to indicate that expedited or out-of-band data
+ was received.
+ MSG_EOR Indicates end-of-record; the data returned completed a
+ record (generally used with sockets of type
+ SOCK_SEQPACKET).
+ MSG_TRUNC Indicates that the trailing portion of a datagram was
+ discarded because the datagram was larger than the
+ buffer supplied.
+ MSG_CTRUNC Indicates that some control data were discarded due to
+ lack of space in the buffer for ancillary data.
+ MSG_BCAST Indicates that the packet was received as broadcast.
+ MSG_MCAST Indicates that the packet was received as multicast.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ These calls return the number of bytes received, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() fail if:
+
+ [EBADF] The argument _\bs is an invalid descriptor.
+
+ [ENOTCONN] The socket is associated with a connection-oriented
+ protocol and has not been connected (see connect(2) and
+ accept(2)).
+
+ [ENOTSOCK] The argument _\bs does not refer to a socket.
+
+ [EAGAIN] The socket is marked non-blocking, and the receive
+ operation would block, or a receive timeout had been set,
+ and the timeout expired before data were received.
+
+ [EINTR] The receive was interrupted by delivery of a signal
+ before any data were available.
+
+ [EFAULT] The receive buffer pointer(s) point outside the process's
+ address space.
+
+ [EHOSTUNREACH] A socket operation was attempted to an unreachable host.
+
+ [EHOSTDOWN] A socket operation failed because the destination host
+ was down.
+
+ [ENETDOWN] A socket operation encountered a dead network.
+
+ [ECONNREFUSED] The socket is associated with a connection-oriented
+ protocol and the connection was forcefully rejected (see
+ connect(2)).
+
+ In addition, r\bre\bec\bcv\bv() and r\bre\bec\bcv\bvf\bfr\bro\bom\bm() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ And r\bre\bec\bcv\bvm\bms\bsg\bg() may return one of the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMSGSIZE] The receiving program did not have sufficient free
+ file descriptor slots. The descriptors are closed and
+ any pending data can be returned by another call to
+ r\bre\bec\bcv\bvm\bms\bsg\bg().
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), fcntl(2), getsockopt(2), poll(2), read(2), select(2),
+ socket(2), socketpair(2), CMSG_DATA(3), sockatmark(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT, MSG_BCAST, and MSG_MCAST
+ flags are extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bec\bcv\bv() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ r\bre\bec\bcv\bv, r\bre\bec\bcv\bvf\bfr\bro\bom\bm, r\bre\bec\bcv\bvm\bms\bsg\bg - receive a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bv(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm(_\bi_\bn_\bt _\bs, _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bf_\br_\bo_\bm,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bf_\br_\bo_\bm_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ r\bre\bec\bcv\bvm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\bre\bec\bcv\bvf\bfr\bro\bom\bm() and r\bre\bec\bcv\bvm\bms\bsg\bg() are used to receive messages from a socket, _\bs,
+ and may be used to receive data on a socket whether or not it is
+ connection-oriented.
+
+ If _\bf_\br_\bo_\bm is non-null and the socket is not connection-oriented, the source
+ address of the message is filled in. _\bf_\br_\bo_\bm_\bl_\be_\bn is a value-result
+ parameter, initialized to the size of the buffer associated with _\bf_\br_\bo_\bm,
+ and modified on return to indicate the actual size of the address stored
+ there.
+
+ The r\bre\bec\bcv\bv() call is normally used only on a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd socket (see
+ connect(2)) and is identical to r\bre\bec\bcv\bvf\bfr\bro\bom\bm() with a null _\bf_\br_\bo_\bm parameter.
+ As it is redundant, it may not be supported in future releases.
+
+ On successful completion, all three routines return the number of message
+ bytes read. If a message is too long to fit in the supplied buffer,
+ excess bytes may be discarded depending on the type of socket the message
+ is received from (see socket(2)).
+
+ If no messages are available at the socket, the receive call waits for a
+ message to arrive, unless the socket is nonblocking (see fcntl(2)) in
+ which case the value -1 is returned and the external variable _\be_\br_\br_\bn_\bo set
+ to EAGAIN. The receive calls normally return any data available, up to
+ the requested amount, rather than waiting for receipt of the full amount
+ requested; this behavior is affected by the socket-level options
+ SO_RCVLOWAT and SO_RCVTIMEO described in getsockopt(2).
+
+ The select(2) or poll(2) system calls may be used to determine when more
+ data arrive.
+
+ The _\bf_\bl_\ba_\bg_\bs argument is the bitwise OR of zero or more of the following
+ values:
+
+ MSG_OOB process out-of-band data
+ MSG_PEEK peek at incoming message
+ MSG_WAITALL wait for full request or error
+ MSG_DONTWAIT don't block
+ MSG_CMSG_CLOEXEC set the close-on-exec flag on received file
+ descriptors
+
+ The MSG_OOB flag requests receipt of out-of-band data that would not be
+ received in the normal data stream. Some protocols place expedited data
+ at the head of the normal data queue, and thus this flag cannot be used
+ with such protocols. The MSG_PEEK flag causes the receive operation to
+ return data from the beginning of the receive queue without removing that
+ data from the queue. Thus, a subsequent receive call will return the
+ same data. The MSG_WAITALL flag requests that the operation block until
+ the full request is satisfied. However, the call may still return less
+ data than requested if a signal is caught, an error or disconnect occurs,
+ or the next data to be received is of a different type than that
+ returned. The MSG_DONTWAIT flag requests the call to return when it
+ would block otherwise. If no data is available, _\be_\br_\br_\bn_\bo is set to EAGAIN.
+ This flag is not available in strict ANSI or C99 compilation mode. The
+ MSG_CMSG_CLOEXEC requests that any file descriptors received as ancillary
+ data with r\bre\bec\bcv\bvm\bms\bsg\bg() (see below) have their close-on-exec flag set.
+
+ The r\bre\bec\bcv\bvm\bms\bsg\bg() call uses a _\bm_\bs_\bg_\bh_\bd_\br structure to minimize the number of
+ directly supplied parameters. This structure has the following form, as
+ defined in <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>:
+
+ struct msghdr {
+ void *msg_name; /* optional address */
+ socklen_t msg_namelen; /* size of address */
+ struct iovec *msg_iov; /* scatter/gather array */
+ unsigned int msg_iovlen; /* # elements in msg_iov */
+ void *msg_control; /* ancillary data, see below */
+ socklen_t msg_controllen; /* ancillary data buffer len */
+ int msg_flags; /* flags on received message */
+ };
+
+ Here _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be and _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be_\bl_\be_\bn specify the source address if the socket is
+ unconnected; _\bm_\bs_\bg_\b__\bn_\ba_\bm_\be may be given as a null pointer if no names are
+ desired or required. _\bm_\bs_\bg_\b__\bi_\bo_\bv and _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn describe scatter gather
+ locations, as discussed in read(2). _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl, which has length
+ _\bm_\bs_\bg_\b__\bc_\bo_\bn_\bt_\br_\bo_\bl_\bl_\be_\bn, points to a buffer for other protocol control related
+ messages or other miscellaneous ancillary data. The messages are of the
+ form:
+
+ struct cmsghdr {
+ socklen_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+ /* followed by u_char cmsg_data[]; */
+ };
+
+ See CMSG_DATA(3) for how these messages are constructed and decomposed.
+
+ Open file descriptors are now passed as ancillary data for AF_UNIX domain
+ and socketpair(2) sockets, with _\bc_\bm_\bs_\bg_\b__\bl_\be_\bv_\be_\bl set to SOL_SOCKET and
+ _\bc_\bm_\bs_\bg_\b__\bt_\by_\bp_\be set to SCM_RIGHTS.
+
+ The _\bm_\bs_\bg_\b__\bf_\bl_\ba_\bg_\bs field is set on return according to the message received.
+ It will contain zero or more of the following values:
+
+ MSG_OOB Returned to indicate that expedited or out-of-band data
+ was received.
+ MSG_EOR Indicates end-of-record; the data returned completed a
+ record (generally used with sockets of type
+ SOCK_SEQPACKET).
+ MSG_TRUNC Indicates that the trailing portion of a datagram was
+ discarded because the datagram was larger than the
+ buffer supplied.
+ MSG_CTRUNC Indicates that some control data were discarded due to
+ lack of space in the buffer for ancillary data.
+ MSG_BCAST Indicates that the packet was received as broadcast.
+ MSG_MCAST Indicates that the packet was received as multicast.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ These calls return the number of bytes received, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() fail if:
+
+ [EBADF] The argument _\bs is an invalid descriptor.
+
+ [ENOTCONN] The socket is associated with a connection-oriented
+ protocol and has not been connected (see connect(2) and
+ accept(2)).
+
+ [ENOTSOCK] The argument _\bs does not refer to a socket.
+
+ [EAGAIN] The socket is marked non-blocking, and the receive
+ operation would block, or a receive timeout had been set,
+ and the timeout expired before data were received.
+
+ [EINTR] The receive was interrupted by delivery of a signal
+ before any data were available.
+
+ [EFAULT] The receive buffer pointer(s) point outside the process's
+ address space.
+
+ [EHOSTUNREACH] A socket operation was attempted to an unreachable host.
+
+ [EHOSTDOWN] A socket operation failed because the destination host
+ was down.
+
+ [ENETDOWN] A socket operation encountered a dead network.
+
+ [ECONNREFUSED] The socket is associated with a connection-oriented
+ protocol and the connection was forcefully rejected (see
+ connect(2)).
+
+ In addition, r\bre\bec\bcv\bv() and r\bre\bec\bcv\bvf\bfr\bro\bom\bm() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ And r\bre\bec\bcv\bvm\bms\bsg\bg() may return one of the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMSGSIZE] The receiving program did not have sufficient free
+ file descriptor slots. The descriptors are closed and
+ any pending data can be returned by another call to
+ r\bre\bec\bcv\bvm\bms\bsg\bg().
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), fcntl(2), getsockopt(2), poll(2), read(2), select(2),
+ socket(2), socketpair(2), CMSG_DATA(3), sockatmark(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), and r\bre\bec\bcv\bvm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT, MSG_BCAST, and MSG_MCAST
+ flags are extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bec\bcv\bv() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ r\bre\ben\bna\bam\bme\be, r\bre\ben\bna\bam\bme\bea\bat\bt - change the name of a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\ben\bna\bam\bme\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\br_\bo_\bm, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\bo);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\ben\bna\bam\bme\bea\bat\bt(_\bi_\bn_\bt _\bf_\br_\bo_\bm_\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\br_\bo_\bm, _\bi_\bn_\bt _\bt_\bo_\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\bo);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The r\bre\ben\bna\bam\bme\be() function causes the link named _\bf_\br_\bo_\bm to be renamed as _\bt_\bo. If
+ _\bt_\bo exists, it is first removed. Both _\bf_\br_\bo_\bm and _\bt_\bo must be of the same
+ type (that is, both directories or both non-directories), and must reside
+ on the same file system.
+
+ r\bre\ben\bna\bam\bme\be() guarantees that if _\bt_\bo already exists, an instance of _\bt_\bo will
+ always exist, even if the system should crash in the middle of the
+ operation.
+
+ If the final component of _\bf_\br_\bo_\bm is a symbolic link, the symbolic link is
+ renamed, not the file or directory to which it points.
+
+ The r\bre\ben\bna\bam\bme\bea\bat\bt() function is equivalent to r\bre\ben\bna\bam\bme\be() except that where _\bf_\br_\bo_\bm
+ or _\bt_\bo specifies a relative path, the directory entry names used are
+ resolved relative to the directories associated with file descriptors
+ _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd (respectively) instead of the current working directory.
+
+ If r\bre\ben\bna\bam\bme\bea\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd parameter, the current working directory is used
+ for resolving the respective _\bf_\br_\bo_\bm or _\bt_\bo argument.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\ben\bna\bam\bme\be() and r\bre\ben\bna\bam\bme\bea\bat\bt() will fail and neither of the argument files will
+ be affected if:
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the _\bf_\br_\bo_\bm path does not exist, or a path
+ prefix of _\bt_\bo does not exist.
+
+ [EACCES] A component of either path prefix denies search
+ permission.
+
+ [EACCES] The requested change requires writing in a directory
+ that denies write permission.
+
+ [EACCES] The _\bf_\br_\bo_\bm argument is a directory and denies write
+ permission.
+
+ [EPERM] The directory containing _\bf_\br_\bo_\bm is marked sticky, and
+ neither the containing directory nor _\bf_\br_\bo_\bm are owned by
+ the effective user ID.
+
+ [EPERM] The _\bt_\bo file exists, the directory containing _\bt_\bo is
+ marked sticky, and neither the containing directory
+ nor _\bt_\bo are owned by the effective user ID.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating either pathname.
+
+ [EMLINK] The link count on the source file or destination
+ directory is at the maximum. A rename cannot be
+ completed under these conditions.
+
+ [ENOTDIR] A component of either path prefix is not a directory.
+
+ [ENOTDIR] _\bf_\br_\bo_\bm is a directory, but _\bt_\bo is not a directory.
+
+ [EISDIR] _\bt_\bo is a directory, but _\bf_\br_\bo_\bm is not a directory.
+
+ [EXDEV] The link named by _\bt_\bo and the file named by _\bf_\br_\bo_\bm are on
+ different logical devices (file systems). Note that
+ this error code will not be returned if the
+ implementation permits cross-device links.
+
+ [ENOSPC] The directory in which the entry for the new name is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [EDQUOT] The directory in which the entry for the new name is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EIO] An I/O error occurred while making or updating a
+ directory entry.
+
+ [EROFS] The requested link requires writing in a directory on
+ a read-only file system.
+
+ [EFAULT] _\bf_\br_\bo_\bm or _\bt_\bo points outside the process's allocated
+ address space.
+
+ [EINVAL] _\bf_\br_\bo_\bm is a parent directory of _\bt_\bo, or an attempt is
+ made to rename `.' or `..'.
+
+ [ENOTEMPTY] _\bt_\bo is a directory and is not empty.
+
+ Additionally, r\bre\ben\bna\bam\bme\bea\bat\bt() will fail if:
+
+ [EBADF] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path and
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd argument, respectively, is neither
+ AT_FDCWD nor a valid file descriptor.
+
+ [ENOTDIR] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path and
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd argument, respectively, is a valid
+ file descriptor but it does not reference a directory.
+
+ [EACCES] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path but
+ search permission is denied for the directory which
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd file descriptor, respectively,
+ references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mv(1), open(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\ben\bna\bam\bme\be() and r\bre\ben\bna\bam\bme\bea\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\ben\bna\bam\bme\bea\bat\bt() function appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The system can deadlock if a loop in the file system graph is present.
+ This loop takes the form of an entry in directory `_\ba', say `_\ba_\b/_\bf_\bo_\bo', being
+ a hard link to directory `_\bb', and an entry in directory `_\bb', say `_\bb_\b/_\bb_\ba_\br',
+ being a hard link to directory `_\ba'. When such a loop exists and two
+ separate processes attempt to perform `rename a/foo b/bar' and `rename
+ b/bar a/foo', respectively, the system may deadlock attempting to lock
+ both directories for modification. Hard links to directories should be
+ replaced by symbolic links by the system administrator.
+
+N\bNA\bAM\bME\bE
+ r\bre\ben\bna\bam\bme\be, r\bre\ben\bna\bam\bme\bea\bat\bt - change the name of a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\ben\bna\bam\bme\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\br_\bo_\bm, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\bo);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\ben\bna\bam\bme\bea\bat\bt(_\bi_\bn_\bt _\bf_\br_\bo_\bm_\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\br_\bo_\bm, _\bi_\bn_\bt _\bt_\bo_\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\bo);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The r\bre\ben\bna\bam\bme\be() function causes the link named _\bf_\br_\bo_\bm to be renamed as _\bt_\bo. If
+ _\bt_\bo exists, it is first removed. Both _\bf_\br_\bo_\bm and _\bt_\bo must be of the same
+ type (that is, both directories or both non-directories), and must reside
+ on the same file system.
+
+ r\bre\ben\bna\bam\bme\be() guarantees that if _\bt_\bo already exists, an instance of _\bt_\bo will
+ always exist, even if the system should crash in the middle of the
+ operation.
+
+ If the final component of _\bf_\br_\bo_\bm is a symbolic link, the symbolic link is
+ renamed, not the file or directory to which it points.
+
+ The r\bre\ben\bna\bam\bme\bea\bat\bt() function is equivalent to r\bre\ben\bna\bam\bme\be() except that where _\bf_\br_\bo_\bm
+ or _\bt_\bo specifies a relative path, the directory entry names used are
+ resolved relative to the directories associated with file descriptors
+ _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd (respectively) instead of the current working directory.
+
+ If r\bre\ben\bna\bam\bme\bea\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd parameter, the current working directory is used
+ for resolving the respective _\bf_\br_\bo_\bm or _\bt_\bo argument.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ r\bre\ben\bna\bam\bme\be() and r\bre\ben\bna\bam\bme\bea\bat\bt() will fail and neither of the argument files will
+ be affected if:
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of the _\bf_\br_\bo_\bm path does not exist, or a path
+ prefix of _\bt_\bo does not exist.
+
+ [EACCES] A component of either path prefix denies search
+ permission.
+
+ [EACCES] The requested change requires writing in a directory
+ that denies write permission.
+
+ [EACCES] The _\bf_\br_\bo_\bm argument is a directory and denies write
+ permission.
+
+ [EPERM] The directory containing _\bf_\br_\bo_\bm is marked sticky, and
+ neither the containing directory nor _\bf_\br_\bo_\bm are owned by
+ the effective user ID.
+
+ [EPERM] The _\bt_\bo file exists, the directory containing _\bt_\bo is
+ marked sticky, and neither the containing directory
+ nor _\bt_\bo are owned by the effective user ID.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating either pathname.
+
+ [EMLINK] The link count on the source file or destination
+ directory is at the maximum. A rename cannot be
+ completed under these conditions.
+
+ [ENOTDIR] A component of either path prefix is not a directory.
+
+ [ENOTDIR] _\bf_\br_\bo_\bm is a directory, but _\bt_\bo is not a directory.
+
+ [EISDIR] _\bt_\bo is a directory, but _\bf_\br_\bo_\bm is not a directory.
+
+ [EXDEV] The link named by _\bt_\bo and the file named by _\bf_\br_\bo_\bm are on
+ different logical devices (file systems). Note that
+ this error code will not be returned if the
+ implementation permits cross-device links.
+
+ [ENOSPC] The directory in which the entry for the new name is
+ being placed cannot be extended because there is no
+ space left on the file system containing the
+ directory.
+
+ [EDQUOT] The directory in which the entry for the new name is
+ being placed cannot be extended because the user's
+ quota of disk blocks on the file system containing the
+ directory has been exhausted.
+
+ [EIO] An I/O error occurred while making or updating a
+ directory entry.
+
+ [EROFS] The requested link requires writing in a directory on
+ a read-only file system.
+
+ [EFAULT] _\bf_\br_\bo_\bm or _\bt_\bo points outside the process's allocated
+ address space.
+
+ [EINVAL] _\bf_\br_\bo_\bm is a parent directory of _\bt_\bo, or an attempt is
+ made to rename `.' or `..'.
+
+ [ENOTEMPTY] _\bt_\bo is a directory and is not empty.
+
+ Additionally, r\bre\ben\bna\bam\bme\bea\bat\bt() will fail if:
+
+ [EBADF] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path and
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd argument, respectively, is neither
+ AT_FDCWD nor a valid file descriptor.
+
+ [ENOTDIR] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path and
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd argument, respectively, is a valid
+ file descriptor but it does not reference a directory.
+
+ [EACCES] The _\bf_\br_\bo_\bm or _\bt_\bo argument specifies a relative path but
+ search permission is denied for the directory which
+ the _\bf_\br_\bo_\bm_\bf_\bd or _\bt_\bo_\bf_\bd file descriptor, respectively,
+ references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ mv(1), open(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The r\bre\ben\bna\bam\bme\be() and r\bre\ben\bna\bam\bme\bea\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\ben\bna\bam\bme\bea\bat\bt() function appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The system can deadlock if a loop in the file system graph is present.
+ This loop takes the form of an entry in directory `_\ba', say `_\ba_\b/_\bf_\bo_\bo', being
+ a hard link to directory `_\bb', and an entry in directory `_\bb', say `_\bb_\b/_\bb_\ba_\br',
+ being a hard link to directory `_\ba'. When such a loop exists and two
+ separate processes attempt to perform `rename a/foo b/bar' and `rename
+ b/bar a/foo', respectively, the system may deadlock attempting to lock
+ both directories for modification. Hard links to directories should be
+ replaced by symbolic links by the system administrator.
+
+N\bNA\bAM\bME\bE
+ r\bre\bev\bvo\bok\bke\be - revoke file access
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\bre\bev\bvo\bok\bke\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The r\bre\bev\bvo\bok\bke\be function invalidates all current open file descriptors in the
+ system for the file named by _\bp_\ba_\bt_\bh. Subsequent operations on any such
+ descriptors fail, with the exceptions that a r\bre\bea\bad\bd() from a character
+ device file which has been revoked returns a count of zero (end of file),
+ and a c\bcl\blo\bos\bse\be() call will succeed. If the file is a special file for a
+ device which is open, the device close function is called as if all open
+ references to the file had been closed.
+
+ Access to a file may be revoked only by its owner or the superuser. The
+ r\bre\bev\bvo\bok\bke\be function is normally used to prepare a terminal device for a new
+ login session, preventing any access by a previous user of the terminal.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ Access to the named file is revoked unless one of the following:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file or a component of the path name does
+ not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ [EPERM] The caller is neither the owner of the file nor the
+ superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ close(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\bre\bev\bvo\bok\bke\be function was introduced in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ r\brm\bmd\bdi\bir\br - remove a directory file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ r\brm\bmd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ r\brm\bmd\bdi\bir\br() removes a directory file whose name is given by _\bp_\ba_\bt_\bh. The
+ directory must not have any entries other than `.' and `..'.
+
+ There is no r\brm\bmd\bdi\bir\bra\bat\bt() function; to remove a directory with a path
+ relative to the directory associated with a file descriptor use the
+ unlinkat(2) function with the AT_REMOVEDIR flag.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The named file is removed unless:
+
+ [ENOTDIR] A component of the path is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named directory does not exist.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [ENOTEMPTY] The named directory contains files other than `.' and
+ `..' in it.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] Write permission is denied on the directory containing
+ the directory to be removed.
+
+ [EPERM] The directory containing the directory to be removed
+ is marked sticky, and neither the containing directory
+ nor the directory to be removed are owned by the
+ effective user ID.
+
+ [EPERM] The directory to be removed or the directory
+ containing it has its immutable or append-only flag
+ set (see chflags(2)).
+
+ [EBUSY] The directory to be removed is the mount point for a
+ mounted file system or the current directory.
+
+ [EIO] An I/O error occurred while deleting the directory
+ entry or deallocating the inode.
+
+ [EROFS] The directory entry to be removed resides on a read-
+ only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ rmdir(1), chflags(2), mkdir(2), unlink(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ r\brm\bmd\bdi\bir\br() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The r\brm\bmd\bdi\bir\br() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ b\bbr\brk\bk, s\bsb\bbr\brk\bk - change data segment size
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ b\bbr\brk\bk(_\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br);
+
+ _\bv_\bo_\bi_\bd _\b*
+ s\bsb\bbr\brk\bk(_\bi_\bn_\bt _\bi_\bn_\bc_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ T\bTh\bhe\be b\bbr\brk\bk(\b()\b) a\ban\bnd\bd s\bsb\bbr\brk\bk(\b()\b) f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs a\bar\bre\be h\bhi\bis\bst\bto\bor\bri\bic\bca\bal\bl c\bcu\bur\bri\bio\bos\bsi\bit\bti\bie\bes\bs l\ble\bef\bft\bt o\bov\bve\ber\br f\bfr\bro\bom\bm
+ e\bea\bar\brl\bli\bie\ber\br d\bda\bay\bys\bs b\bbe\bef\bfo\bor\bre\be t\bth\bhe\be a\bad\bdv\bve\ben\bnt\bt o\bof\bf v\bvi\bir\brt\btu\bua\bal\bl m\bme\bem\bmo\bor\bry\by m\bma\ban\bna\bag\bge\bem\bme\ben\bnt\bt.\b. The b\bbr\brk\bk()
+ function sets the break or lowest address of a process's data segment
+ (uninitialized data) to _\ba_\bd_\bd_\br (immediately above bss). Data addressing is
+ restricted between _\ba_\bd_\bd_\br and the lowest stack pointer to the stack
+ segment. Memory is allocated by b\bbr\brk\bk() in page size pieces; if _\ba_\bd_\bd_\br is
+ not evenly divisible by the system page size, it is increased to the next
+ page boundary.
+
+ The current value of the program break is reliably returned by
+ ``sbrk(0)'' (see also end(3)). The getrlimit(2) system call may be used
+ to determine the maximum permissible size of the _\bd_\ba_\bt_\ba segment; it will
+ not be possible to set the break beyond the _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx value returned from
+ a call to getrlimit(2), e.g., ``etext + rlp->rlim_max'' (see end(3) for
+ the definition of _\be_\bt_\be_\bx_\bt).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The b\bbr\brk\bk() function returns the value 0 if successful; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+ The s\bsb\bbr\brk\bk() function returns a pointer to the base of the new storage if
+ successful; otherwise -1 with _\be_\br_\br_\bn_\bo set to indicate why the allocation
+ failed.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsb\bbr\brk\bk() will fail and no additional memory will be allocated if one of the
+ following are true:
+
+ [ENOMEM] The limit, as set by setrlimit(2), was exceeded.
+
+ [ENOMEM] The maximum possible size of a data segment (compiled
+ into the system) was exceeded.
+
+ [ENOMEM] Insufficient space existed in the swap area to support
+ the expansion.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ execve(2), getrlimit(2), mmap(2), end(3), malloc(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A b\bbr\brk\bk() function call appeared in Version 7 AT&T UNIX.
+
+B\bBU\bUG\bGS\bS
+ Setting the break may fail due to a temporary lack of swap space. It is
+ not possible to distinguish this from a failure caused by exceeding the
+ maximum size of the data segment without consulting getrlimit(2).
+
+N\bNA\bAM\bME\bE
+ s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd - yield the processor
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsc\bch\bhe\bed\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd() function makes the current thread yield the processor
+ and be put at the end of its run queue without altering its priority.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd() function conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd() system call appeared in OpenBSD 4.2.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The effect of s\bsc\bch\bhe\bed\bd_\b_y\byi\bie\bel\bld\bd() is only precisely defined for real-time
+ scheduling classes, none of which are currently supported by OpenBSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bel\ble\bec\bct\bt, p\bps\bse\bel\ble\bec\bct\bt - synchronous I/O multiplexing
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bse\bel\ble\bec\bct\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bel\ble\bec\bct\bt(_\bi_\bn_\bt _\bn_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\br_\be_\ba_\bd_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt);
+
+ _\bi_\bn_\bt
+ p\bps\bse\bel\ble\bec\bct\bt(_\bi_\bn_\bt _\bn_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\br_\be_\ba_\bd_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, _\bf_\bd_\b__\bs_\be_\bt _\b*_\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\b*_\bt_\bi_\bm_\be_\bo_\bu_\bt, _\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bm_\ba_\bs_\bk);
+
+ F\bFD\bD_\b_S\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_C\bCL\bLR\bR(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_I\bIS\bSS\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt);
+
+ F\bFD\bD_\b_Z\bZE\bER\bRO\bO(_\b&_\bf_\bd_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bel\ble\bec\bct\bt() examines the I/O descriptor sets whose addresses are passed in
+ _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, and _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs to see if some of their descriptors are
+ ready for reading, are ready for writing, or have an exceptional
+ condition pending, respectively. The first _\bn_\bf_\bd_\bs descriptors are checked
+ in each set; i.e., the descriptors from 0 through _\bn_\bf_\bd_\bs-1 in the
+ descriptor sets are examined. On return, s\bse\bel\ble\bec\bct\bt() replaces the given
+ descriptor sets with subsets consisting of those descriptors that are
+ ready for the requested operation. s\bse\bel\ble\bec\bct\bt() returns the total number of
+ ready descriptors in all the sets.
+
+ The descriptor sets are stored as bit fields in arrays of integers. The
+ following macros are provided for manipulating such descriptor sets:
+ F\bFD\bD_\b_Z\bZE\bER\bRO\bO(_\b&_\bf_\bd_\bs_\be_\bt) initializes a descriptor set _\bf_\bd_\bs_\be_\bt to the null set.
+ F\bFD\bD_\b_S\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) includes a particular descriptor _\bf_\bd in _\bf_\bd_\bs_\be_\bt.
+ F\bFD\bD_\b_C\bCL\bLR\bR(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) removes _\bf_\bd from _\bf_\bd_\bs_\be_\bt. F\bFD\bD_\b_I\bIS\bSS\bSE\bET\bT(_\bf_\bd, _\b&_\bf_\bd_\bs_\be_\bt) is non-
+ zero if _\bf_\bd is a member of _\bf_\bd_\bs_\be_\bt, zero otherwise. The behavior of these
+ macros is undefined if a descriptor value is less than zero or greater
+ than or equal to FD_SETSIZE, which is normally at least equal to the
+ maximum number of descriptors supported by the system.
+
+ If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a non-null pointer, it specifies a maximum interval to wait
+ for the selection to complete. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is a null pointer, the select
+ blocks indefinitely. To effect a poll, the _\bt_\bi_\bm_\be_\bo_\bu_\bt argument should be
+ non-null, pointing to a zero-valued timeval structure. _\bt_\bi_\bm_\be_\bo_\bu_\bt is not
+ changed by s\bse\bel\ble\bec\bct\bt(), and may be reused on subsequent calls; however, it
+ is good style to re-initialize it before each invocation of s\bse\bel\ble\bec\bct\bt().
+
+ Any of _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, and _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs may be given as null pointers if
+ no descriptors are of interest.
+
+ The p\bps\bse\bel\ble\bec\bct\bt() function is similar to s\bse\bel\ble\bec\bct\bt() except that it specifies
+ the timeout using a timespec structure. Also, if _\bm_\ba_\bs_\bk is a non-null
+ pointer, p\bps\bse\bel\ble\bec\bct\bt() atomically sets the calling thread's signal mask to
+ the signal set pointed to by _\bm_\ba_\bs_\bk for the duration of the function call.
+ In this case, the original signal mask will be restored before p\bps\bse\bel\ble\bec\bct\bt()
+ returns.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, s\bse\bel\ble\bec\bct\bt() and p\bps\bse\bel\ble\bec\bct\bt() return the number of ready
+ descriptors that are contained in the descriptor sets. If a descriptor
+ is included in multiple descriptor sets, each inclusion is counted
+ separately. If the time limit expires before any descriptors become
+ ready, they return 0.
+
+ Otherwise, if s\bse\bel\ble\bec\bct\bt() or p\bps\bse\bel\ble\bec\bct\bt() return with an error, including one
+ due to an interrupted call, they return -1, and the descriptor sets will
+ be unmodified.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ An error return from s\bse\bel\ble\bec\bct\bt() or p\bps\bse\bel\ble\bec\bct\bt() indicates:
+
+ [EFAULT] One or more of _\br_\be_\ba_\bd_\bf_\bd_\bs, _\bw_\br_\bi_\bt_\be_\bf_\bd_\bs, or _\be_\bx_\bc_\be_\bp_\bt_\bf_\bd_\bs points
+ outside the process's allocated address space.
+
+ [EBADF] One of the descriptor sets specified an invalid
+ descriptor.
+
+ [EINTR] A signal was delivered before the time limit expired
+ and before any of the selected descriptors became
+ ready.
+
+ [EINVAL] The specified time limit is invalid. One of its
+ components is negative or too large.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), clock_gettime(2), connect(2), gettimeofday(2), poll(2),
+ read(2), recv(2), send(2), write(2), getdtablesize(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bel\ble\bec\bct\bt() system call first appeared in 4.1cBSD. The p\bps\bse\bel\ble\bec\bct\bt() system
+ call has been available since OpenBSD 5.4.
+
+B\bBU\bUG\bGS\bS
+ Although the provision of getdtablesize(3) was intended to allow user
+ programs to be written independent of the kernel limit on the number of
+ open files, the dimension of a sufficiently large bit field for select
+ remains a problem. The default bit size of _\bf_\bd_\b__\bs_\be_\bt is based on the symbol
+ FD_SETSIZE (currently 1024), but that is somewhat smaller than the
+ current kernel limit to the number of open files. However, in order to
+ accommodate programs which might potentially use a larger number of open
+ files with select, it is possible to increase this size within a program
+ by providing a larger definition of FD_SETSIZE before the inclusion of
+ any headers. The kernel will cope, and the userland libraries provided
+ with the system are also ready for large numbers of file descriptors.
+
+ Alternatively, to be really safe, it is possible to allocate _\bf_\bd_\b__\bs_\be_\bt bit-
+ arrays dynamically. The idea is to permit a program to work properly
+ even if it is execve(2)'d with 4000 file descriptors pre-allocated. The
+ following illustrates the technique which is used by userland libraries:
+
+ fd_set *fdsr;
+ int max = fd;
+
+ fdsr = calloc(howmany(max+1, NFDBITS), sizeof(fd_mask));
+ if (fdsr == NULL) {
+ ...
+ return (-1);
+ }
+ FD_SET(fd, fdsr);
+ n = select(max+1, fdsr, NULL, NULL, &tv);
+ ...
+ free(fdsr);
+
+ Alternatively, it is possible to use the poll(2) interface. poll(2) is
+ more efficient when the size of s\bse\bel\ble\bec\bct\bt()'s _\bf_\bd_\b__\bs_\be_\bt bit-arrays are very
+ large, and for fixed numbers of file descriptors one need not size and
+ dynamically allocate a memory object.
+
+ s\bse\bel\ble\bec\bct\bt() should probably have been designed to return the time remaining
+ from the original timeout, if any, by modifying the time value in place.
+ Even though some systems stupidly act in this different way, it is
+ unlikely this semantic will ever be commonly implemented, as the change
+ causes massive source code compatibility problems. Furthermore, recent
+ new standards have dictated the current behaviour. In general, due to
+ the existence of those brain-damaged non-conforming systems, it is unwise
+ to assume that the timeout value will be unmodified by the s\bse\bel\ble\bec\bct\bt() call,
+ and the caller should reinitialize it on each invocation. Calculating
+ the delta is easily done by calling gettimeofday(2) before and after the
+ call to s\bse\bel\ble\bec\bct\bt(), and using t\bti\bim\bme\ber\brs\bsu\bub\bb() (as described in getitimer(2)).
+
+ Internally to the kernel, s\bse\bel\ble\bec\bct\bt() and p\bps\bse\bel\ble\bec\bct\bt() work poorly if multiple
+ processes wait on the same file descriptor. Given that, it is rather
+ surprising to see that many daemons are written that way.
+
+N\bNA\bAM\bME\bE
+ s\bse\bem\bmc\bct\btl\bl - semaphore control operations
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bse\bem\bm.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bem\bmc\bct\btl\bl(_\bi_\bn_\bt _\bs_\be_\bm_\bi_\bd, _\bi_\bn_\bt _\bs_\be_\bm_\bn_\bu_\bm, _\bi_\bn_\bt _\bc_\bm_\bd, _\bu_\bn_\bi_\bo_\bn _\bs_\be_\bm_\bu_\bn _\ba_\br_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bem\bmc\bct\btl\bl() system call provides a number of control operations on the
+ semaphore specified by _\bs_\be_\bm_\bn_\bu_\bm and _\bs_\be_\bm_\bi_\bd. The operation to be performed
+ is specified in _\bc_\bm_\bd (see below). _\ba_\br_\bg is a union of the following fields:
+
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_{STAT,SET} */
+ u_short *array; /* array for GETALL & SETALL */
+
+ The semid_ds structure used in the IPC_SET and IPC_STAT commands is
+ defined as follows in <_\bs_\by_\bs_\b/_\bs_\be_\bm_\b._\bh>:
+
+ struct semid_ds {
+ struct ipc_perm sem_perm; /* operation permissions */
+ struct sem *sem_base; /* semaphore set */
+ u_short sem_nsems; /* number of sems in set */
+ time_t sem_otime; /* last operation time */
+ time_t sem_ctime; /* last change time */
+ };
+
+ The ipc_perm structure used inside the semid_ds structure is defined in
+ <_\bs_\by_\bs_\b/_\bi_\bp_\bc_\b._\bh> and looks like this:
+
+ struct ipc_perm {
+ uid_t cuid; /* creator user id */
+ gid_t cgid; /* creator group id */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ mode_t mode; /* r/w permission (see chmod(2)) */
+ u_short seq; /* sequence # (to generate unique msg/sem/shm id) */
+ key_t key; /* user specified msg/sem/shm key */
+ };
+
+ s\bse\bem\bmc\bct\btl\bl() provides the following operations:
+
+ GETVAL Return the value of the semaphore.
+
+ SETVAL Set the value of the semaphore to _\ba_\br_\bg_\b._\bv_\ba_\bl.
+
+ GETPID Return the pid of the last process that did an operation on
+ this semaphore.
+
+ GETNCNT Return the number of processes waiting to acquire the
+ semaphore.
+
+ GETZCNT Return the number of processes waiting for the value of the
+ semaphore to reach 0.
+
+ GETALL Return the values for all the semaphores associated with
+ _\bs_\be_\bm_\bi_\bd.
+
+ SETALL Set the values for all the semaphores that are associated with
+ the semaphore identifier _\bs_\be_\bm_\bi_\bd to the corresponding values in
+ _\ba_\br_\bg_\b._\ba_\br_\br_\ba_\by.
+
+ IPC_STAT Gather statistics about a semaphore and place the information
+ in the semid_ds structure pointed to by _\ba_\br_\bg_\b._\bb_\bu_\bf (see above).
+
+ IPC_SET Set the value of the _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd, _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd and
+ _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be fields in the structure associated with the
+ semaphore. The values are taken from the corresponding fields
+ in the structure pointed to by _\ba_\br_\bg_\b._\bb_\bu_\bf. This operation can
+ only be executed by the superuser, or a process that has an
+ effective user ID equal to either _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or
+ _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd in the data structure associated with the message
+ queue.
+
+ IPC_RMID Remove the semaphores associated with _\bs_\be_\bm_\bi_\bd from the system
+ and destroy the data structures associated with it. Only the
+ superuser or a process with an effective UID equal to the
+ _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd values in the data structure
+ associated with the semaphore can do this.
+
+ The permission to read or change a message queue (see semop(2)) is
+ determined by the _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be field in the same way as is done with
+ files (see chmod(2)), but the effective UID can match either the
+ _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd field or the _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd field, and the effective GID can
+ match either _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd or _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ For the GETVAL, GETPID, GETNCNT, and GETZCNT operations, s\bse\bem\bmc\bct\btl\bl() returns
+ one of the values described above if successful. All other operations
+ will make s\bse\bem\bmc\bct\btl\bl() return 0 if no errors occur. Otherwise -1 is returned
+ and _\be_\br_\br_\bn_\bo set to reflect the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bem\bmc\bct\btl\bl() will fail if:
+
+ [EPERM] _\bc_\bm_\bd is equal to IPC_SET or IPC_RMID and the caller is
+ not the superuser, nor does the effective UID match
+ either the _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd or _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd fields of the
+ data structure associated with the message queue.
+
+ [EACCES] The caller has no operation permission for this
+ semaphore.
+
+ [EINVAL] _\bs_\be_\bm_\bi_\bd is not a valid message semaphore identifier.
+
+ _\bc_\bm_\bd is not a valid command.
+
+ [EFAULT] _\ba_\br_\bg_\b._\bb_\bu_\bf or _\ba_\br_\bg_\b._\ba_\br_\br_\ba_\by specify an invalid address.
+
+ [ERANGE] _\bc_\bm_\bd is equal to SETVAL or SETALL and _\ba_\br_\bg_\b._\bv_\ba_\bl or the
+ values in _\ba_\br_\bg_\b._\ba_\br_\br_\ba_\by are greater than the system-
+ imposed limit.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ semget(2), semop(2)
+
+N\bNA\bAM\bME\bE
+ s\bse\bem\bmg\bge\bet\bt - get semaphore set
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bse\bem\bm.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bem\bmg\bge\bet\bt(_\bk_\be_\by_\b__\bt _\bk_\be_\by, _\bi_\bn_\bt _\bn_\bs_\be_\bm_\bs, _\bi_\bn_\bt _\bs_\be_\bm_\bf_\bl_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bem\bmg\bge\bet\bt() system call returns the semaphore identifier associated with
+ _\bk_\be_\by.
+
+ A new set containing _\bn_\bs_\be_\bm_\bs semaphores is created if either _\bk_\be_\by is equal
+ to IPC_PRIVATE, or _\bk_\be_\by does not have a semaphore set associated with it
+ and the IPC_CREAT bit is set in _\bs_\be_\bm_\bf_\bl_\bg.
+
+ The access modes of the created semaphores is specified in _\bs_\be_\bm_\bf_\bl_\bg as a
+ bitwise OR of zero or more of the following values:
+
+ SEM_A alter permission for owner
+ SEM_R read permission for owner
+
+ SEM_A >> 3 alter permission for group
+ SEM_R >> 3 read permission for group
+
+ SEM_A >> 6 alter permission for other
+ SEM_R >> 6 read permission for other
+
+ If a new set of semaphores is created, the data structure associated with
+ it (the _\bs_\be_\bm_\bi_\bd_\b__\bd_\bs structure, see semctl(2)) is initialized as follows:
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd and _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd are set to the effective UID of the
+ calling process.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd and _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd are set to the effective GID of the
+ calling process.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be is set to the lower 9 bits of _\bs_\be_\bm_\bf_\bl_\bg.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bn_\bs_\be_\bm_\bs is set to the value of _\bn_\bs_\be_\bm_\bs.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bc_\bt_\bi_\bm_\be is set to the current time.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bo_\bt_\bi_\bm_\be is set to 0.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ s\bse\bem\bmg\bge\bet\bt() returns a non-negative semaphore identifier if successful.
+ Otherwise, -1 is returned and _\be_\br_\br_\bn_\bo is set to reflect the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EACCES] The caller has no permission to access a semaphore set
+ already associated with _\bk_\be_\by.
+
+ [EEXIST] Both IPC_CREAT and IPC_EXCL are set in _\bs_\be_\bm_\bf_\bl_\bg, and a
+ semaphore set is already associated with _\bk_\be_\by.
+
+ [EINVAL] _\bn_\bs_\be_\bm_\bs is less than or equal to 0 or greater than the
+ system limit for the number in a semaphore set.
+
+ A semaphore set associated with _\bk_\be_\by exists, but has
+ fewer semaphores than the number specified in _\bn_\bs_\be_\bm_\bs.
+
+ [ENOSPC] A new set of semaphores could not be created because
+ the system limit for the number of semaphores or the
+ number of semaphore sets has been reached.
+
+ [ENOENT] IPC_CREAT was not set in _\bs_\be_\bm_\bf_\bl_\bg and no semaphore set
+ associated with _\bk_\be_\by was found.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ semctl(2), semop(2), ftok(3)
+
+N\bNA\bAM\bME\bE
+ s\bse\bem\bmo\bop\bp - semaphore operations
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bse\bem\bm.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bem\bmo\bop\bp(_\bi_\bn_\bt _\bs_\be_\bm_\bi_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\be_\bm_\bb_\bu_\bf _\b*_\bs_\bo_\bp_\bs, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bs_\bo_\bp_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bem\bmo\bop\bp() provides a number of atomic operations on a set of semaphores.
+ The semaphore set is specified by _\bs_\be_\bm_\bi_\bd. _\bs_\bo_\bp_\bs is an array of semaphore
+ operations, _\bn_\bs_\bo_\bp_\bs is the number of operations in this array. The _\bs_\be_\bm_\bb_\bu_\bf
+ structures in the array contain the following members:
+
+ u_short sem_num; /* semaphore # */
+ short sem_op; /* semaphore operation */
+ short sem_flg; /* operation flags */
+
+ Each operation (specified in _\bs_\be_\bm_\b__\bo_\bp) is applied to semaphore number
+ _\bs_\be_\bm_\b__\bn_\bu_\bm in the set of semaphores specified by _\bs_\be_\bm_\bi_\bd. The value of _\bs_\be_\bm_\b__\bo_\bp
+ determines the action taken in the following way:
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bo_\bp is less than 0. The current process is blocked until the
+ value of the semaphore is greater than or equal to the absolute value
+ of _\bs_\be_\bm_\b__\bo_\bp. The absolute value of _\bs_\be_\bm_\b__\bo_\bp is then subtracted from the
+ value of the semaphore, and the calling process continues. Negative
+ values of _\bs_\be_\bm_\b__\bo_\bp are thus used to enter critical regions.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bo_\bp is greater than 0. Its value is added to the value of the
+ specified semaphore. This is used to leave critical regions.
+
+ +\b+\bo\bo _\bs_\be_\bm_\b__\bo_\bp is equal to 0. The calling process is blocked until the value
+ of the specified semaphore reaches 0.
+
+ The behavior of each operation is influenced by the flags set in _\bs_\be_\bm_\b__\bf_\bl_\bg
+ in the following way:
+
+ IPC_NOWAIT In the case where the calling process would normally block,
+ waiting for a semaphore to reach a certain value, IPC_NOWAIT
+ makes the call return immediately, returning a value of -1
+ and setting _\be_\br_\br_\bn_\bo to EAGAIN.
+
+ SEM_UNDO Keep track of the changes that this call makes to the value
+ of a semaphore, so that they can be undone when the calling
+ process terminates. This is useful to prevent other
+ processes waiting on a semaphore to block forever, should
+ the process that has the semaphore locked terminate in a
+ critical section.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bem\bmo\bop\bp() will fail if:
+
+ [EINVAL] There is no semaphore associated with _\bs_\be_\bm_\bi_\bd.
+
+ [EIDRM] The semaphore set was removed while the process was
+ waiting for one of its semaphores to reach a certain
+ value.
+
+ [EACCES] The calling process has no permission to access the
+ specified semaphore set.
+
+ [E2BIG] The value of _\bn_\bs_\bo_\bp_\bs is too big. The maximum is
+ specified in MAX_SOPS in <_\bs_\by_\bs_\b/_\bs_\be_\bm_\b._\bh>.
+
+ [EFBIG] _\bs_\be_\bm_\b__\bn_\bu_\bm in one of the sem_buf structures is less than
+ 0, or greater than the actual number of semaphores in
+ the set specified by _\bs_\be_\bm_\bi_\bd.
+
+ [ENOSPC] SEM_UNDO was requested, and there is not enough space
+ left in the kernel to store the undo information.
+
+ [EAGAIN] The requested operation can not immediately be
+ performed, and IPC_NOWAIT was set in _\bs_\be_\bm_\b__\bf_\bl_\bg.
+
+ [EFAULT] _\bs_\bo_\bp_\bs points to an illegal address.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ semctl(2), semget(2)
+
+N\bNA\bAM\bME\bE
+ s\bse\ben\bnd\bd, s\bse\ben\bnd\bdt\bto\bo, s\bse\ben\bnd\bdm\bms\bsg\bg - send a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bd(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdt\bto\bo(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bt_\bo, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bt_\bo_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() are used to transmit a message to another
+ socket. s\bse\ben\bnd\bd() may be used only when the socket is in a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd state,
+ while s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may be used at any time.
+
+ The address of the target is given by _\bt_\bo with _\bt_\bo_\bl_\be_\bn specifying its size.
+ The length of the message is given by _\bl_\be_\bn. If the message is too long to
+ pass atomically through the underlying protocol, the error EMSGSIZE is
+ returned, and the message is not transmitted.
+
+ No indication of failure to deliver is implicit in a s\bse\ben\bnd\bd(). Locally
+ detected errors are indicated by a return value of -1.
+
+ If no messages space is available at the socket to hold the message to be
+ transmitted, then s\bse\ben\bnd\bd() normally blocks, unless the socket has been
+ placed in non-blocking I/O mode. The select(2) or poll(2) system calls
+ may be used to determine when it is possible to send more data.
+
+ The _\bf_\bl_\ba_\bg_\bs parameter may include one or more of the following:
+
+ MSG_DONTROUTE bypass routing tables, silently ignored
+ MSG_DONTWAIT don't block
+ MSG_EOR terminate the record (SOCK_SEQPACKET only)
+ MSG_NOSIGNAL don't send SIGPIPE
+ MSG_OOB process out-of-band data
+
+ The flag MSG_OOB is used to send ``out-of-band'' data on sockets that
+ support this notion (e.g., SOCK_STREAM); the underlying protocol must
+ also support ``out-of-band'' data. MSG_NOSIGNAL is used to request not
+ to send the SIGPIPE signal if an attempt to send is made on a socket that
+ is shut down for writing or no longer connected.
+
+ See recv(2) for a description of the _\bm_\bs_\bg_\bh_\bd_\br structure.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns the number of characters sent, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() fail if:
+
+ [EBADF] An invalid descriptor was specified.
+
+ [ENOTSOCK] The argument _\bs is not a socket.
+
+ [EFAULT] An invalid user space address was specified for a
+ parameter.
+
+ [EMSGSIZE] The socket requires that message be sent atomically,
+ and the size of the message to be sent made this
+ impossible.
+
+ [EAGAIN] The socket is marked non-blocking or the MSG_DONTWAIT
+ flag is set and the requested operation would block.
+
+ [ENOBUFS] The system was unable to allocate an internal buffer.
+ The operation may succeed when buffers become
+ available.
+
+ [ENOBUFS] The output queue for a network interface was full.
+ This generally indicates that the interface has
+ stopped sending, but may be caused by transient
+ congestion.
+
+ [EACCES] The SO_BROADCAST option is not set on the socket, and
+ a broadcast address was given as the destination.
+
+ [EHOSTUNREACH] The destination address specified an unreachable host.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs parameter is invalid.
+
+ [EHOSTDOWN] The destination address specified a host that is down.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [ECONNREFUSED] The destination host rejected the message (or a
+ previous one). This error can only be returned by
+ connected sockets.
+
+ [ENOPROTOOPT] There was a problem sending the message. This error
+ can only be returned by connected sockets.
+
+ [EDESTADDRREQ] The socket is not connected, and no destination
+ address was specified.
+
+ [EPIPE] The socket is shut down for writing or not longer
+ connected and the MSG_NOSIGNAL flag is set.
+
+ In addition, s\bse\ben\bnd\bd() and s\bse\ben\bnd\bdt\bto\bo() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EAFNOSUPPORT] Addresses in the specified address family cannot be
+ used with this socket.
+
+ [EISCONN] The socket is already connected, and a destination
+ address was specified.
+
+ s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMFILE] The message contains control information utilizing
+ CMSG_DATA(3) to pass file descriptors, but too many
+ file descriptors are already in-flight.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), getsockopt(2), poll(2), recv(2), select(2), socket(2),
+ write(2), CMSG_DATA(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT and MSG_NOSIGNAL flags are
+ extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\ben\bnd\bd() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\ben\bnd\bd, s\bse\ben\bnd\bdt\bto\bo, s\bse\ben\bnd\bdm\bms\bsg\bg - send a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bd(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdt\bto\bo(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bt_\bo, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bt_\bo_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() are used to transmit a message to another
+ socket. s\bse\ben\bnd\bd() may be used only when the socket is in a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd state,
+ while s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may be used at any time.
+
+ The address of the target is given by _\bt_\bo with _\bt_\bo_\bl_\be_\bn specifying its size.
+ The length of the message is given by _\bl_\be_\bn. If the message is too long to
+ pass atomically through the underlying protocol, the error EMSGSIZE is
+ returned, and the message is not transmitted.
+
+ No indication of failure to deliver is implicit in a s\bse\ben\bnd\bd(). Locally
+ detected errors are indicated by a return value of -1.
+
+ If no messages space is available at the socket to hold the message to be
+ transmitted, then s\bse\ben\bnd\bd() normally blocks, unless the socket has been
+ placed in non-blocking I/O mode. The select(2) or poll(2) system calls
+ may be used to determine when it is possible to send more data.
+
+ The _\bf_\bl_\ba_\bg_\bs parameter may include one or more of the following:
+
+ MSG_DONTROUTE bypass routing tables, silently ignored
+ MSG_DONTWAIT don't block
+ MSG_EOR terminate the record (SOCK_SEQPACKET only)
+ MSG_NOSIGNAL don't send SIGPIPE
+ MSG_OOB process out-of-band data
+
+ The flag MSG_OOB is used to send ``out-of-band'' data on sockets that
+ support this notion (e.g., SOCK_STREAM); the underlying protocol must
+ also support ``out-of-band'' data. MSG_NOSIGNAL is used to request not
+ to send the SIGPIPE signal if an attempt to send is made on a socket that
+ is shut down for writing or no longer connected.
+
+ See recv(2) for a description of the _\bm_\bs_\bg_\bh_\bd_\br structure.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns the number of characters sent, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() fail if:
+
+ [EBADF] An invalid descriptor was specified.
+
+ [ENOTSOCK] The argument _\bs is not a socket.
+
+ [EFAULT] An invalid user space address was specified for a
+ parameter.
+
+ [EMSGSIZE] The socket requires that message be sent atomically,
+ and the size of the message to be sent made this
+ impossible.
+
+ [EAGAIN] The socket is marked non-blocking or the MSG_DONTWAIT
+ flag is set and the requested operation would block.
+
+ [ENOBUFS] The system was unable to allocate an internal buffer.
+ The operation may succeed when buffers become
+ available.
+
+ [ENOBUFS] The output queue for a network interface was full.
+ This generally indicates that the interface has
+ stopped sending, but may be caused by transient
+ congestion.
+
+ [EACCES] The SO_BROADCAST option is not set on the socket, and
+ a broadcast address was given as the destination.
+
+ [EHOSTUNREACH] The destination address specified an unreachable host.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs parameter is invalid.
+
+ [EHOSTDOWN] The destination address specified a host that is down.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [ECONNREFUSED] The destination host rejected the message (or a
+ previous one). This error can only be returned by
+ connected sockets.
+
+ [ENOPROTOOPT] There was a problem sending the message. This error
+ can only be returned by connected sockets.
+
+ [EDESTADDRREQ] The socket is not connected, and no destination
+ address was specified.
+
+ [EPIPE] The socket is shut down for writing or not longer
+ connected and the MSG_NOSIGNAL flag is set.
+
+ In addition, s\bse\ben\bnd\bd() and s\bse\ben\bnd\bdt\bto\bo() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EAFNOSUPPORT] Addresses in the specified address family cannot be
+ used with this socket.
+
+ [EISCONN] The socket is already connected, and a destination
+ address was specified.
+
+ s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMFILE] The message contains control information utilizing
+ CMSG_DATA(3) to pass file descriptors, but too many
+ file descriptors are already in-flight.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), getsockopt(2), poll(2), recv(2), select(2), socket(2),
+ write(2), CMSG_DATA(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT and MSG_NOSIGNAL flags are
+ extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\ben\bnd\bd() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg - send a message to syslogd
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg() is used to transmit a syslog(3) formatted message direct to
+ syslogd(8) without requiring the allocation of a socket. This is used
+ internally by syslog_r(3), so that messages can be sent during difficult
+ situations.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg() can fail if:
+
+ [ENOTCONN] The message cannot be sent, likely because syslogd(8)
+ is not running.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ syslog_r(3), syslogd(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg() function call appeared in OpenBSD 5.6.
+
+N\bNA\bAM\bME\bE
+ s\bse\ben\bnd\bd, s\bse\ben\bnd\bdt\bto\bo, s\bse\ben\bnd\bdm\bms\bsg\bg - send a message from a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bd(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdt\bto\bo(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bm_\bs_\bg, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs,
+ _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\ba_\bd_\bd_\br _\b*_\bt_\bo, _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bt_\bo_\bl_\be_\bn);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ s\bse\ben\bnd\bdm\bms\bsg\bg(_\bi_\bn_\bt _\bs, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bm_\bs_\bg_\bh_\bd_\br _\b*_\bm_\bs_\bg, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() are used to transmit a message to another
+ socket. s\bse\ben\bnd\bd() may be used only when the socket is in a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd state,
+ while s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may be used at any time.
+
+ The address of the target is given by _\bt_\bo with _\bt_\bo_\bl_\be_\bn specifying its size.
+ The length of the message is given by _\bl_\be_\bn. If the message is too long to
+ pass atomically through the underlying protocol, the error EMSGSIZE is
+ returned, and the message is not transmitted.
+
+ No indication of failure to deliver is implicit in a s\bse\ben\bnd\bd(). Locally
+ detected errors are indicated by a return value of -1.
+
+ If no messages space is available at the socket to hold the message to be
+ transmitted, then s\bse\ben\bnd\bd() normally blocks, unless the socket has been
+ placed in non-blocking I/O mode. The select(2) or poll(2) system calls
+ may be used to determine when it is possible to send more data.
+
+ The _\bf_\bl_\ba_\bg_\bs parameter may include one or more of the following:
+
+ MSG_DONTROUTE bypass routing tables, silently ignored
+ MSG_DONTWAIT don't block
+ MSG_EOR terminate the record (SOCK_SEQPACKET only)
+ MSG_NOSIGNAL don't send SIGPIPE
+ MSG_OOB process out-of-band data
+
+ The flag MSG_OOB is used to send ``out-of-band'' data on sockets that
+ support this notion (e.g., SOCK_STREAM); the underlying protocol must
+ also support ``out-of-band'' data. MSG_NOSIGNAL is used to request not
+ to send the SIGPIPE signal if an attempt to send is made on a socket that
+ is shut down for writing or no longer connected.
+
+ See recv(2) for a description of the _\bm_\bs_\bg_\bh_\bd_\br structure.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The call returns the number of characters sent, or -1 if an error
+ occurred.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() fail if:
+
+ [EBADF] An invalid descriptor was specified.
+
+ [ENOTSOCK] The argument _\bs is not a socket.
+
+ [EFAULT] An invalid user space address was specified for a
+ parameter.
+
+ [EMSGSIZE] The socket requires that message be sent atomically,
+ and the size of the message to be sent made this
+ impossible.
+
+ [EAGAIN] The socket is marked non-blocking or the MSG_DONTWAIT
+ flag is set and the requested operation would block.
+
+ [ENOBUFS] The system was unable to allocate an internal buffer.
+ The operation may succeed when buffers become
+ available.
+
+ [ENOBUFS] The output queue for a network interface was full.
+ This generally indicates that the interface has
+ stopped sending, but may be caused by transient
+ congestion.
+
+ [EACCES] The SO_BROADCAST option is not set on the socket, and
+ a broadcast address was given as the destination.
+
+ [EHOSTUNREACH] The destination address specified an unreachable host.
+
+ [EINVAL] The _\bf_\bl_\ba_\bg_\bs parameter is invalid.
+
+ [EHOSTDOWN] The destination address specified a host that is down.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [ECONNREFUSED] The destination host rejected the message (or a
+ previous one). This error can only be returned by
+ connected sockets.
+
+ [ENOPROTOOPT] There was a problem sending the message. This error
+ can only be returned by connected sockets.
+
+ [EDESTADDRREQ] The socket is not connected, and no destination
+ address was specified.
+
+ [EPIPE] The socket is shut down for writing or not longer
+ connected and the MSG_NOSIGNAL flag is set.
+
+ In addition, s\bse\ben\bnd\bd() and s\bse\ben\bnd\bdt\bto\bo() may return the following error:
+
+ [EINVAL] _\bl_\be_\bn was larger than SSIZE_MAX.
+
+ s\bse\ben\bnd\bdt\bto\bo() and s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EAFNOSUPPORT] Addresses in the specified address family cannot be
+ used with this socket.
+
+ [EISCONN] The socket is already connected, and a destination
+ address was specified.
+
+ s\bse\ben\bnd\bdm\bms\bsg\bg() may return the following errors:
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bm_\bs_\bg_\b__\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EMSGSIZE] The _\bm_\bs_\bg_\b__\bi_\bo_\bv_\bl_\be_\bn member of _\bm_\bs_\bg was less than 0 or larger
+ than IOV_MAX.
+
+ [EMFILE] The message contains control information utilizing
+ CMSG_DATA(3) to pass file descriptors, but too many
+ file descriptors are already in-flight.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), getsockopt(2), poll(2), recv(2), select(2), socket(2),
+ write(2), CMSG_DATA(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdt\bto\bo(), and s\bse\ben\bnd\bdm\bms\bsg\bg() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1''). The MSG_DONTWAIT and MSG_NOSIGNAL flags are
+ extensions to that specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\ben\bnd\bd() function call appeared in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btu\bui\bid\bd, s\bse\bet\bte\beu\bui\bid\bd, s\bse\bet\btg\bgi\bid\bd, s\bse\bet\bte\beg\bgi\bid\bd - set user and group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btu\bui\bid\bd() function sets the real and effective user IDs and the saved
+ set-user-ID of the current process to the specified value. The s\bse\bet\btu\bui\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified user ID is the same as the effective user ID. If
+ not, but the specified user ID is the same as the real user ID, s\bse\bet\btu\bui\bid\bd()
+ will set the effective user ID to the real user ID.
+
+ The s\bse\bet\btg\bgi\bid\bd() function sets the real and effective group IDs and the saved
+ set-group-ID of the current process to the specified value. The s\bse\bet\btg\bgi\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified group ID is the same as the effective group ID. If
+ not, but the specified group ID is the same as the real group ID,
+ s\bse\bet\btg\bgi\bid\bd() will set the effective group ID to the real group ID.
+ Supplementary group IDs remain unchanged.
+
+ The s\bse\bet\bte\beu\bui\bid\bd() function (s\bse\bet\bte\beg\bgi\bid\bd()) sets the effective user ID (group ID)
+ of the current process. The effective user ID may be set to the value of
+ the real user ID or the saved set-user-ID (see intro(2) and execve(2));
+ in this way, the effective user ID of a set-user-ID executable may be
+ toggled by switching to the real user ID, then re-enabled by reverting to
+ the set-user-ID value. Similarly, the effective group ID may be set to
+ the value of the real group ID or the saved set-group-ID.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions return the
+ value 0 if successful; otherwise the value -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btu\bui\bid\bd() and s\bse\bet\bte\beu\bui\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bu_\bi_\bd or
+ _\be_\bu_\bi_\bd is not the process's real, effective, or saved
+ UID.
+
+ s\bse\bet\btg\bgi\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bg_\bi_\bd or
+ _\be_\bg_\bi_\bd is not the process's real, effective, or saved
+ GID.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getuid(2), issetugid(2), setgroups(2), setregid(2),
+ setresgid(2), setresuid(2), setreuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions conform to
+ IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX; s\bse\bet\btg\bgi\bid\bd()
+ in Version 4 AT&T UNIX; and s\bse\bet\bte\beu\bui\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btu\bui\bid\bd, s\bse\bet\bte\beu\bui\bid\bd, s\bse\bet\btg\bgi\bid\bd, s\bse\bet\bte\beg\bgi\bid\bd - set user and group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btu\bui\bid\bd() function sets the real and effective user IDs and the saved
+ set-user-ID of the current process to the specified value. The s\bse\bet\btu\bui\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified user ID is the same as the effective user ID. If
+ not, but the specified user ID is the same as the real user ID, s\bse\bet\btu\bui\bid\bd()
+ will set the effective user ID to the real user ID.
+
+ The s\bse\bet\btg\bgi\bid\bd() function sets the real and effective group IDs and the saved
+ set-group-ID of the current process to the specified value. The s\bse\bet\btg\bgi\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified group ID is the same as the effective group ID. If
+ not, but the specified group ID is the same as the real group ID,
+ s\bse\bet\btg\bgi\bid\bd() will set the effective group ID to the real group ID.
+ Supplementary group IDs remain unchanged.
+
+ The s\bse\bet\bte\beu\bui\bid\bd() function (s\bse\bet\bte\beg\bgi\bid\bd()) sets the effective user ID (group ID)
+ of the current process. The effective user ID may be set to the value of
+ the real user ID or the saved set-user-ID (see intro(2) and execve(2));
+ in this way, the effective user ID of a set-user-ID executable may be
+ toggled by switching to the real user ID, then re-enabled by reverting to
+ the set-user-ID value. Similarly, the effective group ID may be set to
+ the value of the real group ID or the saved set-group-ID.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions return the
+ value 0 if successful; otherwise the value -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btu\bui\bid\bd() and s\bse\bet\bte\beu\bui\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bu_\bi_\bd or
+ _\be_\bu_\bi_\bd is not the process's real, effective, or saved
+ UID.
+
+ s\bse\bet\btg\bgi\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bg_\bi_\bd or
+ _\be_\bg_\bi_\bd is not the process's real, effective, or saved
+ GID.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getuid(2), issetugid(2), setgroups(2), setregid(2),
+ setresgid(2), setresuid(2), setreuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions conform to
+ IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX; s\bse\bet\btg\bgi\bid\bd()
+ in Version 4 AT&T UNIX; and s\bse\bet\bte\beu\bui\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btu\bui\bid\bd, s\bse\bet\bte\beu\bui\bid\bd, s\bse\bet\btg\bgi\bid\bd, s\bse\bet\bte\beg\bgi\bid\bd - set user and group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btu\bui\bid\bd() function sets the real and effective user IDs and the saved
+ set-user-ID of the current process to the specified value. The s\bse\bet\btu\bui\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified user ID is the same as the effective user ID. If
+ not, but the specified user ID is the same as the real user ID, s\bse\bet\btu\bui\bid\bd()
+ will set the effective user ID to the real user ID.
+
+ The s\bse\bet\btg\bgi\bid\bd() function sets the real and effective group IDs and the saved
+ set-group-ID of the current process to the specified value. The s\bse\bet\btg\bgi\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified group ID is the same as the effective group ID. If
+ not, but the specified group ID is the same as the real group ID,
+ s\bse\bet\btg\bgi\bid\bd() will set the effective group ID to the real group ID.
+ Supplementary group IDs remain unchanged.
+
+ The s\bse\bet\bte\beu\bui\bid\bd() function (s\bse\bet\bte\beg\bgi\bid\bd()) sets the effective user ID (group ID)
+ of the current process. The effective user ID may be set to the value of
+ the real user ID or the saved set-user-ID (see intro(2) and execve(2));
+ in this way, the effective user ID of a set-user-ID executable may be
+ toggled by switching to the real user ID, then re-enabled by reverting to
+ the set-user-ID value. Similarly, the effective group ID may be set to
+ the value of the real group ID or the saved set-group-ID.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions return the
+ value 0 if successful; otherwise the value -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btu\bui\bid\bd() and s\bse\bet\bte\beu\bui\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bu_\bi_\bd or
+ _\be_\bu_\bi_\bd is not the process's real, effective, or saved
+ UID.
+
+ s\bse\bet\btg\bgi\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bg_\bi_\bd or
+ _\be_\bg_\bi_\bd is not the process's real, effective, or saved
+ GID.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getuid(2), issetugid(2), setgroups(2), setregid(2),
+ setresgid(2), setresuid(2), setreuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions conform to
+ IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX; s\bse\bet\btg\bgi\bid\bd()
+ in Version 4 AT&T UNIX; and s\bse\bet\bte\beu\bui\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btg\bgr\bro\bou\bup\bps\bs - set group access list
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btg\bgr\bro\bou\bup\bps\bs(_\bi_\bn_\bt _\bn_\bg_\br_\bo_\bu_\bp_\bs, _\bc_\bo_\bn_\bs_\bt _\bg_\bi_\bd_\b__\bt _\b*_\bg_\bi_\bd_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bet\btg\bgr\bro\bou\bup\bps\bs() sets the group access list of the current user process
+ according to the array _\bg_\bi_\bd_\bs_\be_\bt. The parameter _\bn_\bg_\br_\bo_\bu_\bp_\bs indicates the
+ number of entries in the array and must be no more than {NGROUPS_MAX}.
+
+ Only the superuser may set new groups.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The s\bse\bet\btg\bgr\bro\bou\bup\bps\bs() call will fail if:
+
+ [EINVAL] The value of _\bn_\bg_\br_\bo_\bu_\bp_\bs is greater than {NGROUPS_MAX}.
+
+ [EPERM] The caller is not the superuser.
+
+ [EFAULT] The address specified for _\bg_\bi_\bd_\bs_\be_\bt is outside the
+ process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgroups(2), setgid(2), setregid(2), initgroups(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btg\bgr\bro\bou\bup\bps\bs() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br, s\bse\bet\bti\bit\bti\bim\bme\ber\br - get/set value of interval timer
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_R\bRE\bEA\bAL\bL 0\b0
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_V\bVI\bIR\bRT\bTU\bUA\bAL\bL 1\b1
+ #\b#d\bde\bef\bfi\bin\bne\be I\bIT\bTI\bIM\bME\bER\bR_\b_P\bPR\bRO\bOF\bF 2\b2
+
+ _\bi_\bn_\bt
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bv_\ba_\bl_\bu_\be);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bti\bit\bti\bim\bme\ber\br(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bv_\ba_\bl_\bu_\be,
+ _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl _\b*_\bo_\bv_\ba_\bl_\bu_\be);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\brc\bcl\ble\bea\bar\br(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*);
+
+ _\bi_\bn_\bt
+ t\bti\bim\bme\ber\bri\bis\bss\bse\bet\bt(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*);
+
+ _\bi_\bn_\bt
+ t\bti\bim\bme\ber\brc\bcm\bmp\bp(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bC_\bM_\bP);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\brs\bsu\bub\bb(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\br_\be_\bs);
+
+ _\bv_\bo_\bi_\bd
+ t\bti\bim\bme\ber\bra\bad\bdd\bd(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\ba, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bb, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\br_\be_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The system provides each process with three interval timers, defined in
+ <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>. The g\bge\bet\bti\bit\bti\bim\bme\ber\br() call returns the current value for the
+ timer specified in _\bw_\bh_\bi_\bc_\bh in the structure at _\bv_\ba_\bl_\bu_\be. The s\bse\bet\bti\bit\bti\bim\bme\ber\br() call
+ sets a timer to the specified _\bv_\ba_\bl_\bu_\be (returning the previous value of the
+ timer if _\bo_\bv_\ba_\bl_\bu_\be is non-null).
+
+ A timer value is defined by the _\bi_\bt_\bi_\bm_\be_\br_\bv_\ba_\bl structure:
+
+ struct itimerval {
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+ };
+
+ If _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be is non-zero, it indicates the time to the next timer
+ expiration. If _\bi_\bt_\b__\bi_\bn_\bt_\be_\br_\bv_\ba_\bl is non-zero, it specifies a value to be used
+ in reloading _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be when the timer expires. Setting _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be to 0
+ disables a timer. Setting _\bi_\bt_\b__\bi_\bn_\bt_\be_\br_\bv_\ba_\bl to 0 causes a timer to be disabled
+ after its next expiration (assuming _\bi_\bt_\b__\bv_\ba_\bl_\bu_\be is non-zero).
+
+ Time values smaller than the resolution of the system clock are rounded
+ up to this resolution (typically 10 milliseconds).
+
+ The ITIMER_REAL timer decrements in real time. A SIGALRM signal is
+ delivered when this timer expires.
+
+ The ITIMER_VIRTUAL timer decrements in process virtual time. It runs
+ only when the process is executing. A SIGVTALRM signal is delivered when
+ it expires.
+
+ The ITIMER_PROF timer decrements both in process virtual time and when
+ the system is running on behalf of the process. It is designed to be
+ used by interpreters in statistically profiling the execution of
+ interpreted programs. Each time the ITIMER_PROF timer expires, the
+ SIGPROF signal is delivered. Because this signal may interrupt in-
+ progress system calls, programs using this timer must be prepared to
+ restart interrupted system calls.
+
+ The remaining five functions are in fact macros for manipulating time
+ values, defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>.
+
+ t\bti\bim\bme\ber\brc\bcl\ble\bea\bar\br(_\ba) sets the time value in _\ba to zero.
+
+ t\bti\bim\bme\ber\bri\bis\bss\bse\bet\bt(_\ba) tests if the time value in _\ba is non-zero.
+
+ t\bti\bim\bme\ber\brc\bcm\bmp\bp(_\ba, _\bb, _\bC_\bM_\bP) compares two time values in the form _\ba CMP _\bb, where
+ _\bC_\bM_\bP is <, <=, ==, !=, >=, or > .
+
+ t\bti\bim\bme\ber\brs\bsu\bub\bb(_\ba, _\bb, _\br_\be_\bs) subtracts _\ba - _\bb and stores the result in _\br_\be_\bs.
+
+ t\bti\bim\bme\ber\bra\bad\bdd\bd(_\ba, _\bb, _\br_\be_\bs) adds two timers and stores the result in _\br_\be_\bs.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() will fail if:
+
+ [EFAULT] The _\bv_\ba_\bl_\bu_\be parameter specified a bad address.
+
+ [EINVAL] An unrecognized value for _\bw_\bh_\bi_\bc_\bh was specified.
+
+ In addition, s\bse\bet\bti\bit\bti\bim\bme\ber\br() may return the following error:
+
+ [EINVAL] _\bv_\ba_\bl_\bu_\be or _\bo_\bv_\ba_\bl_\bu_\be specified a time that was too large to
+ be handled.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), gettimeofday(2), poll(2), select(2), sigaction(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bti\bit\bti\bim\bme\ber\br() and s\bse\bet\bti\bit\bti\bim\bme\ber\br() system calls first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btl\blo\bog\bgi\bin\bn, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br, s\bse\bet\btl\blo\bog\bgi\bin\bn - get/set login name
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bc_\bh_\ba_\br _\b*
+ g\bge\bet\btl\blo\bog\bgi\bin\bn(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be, _\bs_\bi_\bz_\be_\b__\bt _\bn_\ba_\bm_\be_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btl\blo\bog\bgi\bin\bn(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() routine returns the login name of the user associated with
+ the current session, as previously set by s\bse\bet\btl\blo\bog\bgi\bin\bn(). The name is
+ normally associated with a login shell at the time a session is created,
+ and is inherited by all processes descended from the login shell. (This
+ is true even if some of those processes assume another user ID, for
+ example when su(1) is used.)
+
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() routine is a reentrant version of g\bge\bet\btl\blo\bog\bgi\bin\bn(). It is
+ functionally identical to g\bge\bet\btl\blo\bog\bgi\bin\bn() except that the caller must provide
+ a buffer, _\bn_\ba_\bm_\be, in which to store the user's login name and a
+ corresponding length parameter, _\bn_\ba_\bm_\be_\bl_\be_\bn, that specifies the size of the
+ buffer. The buffer should be large enough to store the login name and a
+ trailing NUL (typically LOGIN_NAME_MAX bytes).
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() sets the login name of the user associated with the current
+ session to _\bn_\ba_\bm_\be. This call is restricted to the superuser, and is
+ normally used only when a new session is being created on behalf of the
+ named user (for example, at login time, or when a remote shell is
+ invoked).
+
+ _\bN_\bO_\bT_\bE: There is only one login name per session.
+
+ It is _\bC_\bR_\bI_\bT_\bI_\bC_\bA_\bL_\bL_\bY important to ensure that s\bse\bet\btl\blo\bog\bgi\bin\bn() is only ever called
+ after the process has taken adequate steps to ensure that it is detached
+ from its parent's session. The _\bO_\bN_\bL_\bY way to do this is via the s\bse\bet\bts\bsi\bid\bd()
+ function. The d\bda\bae\bem\bmo\bon\bn() function calls s\bse\bet\bts\bsi\bid\bd() which is an ideal way of
+ detaching from a controlling terminal and forking into the background.
+
+ In particular, neither i\bio\boc\bct\btl\bl(_\bt_\bt_\by_\bf_\bd, _\bT_\bI_\bO_\bC_\bN_\bO_\bT_\bT_\bY, _\b._\b._\b.) nor s\bse\bet\btp\bpg\bgr\brp\bp(_\b._\b._\b.) is
+ sufficient to create a new session.
+
+ Once a parent process has called s\bse\bet\bts\bsi\bid\bd(), it is acceptable for some
+ child of that process to then call s\bse\bet\btl\blo\bog\bgi\bin\bn(), even though it is not the
+ session leader. Beware, however, that _\bA_\bL_\bL processes in the session will
+ change their login name at the same time, even the parent.
+
+ This is different from traditional UNIX privilege inheritance and as such
+ can be counter-intuitive.
+
+ Since the s\bse\bet\btl\blo\bog\bgi\bin\bn() routine is restricted to the super-user, it is
+ assumed that (like all other privileged programs) the programmer has
+ taken adequate precautions to prevent security violations.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn() succeeds, it returns a pointer to a NUL-
+ terminated string in a static buffer. If the name has not been set, it
+ returns NULL. If a call to g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() succeeds, a value of 0 is
+ returned, else the error number is returned. If a call to s\bse\bet\btl\blo\bog\bgi\bin\bn()
+ succeeds, a value of 0 is returned. If s\bse\bet\btl\blo\bog\bgi\bin\bn() fails, a value of -1
+ is returned and an error code is placed in the global location _\be_\br_\br_\bn_\bo.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() and s\bse\bet\btl\blo\bog\bgi\bin\bn() will succeed unless:
+
+ [EFAULT] The _\bn_\ba_\bm_\be parameter points to an invalid address.
+
+ In addition, g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() may return the following error:
+
+ [ERANGE] The value of _\bn_\ba_\bm_\be_\bl_\be_\bn is not large enough to store the
+ user's login name and a trailing NUL.
+
+ s\bse\bet\btl\blo\bog\bgi\bin\bn() may return the following errors:
+
+ [EINVAL] The _\bn_\ba_\bm_\be parameter pointed to a string that was too
+ long. Login names are limited to LOGIN_NAME_MAX-1
+ characters, currently 31.
+
+ [EPERM] The caller tried to set the login name and was not the
+ superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ setsid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() and g\bge\bet\btl\blo\bog\bgi\bin\bn_\b_r\br() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btl\blo\bog\bgi\bin\bn() function first appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ In earlier versions of the system, g\bge\bet\btl\blo\bog\bgi\bin\bn() failed unless the process
+ was associated with a login terminal. The current implementation (using
+ s\bse\bet\btl\blo\bog\bgi\bin\bn()) allows getlogin to succeed even when the process has no
+ controlling terminal. In earlier versions of the system, the value
+ returned by g\bge\bet\btl\blo\bog\bgi\bin\bn() could not be trusted without checking the user ID.
+ Portable programs should probably still make this check.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btp\bpg\bgi\bid\bd, s\bse\bet\btp\bpg\bgr\brp\bp - set process group
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpg\bgi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bp_\bi_\bd_\b__\bt _\bp_\bg_\br_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpg\bgr\brp\bp(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bp_\bi_\bd_\b__\bt _\bp_\bg_\br_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bet\btp\bpg\bgi\bid\bd() sets the process group of the specified process _\bp_\bi_\bd to the
+ specified _\bp_\bg_\br_\bp. If _\bp_\bi_\bd is zero, then the call applies to the current
+ process. If _\bp_\bg_\br_\bp is zero, the process ID of the specified process is
+ used.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btp\bpg\bgi\bid\bd() will fail and the process group will not be altered if:
+
+ [EACCES] The value of the _\bp_\bi_\bd argument matches the process ID
+ of a child process of the calling process, and the
+ child process has successfully executed one of the
+ exec functions.
+
+ [EINVAL] The value of the _\bp_\bg_\br_\bp argument is less than zero.
+
+ [EPERM] The requested process is a descendant of the calling
+ process, and is either a session leader or not in the
+ same session as the calling process.
+
+ [EPERM] The value of the _\bp_\bg_\br_\bp argument is neither the PID of
+ the process indicated by the _\bp_\bi_\bd argument nor the
+ process group ID of an existing process group in the
+ same session as the calling process.
+
+ [ESRCH] The value of the _\bp_\bi_\bd argument does not match the
+ process ID of the calling process or of a descendant
+ of the calling process.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getpgrp(2), setsid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ s\bse\bet\btp\bpg\bgr\brp\bp() is identical to s\bse\bet\btp\bpg\bgi\bid\bd(), and is retained for calling
+ convention compatibility with historical versions of BSD.
+
+ The s\bse\bet\btp\bpg\bgi\bid\bd() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btp\bpg\bgi\bid\bd, s\bse\bet\btp\bpg\bgr\brp\bp - set process group
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpg\bgi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bp_\bi_\bd_\b__\bt _\bp_\bg_\br_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpg\bgr\brp\bp(_\bp_\bi_\bd_\b__\bt _\bp_\bi_\bd, _\bp_\bi_\bd_\b__\bt _\bp_\bg_\br_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bse\bet\btp\bpg\bgi\bid\bd() sets the process group of the specified process _\bp_\bi_\bd to the
+ specified _\bp_\bg_\br_\bp. If _\bp_\bi_\bd is zero, then the call applies to the current
+ process. If _\bp_\bg_\br_\bp is zero, the process ID of the specified process is
+ used.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btp\bpg\bgi\bid\bd() will fail and the process group will not be altered if:
+
+ [EACCES] The value of the _\bp_\bi_\bd argument matches the process ID
+ of a child process of the calling process, and the
+ child process has successfully executed one of the
+ exec functions.
+
+ [EINVAL] The value of the _\bp_\bg_\br_\bp argument is less than zero.
+
+ [EPERM] The requested process is a descendant of the calling
+ process, and is either a session leader or not in the
+ same session as the calling process.
+
+ [EPERM] The value of the _\bp_\bg_\br_\bp argument is neither the PID of
+ the process indicated by the _\bp_\bi_\bd argument nor the
+ process group ID of an existing process group in the
+ same session as the calling process.
+
+ [ESRCH] The value of the _\bp_\bi_\bd argument does not match the
+ process ID of the calling process or of a descendant
+ of the calling process.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getpgrp(2), setsid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ s\bse\bet\btp\bpg\bgr\brp\bp() is identical to s\bse\bet\btp\bpg\bgi\bid\bd(), and is retained for calling
+ convention compatibility with historical versions of BSD.
+
+ The s\bse\bet\btp\bpg\bgi\bid\bd() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by, s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by - get/set process scheduling priority
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bi_\bd_\b__\bt _\bw_\bh_\bo);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by(_\bi_\bn_\bt _\bw_\bh_\bi_\bc_\bh, _\bi_\bd_\b__\bt _\bw_\bh_\bo, _\bi_\bn_\bt _\bp_\br_\bi_\bo);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The scheduling priority of the process, process group, or user, as
+ indicated by _\bw_\bh_\bi_\bc_\bh and _\bw_\bh_\bo is obtained with the g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call and
+ set with the s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call. _\bw_\bh_\bi_\bc_\bh is one of PRIO_PROCESS,
+ PRIO_PGRP, or PRIO_USER, and _\bw_\bh_\bo is interpreted relative to _\bw_\bh_\bi_\bc_\bh (a
+ process identifier for PRIO_PROCESS, process group identifier for
+ PRIO_PGRP, and a user ID for PRIO_USER). A zero value of _\bw_\bh_\bo denotes the
+ current process, process group, or user. _\bp_\br_\bi_\bo is a value in the range
+ -20 to 20. The default priority is 0; lower priorities cause more
+ favorable scheduling.
+
+ The g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call returns the highest priority (lowest numerical
+ value) enjoyed by any of the specified processes. The s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call
+ sets the priorities of all of the specified processes to the specified
+ value. Priority values outside the range -20 to 20 are truncated to the
+ appropriate limit. Only the superuser may lower priorities.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Since g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() can legitimately return the value -1, it is necessary
+ to clear the external variable _\be_\br_\br_\bn_\bo prior to the call, then check it
+ afterward to determine if a -1 is an error or a legitimate value. The
+ s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() call returns 0 if there is no error, or -1 if there is.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() will fail if:
+
+ [ESRCH] No process was located using the _\bw_\bh_\bi_\bc_\bh and _\bw_\bh_\bo values
+ specified.
+
+ [EINVAL] _\bw_\bh_\bi_\bc_\bh was not one of PRIO_PROCESS, PRIO_PGRP, or
+ PRIO_USER.
+
+ In addition, s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() will fail if:
+
+ [EPERM] A process was located, but neither its effective nor
+ real user ID matched the effective user ID of the
+ caller.
+
+ [EACCES] A non-superuser attempted to lower a process priority.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ nice(1), fork(2), renice(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former n\bni\bic\bce\be() system call,
+ appeared in Version 3 AT&T UNIX and was removed in 4.3BSD-Reno. The
+ g\bge\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() and s\bse\bet\btp\bpr\bri\bio\bor\bri\bit\bty\by() system calls appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btr\bre\beg\bgi\bid\bd - set real and effective group IDs
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The real and effective group IDs of the current process are set according
+ to the arguments. The saved group ID will be set to the new value of the
+ real group ID if a real group ID is specified and either the new real
+ group ID value is different from the current value or the new value of
+ the effective group ID differs from the current saved group ID.
+
+ Unprivileged users may change either group ID to the current value of the
+ real, effective, or saved group ID. Only the superuser may make other
+ changes.
+
+ Supplying a value of -1 for either the real or effective group ID forces
+ the system to substitute the current ID in place of the -1 parameter.
+
+ The s\bse\bet\btr\bre\beg\bgi\bid\bd() function was intended to allow swapping the real and
+ effective group IDs in set-group-ID programs to temporarily relinquish
+ the set-group-ID value. This purpose is now better served by the use of
+ the setegid(2) function.
+
+ When setting the real and effective group IDs to the same value, the
+ setgid(2) function is preferred.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The current process is not the superuser and a change
+ other than changing the effective group ID to the real
+ group ID was specified.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), setegid(2), setgid(2), setresgid(2), setreuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btr\bre\beg\bgi\bid\bd() function conforms to the IEEE Std 1003.1-2008
+ (``POSIX.1'') specification, except that the conditions for changing the
+ saved group ID differ and that, if it is changed, the saved group ID is
+ set to the real group ID instead of the effective group ID.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btr\bre\beg\bgi\bid\bd() system call first appeared in 4.1cBSD, predating POSIX. A
+ semantically different version appeared in 4.4BSD. The current version,
+ with the original semantics restored, appeared in OpenBSD 3.3.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd, g\bge\bet\btr\bre\bes\bsu\bui\bid\bd, s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd, s\bse\bet\btr\bre\bes\bsu\bui\bid\bd - get or set real, effective
+ and saved user or group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\b*_\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\b*_\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\bs_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\bs_\bu_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btr\bre\bes\bsu\bui\bid\bd() function sets the real, effective and saved user IDs of
+ the current process. The analogous s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd() sets the real, effective
+ and saved group IDs.
+
+ Privileged processes may set these IDs to arbitrary values. Unprivileged
+ processes are restricted in that each of the new IDs must match one of
+ the current IDs.
+
+ Passing -1 as an argument causes the corresponding value to remain
+ unchanged.
+
+ The g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() and g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() calls retrieve the real, effective, and
+ saved group and user IDs of the current process, respectively.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The calling process was not privileged and tried to
+ change one or more IDs to a value which was not the
+ current real ID, the current effective ID nor the
+ current saved ID.
+
+ [EFAULT] An address passed to g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() or g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() was
+ invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getegid(2), geteuid(2), getgid(2), getuid(2), issetugid(2), setgid(2),
+ setregid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ These functions are not part of the IEEE Std 1003.1 (``POSIX.1'')
+ specification. While they are not completely portable, they are the
+ least ambiguous way to manage user and group IDs.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions first appeared in HP-UX.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd, g\bge\bet\btr\bre\bes\bsu\bui\bid\bd, s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd, s\bse\bet\btr\bre\bes\bsu\bui\bid\bd - get or set real, effective
+ and saved user or group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\b*_\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\b*_\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\b*_\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\b*_\bs_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\br_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd, _\bg_\bi_\bd_\b__\bt _\bs_\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\bes\bsu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\bs_\bu_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btr\bre\bes\bsu\bui\bid\bd() function sets the real, effective and saved user IDs of
+ the current process. The analogous s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd() sets the real, effective
+ and saved group IDs.
+
+ Privileged processes may set these IDs to arbitrary values. Unprivileged
+ processes are restricted in that each of the new IDs must match one of
+ the current IDs.
+
+ Passing -1 as an argument causes the corresponding value to remain
+ unchanged.
+
+ The g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() and g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() calls retrieve the real, effective, and
+ saved group and user IDs of the current process, respectively.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The calling process was not privileged and tried to
+ change one or more IDs to a value which was not the
+ current real ID, the current effective ID nor the
+ current saved ID.
+
+ [EFAULT] An address passed to g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd() or g\bge\bet\btr\bre\bes\bsu\bui\bid\bd() was
+ invalid.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getegid(2), geteuid(2), getgid(2), getuid(2), issetugid(2), setgid(2),
+ setregid(2), setreuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ These functions are not part of the IEEE Std 1003.1 (``POSIX.1'')
+ specification. While they are not completely portable, they are the
+ least ambiguous way to manage user and group IDs.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ These functions first appeared in HP-UX.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btr\bre\beu\bui\bid\bd - set real and effective user IDs
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\bre\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\br_\bu_\bi_\bd, _\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The real and effective user IDs of the current process are set according
+ to the arguments. The saved user ID will be set to the new value of the
+ real user ID if a real user ID is specified and either the new real user
+ ID value is different from the current value or the new value of the
+ effective user ID differs from the current saved user ID.
+
+ Unprivileged users may change either user ID to the current value of the
+ real, effective, or saved user ID. Only the superuser may make other
+ changes.
+
+ Supplying a value of -1 for either the real or effective user ID forces
+ the system to substitute the current ID in place of the -1 parameter.
+
+ The s\bse\bet\btr\bre\beu\bui\bid\bd() function was intended to allow swapping the real and
+ effective user IDs in set-user-ID programs to temporarily relinquish the
+ set-user-ID value. This purpose is now better served by the use of the
+ seteuid(2) function.
+
+ When setting the real and effective user IDs to the same value, the
+ setuid(2) function is preferred.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EPERM] The current process is not the superuser and a change
+ other than changing the effective user ID to the real
+ user ID was specified.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getuid(2), seteuid(2), setregid(2), setresuid(2), setuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btr\bre\beu\bui\bid\bd() function conforms to the IEEE Std 1003.1-2008
+ (``POSIX.1'') specification, except that the conditions for changing the
+ saved user ID differ and that, if it is changed, the saved user ID is set
+ to the real user ID instead of the effective user ID.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btr\bre\beu\bui\bid\bd() system call first appeared in 4.1cBSD, predating POSIX. A
+ semantically different version appeared in 4.4BSD. The current version,
+ with the original semantics restored, appeared in OpenBSD 3.3.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt, s\bse\bet\btr\brl\bli\bim\bmi\bit\bt - control maximum system resource consumption
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt(_\bi_\bn_\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bl_\bi_\bm_\bi_\bt _\b*_\br_\bl_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\brl\bli\bim\bmi\bit\bt(_\bi_\bn_\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\br_\bl_\bi_\bm_\bi_\bt _\b*_\br_\bl_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ Limits on the consumption of system resources by the current process and
+ each process it creates may be obtained with the g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() call, and
+ set with the s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() call.
+
+ The _\br_\be_\bs_\bo_\bu_\br_\bc_\be parameter is one of the following:
+
+ RLIMIT_CORE The largest size (in bytes) _\bc_\bo_\br_\be file that may be
+ created.
+
+ RLIMIT_CPU The maximum amount of CPU time (in seconds) to be used by
+ each process.
+
+ RLIMIT_DATA The maximum size (in bytes) of the data segment for a
+ process; this includes memory allocated via malloc(3) and
+ all other anonymous memory mapped via mmap(2).
+
+ RLIMIT_FSIZE The largest size (in bytes) file that may be created.
+
+ RLIMIT_MEMLOCK The maximum size (in bytes) which a process may lock into
+ memory using the mlock(2) function.
+
+ RLIMIT_NOFILE The maximum number of open files for this process.
+
+ RLIMIT_NPROC The maximum number of simultaneous processes for this
+ user id.
+
+ RLIMIT_RSS The maximum size (in bytes) to which a process's resident
+ set size may grow. This imposes a limit on the amount of
+ physical memory to be given to a process; if memory is
+ tight, the system will prefer to take memory from
+ processes that are exceeding their declared resident set
+ size.
+
+ RLIMIT_STACK The maximum size (in bytes) of the stack segment for a
+ process, which defines how far a process's stack segment
+ may be extended. Stack extension is performed
+ automatically by the system, and is only used by the main
+ thread of a process.
+
+ A resource limit is specified as a soft limit and a hard limit. When a
+ soft limit is exceeded a process may receive a signal (for example, if
+ the CPU time or file size is exceeded), but it will be allowed to
+ continue execution until it reaches the hard limit (or modifies its
+ resource limit). The _\br_\bl_\bi_\bm_\bi_\bt structure is used to specify the hard and
+ soft limits on a resource,
+
+ struct rlimit {
+ rlim_t rlim_cur; /* current (soft) limit */
+ rlim_t rlim_max; /* hard limit */
+ };
+
+ Only the superuser may raise the maximum limits. Other users may only
+ alter _\br_\bl_\bi_\bm_\b__\bc_\bu_\br within the range from 0 to _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx or (irreversibly)
+ lower _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx.
+
+ An ``infinite'' value for a limit is defined as RLIM_INFINITY.
+
+ A value of RLIM_SAVED_CUR or RLIM_SAVED_MAX will be stored in _\br_\bl_\bi_\bm_\b__\bc_\bu_\br or
+ _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx respectively by g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() if the value for the current or
+ maximum resource limit cannot be stored in an rlim_t. The values
+ RLIM_SAVED_CUR and RLIM_SAVED_MAX should not be used in a call to
+ s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() unless they were returned by a previous call to g\bge\bet\btr\brl\bli\bim\bmi\bit\bt().
+
+ Because this information is stored in the per-process information, this
+ system call must be executed directly by the shell if it is to affect all
+ future processes created by the shell; l\bli\bim\bmi\bit\bt is thus a built-in command
+ to csh(1) and u\bul\bli\bim\bmi\bit\bt is the sh(1) equivalent.
+
+ The system refuses to extend the data or stack space when the limits
+ would be exceeded in the normal way: a brk(2) call fails if the data
+ space limit is reached. When the stack limit is reached, the process
+ receives a segmentation fault (SIGSEGV); if this signal is not caught by
+ a handler using the signal stack, this signal will kill the process.
+
+ A file I/O operation that would create a file larger than the process'
+ soft limit will cause the write to fail and a signal SIGXFSZ to be
+ generated; this normally terminates the process, but may be caught. When
+ the soft CPU time limit is exceeded, a signal SIGXCPU is sent to the
+ offending process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() will fail if:
+
+ [EFAULT] The address specified for _\br_\bl_\bp is invalid.
+
+ [EINVAL] An unrecognized value for _\br_\be_\bs_\bo_\bu_\br_\bc_\be was specified.
+
+ In addition, s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() may return the following errors:
+
+ [EINVAL] The new _\br_\bl_\bi_\bm_\b__\bc_\bu_\br is greater than the new _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx.
+
+ [EPERM] The new _\br_\bl_\bi_\bm_\b__\bm_\ba_\bx is greater than the current maximum
+ limit value, and the caller is not the superuser.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ csh(1), sh(1), quotactl(2), sigaction(2), sigaltstack(2), sysctl(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ The RLIMIT_MEMLOCK, RLIMIT_NPROC, and RLIMIT_RSS resources are non-
+ standard extensions.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btr\brl\bli\bim\bmi\bit\bt() and s\bse\bet\btr\brl\bli\bim\bmi\bit\bt() system calls first appeared in 4.1cBSD.
+
+B\bBU\bUG\bGS\bS
+ The RLIMIT_AS resource is missing.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be, s\bse\bet\btr\brt\bta\bab\bbl\ble\be - get and set the default routing table of the
+ current process
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be(_\bv_\bo_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btr\brt\bta\bab\bbl\ble\be(_\bi_\bn_\bt _\br_\bt_\ba_\bb_\bl_\be_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be() and s\bse\bet\btr\brt\bta\bab\bbl\ble\be() manipulate the routing table and routing
+ domain associated with the current process.
+
+ Only the superuser is allowed to change the process routing table if it
+ is already set to a non-zero value.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ g\bge\bet\btr\brt\bta\bab\bbl\ble\be() returns the routing table of the current process. Upon
+ successful completion, s\bse\bet\btr\brt\bta\bab\bbl\ble\be() returns 0 if the call succeeds, -1 if
+ it fails.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The call succeeds unless:
+
+ [EINVAL] The value of the _\br_\bt_\ba_\bb_\bl_\be_\bi_\bd argument is not a valid
+ routing table.
+
+ [EPERM] The user is not the superuser and the routing table of
+ the calling process is already set to a non-zero
+ value.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getsockopt(2), route(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\btr\brt\bta\bab\bbl\ble\be() and s\bse\bet\btr\brt\bta\bab\bbl\ble\be() system calls appeared in OpenBSD 4.8.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\bts\bsi\bid\bd - create session and set process group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ s\bse\bet\bts\bsi\bid\bd(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\bts\bsi\bid\bd function creates a new session. The calling process is the
+ session leader of the new session, is the process group leader of a new
+ process group and has no controlling terminal. The calling process is
+ the only process in either the session or the process group.
+
+ Upon successful completion, the s\bse\bet\bts\bsi\bid\bd function returns the value of the
+ process group ID of the new process group, which is the same as the
+ process ID of the calling process.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ If an error occurs, s\bse\bet\bts\bsi\bid\bd returns -1 and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error, as follows:
+
+ [EPERM] The calling process is already a process group leader,
+ or the process group ID of a process other than the
+ calling process matches the process ID of the calling
+ process.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getsid(2), setpgid(2), tcgetpgrp(3), tcsetpgrp(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\bts\bsi\bid\bd function is expected to be compliant with the IEEE Std
+ 1003.1-2008 (``POSIX.1'') specification.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt, s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt - get and set options on sockets
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bl_\be_\bv_\be_\bl, _\bi_\bn_\bt _\bo_\bp_\bt_\bn_\ba_\bm_\be, _\bv_\bo_\bi_\bd _\b*_\bo_\bp_\bt_\bv_\ba_\bl,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\b*_\bo_\bp_\bt_\bl_\be_\bn);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bl_\be_\bv_\be_\bl, _\bi_\bn_\bt _\bo_\bp_\bt_\bn_\ba_\bm_\be, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bo_\bp_\bt_\bv_\ba_\bl,
+ _\bs_\bo_\bc_\bk_\bl_\be_\bn_\b__\bt _\bo_\bp_\bt_\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() manipulate the _\bo_\bp_\bt_\bi_\bo_\bn_\bs associated with a
+ socket. Options may exist at multiple protocol levels; they are always
+ present at the uppermost ``socket'' level.
+
+ When manipulating socket options the level at which the option resides
+ and the name of the option must be specified. To manipulate options at
+ the socket level, _\bl_\be_\bv_\be_\bl is specified as SOL_SOCKET. To manipulate
+ options at any other level the protocol number of the appropriate
+ protocol controlling the option is supplied. For example, to indicate
+ that an option is to be interpreted by the TCP protocol, _\bl_\be_\bv_\be_\bl should be
+ set to the protocol number of TCP; see getprotoent(3).
+
+ The parameters _\bo_\bp_\bt_\bv_\ba_\bl and _\bo_\bp_\bt_\bl_\be_\bn are used to access option values for
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(). For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() they identify a buffer in which the value
+ for the requested option(s) are to be returned. For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), _\bo_\bp_\bt_\bl_\be_\bn
+ is a value-result parameter, initially containing the size of the buffer
+ pointed to by _\bo_\bp_\bt_\bv_\ba_\bl, and modified on return to indicate the actual size
+ of the value returned. If no option value is to be supplied or returned,
+ _\bo_\bp_\bt_\bv_\ba_\bl may be NULL.
+
+ _\bo_\bp_\bt_\bn_\ba_\bm_\be and any specified options are passed uninterpreted to the
+ appropriate protocol module for interpretation. The include file
+ <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh> contains definitions for socket level options, described
+ below. Options at other protocol levels vary in format and name; consult
+ the appropriate entries in section 4 of the manual.
+
+ Most socket-level options utilize an int parameter for _\bo_\bp_\bt_\bv_\ba_\bl. For
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), the parameter should be non-zero to enable a boolean
+ option, or zero if the option is to be disabled. SO_LINGER uses a struct
+ linger parameter, defined in <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>, which specifies the desired
+ state of the option and the linger interval (see below). SO_SNDTIMEO and
+ SO_RCVTIMEO use a struct timeval parameter, defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh>.
+
+ The following options are recognized at the socket level. Except as
+ noted, each may be examined with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and set with s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt().
+
+ SO_DEBUG enables recording of debugging information
+ SO_REUSEADDR enables local address reuse
+ SO_REUSEPORT enables duplicate address and port bindings
+ SO_KEEPALIVE enables keep connections alive
+ SO_DONTROUTE enables routing bypass; not supported
+ SO_LINGER linger on close if data present
+ SO_BROADCAST enables permission to transmit broadcast messages
+ SO_OOBINLINE enables reception of out-of-band data in band
+ SO_BINDANY enables binding to any address
+ SO_SNDBUF set buffer size for output
+ SO_RCVBUF set buffer size for input
+ SO_SNDLOWAT set minimum count for output
+ SO_RCVLOWAT set minimum count for input
+ SO_SNDTIMEO set timeout value for output
+ SO_RCVTIMEO set timeout value for input
+ SO_TIMESTAMP enables reception of a timestamp with datagrams
+ SO_PEERCRED get the credentials from other side of connection
+ SO_RTABLE set the routing table used for route lookups
+ SO_SPLICE splice two sockets together or get data length
+ SO_TYPE get the type of the socket (get only)
+ SO_ERROR get and clear error on the socket (get only)
+
+ SO_DEBUG enables debugging in the underlying protocol modules.
+ SO_REUSEADDR indicates that the rules used in validating addresses
+ supplied in a bind(2) call should allow reuse of local addresses.
+ SO_REUSEPORT allows completely duplicate bindings by multiple processes
+ if they all set SO_REUSEPORT before binding the port. This option
+ permits multiple instances of a program to each receive UDP/IP multicast
+ or broadcast datagrams destined for the bound port. SO_KEEPALIVE enables
+ the periodic transmission of messages on a connected socket. Should the
+ connected party fail to respond to these messages, the connection is
+ considered broken and processes using the socket are notified via a
+ SIGPIPE signal when attempting to send data.
+
+ SO_LINGER controls the action taken when unsent messages are queued on
+ socket and a close(2) is performed. If the socket promises reliable
+ delivery of data and SO_LINGER is set, the system will block the process
+ on the close(2) attempt until it is able to transmit the data or until it
+ decides it is unable to deliver the information (a timeout period
+ measured in seconds, termed the linger interval, is specified in the
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() call when SO_LINGER is requested). If SO_LINGER is disabled
+ and a close(2) is issued, the system will process the close in a manner
+ that allows the process to continue as quickly as possible.
+
+ The option SO_BROADCAST requests permission to send broadcast datagrams
+ on the socket. Broadcast was a privileged operation in earlier versions
+ of the system. With protocols that support out-of-band data, the
+ SO_OOBINLINE option requests that out-of-band data be placed in the
+ normal data input queue as received; it will then be accessible with
+ recv(2) or read(2) calls without the MSG_OOB flag. Some protocols always
+ behave as if this option is set.
+
+ SO_BINDANY allows the socket to be bound to addresses which are not local
+ to the machine, so it can be used to make a transparent proxy. Note that
+ this option is limited to the super-user. In order to receive packets
+ for these addresses, SO_BINDANY needs to be combined with matching
+ outgoing pf(4) rules with the _\bd_\bi_\bv_\be_\br_\bt_\b-_\br_\be_\bp_\bl_\by parameter. For example, with
+ the following rule the socket receives packets for 192.168.0.10 even if
+ it is not a local address:
+
+ pass out inet from 192.168.0.10 divert-reply
+
+ SO_SNDBUF and SO_RCVBUF are options to adjust the normal buffer sizes
+ allocated for output and input buffers, respectively. The buffer size
+ may be increased for high-volume connections, or may be decreased to
+ limit the possible backlog of incoming data. The system places an
+ absolute limit on these values.
+
+ SO_SNDLOWAT is an option to set the minimum count for output operations.
+ Most output operations process all of the data supplied by the call,
+ delivering data to the protocol for transmission and blocking as
+ necessary for flow control. Nonblocking output operations will process
+ as much data as permitted subject to flow control without blocking, but
+ will process no data if flow control does not allow the smaller of the
+ low water mark value or the entire request to be processed. A select(2)
+ or poll(2) operation testing the ability to write to a socket will return
+ true only if the low water mark amount could be processed. The default
+ value for SO_SNDLOWAT is set to a convenient size for network efficiency,
+ often 1024. SO_RCVLOWAT is an option to set the minimum count for input
+ operations. In general, receive calls will block until any (non-zero)
+ amount of data is received, then return with the smaller of the amount
+ available or the amount requested. The default value for SO_RCVLOWAT is
+ 1. If SO_RCVLOWAT is set to a larger value, blocking receive calls
+ normally wait until they have received the smaller of the low water mark
+ value or the requested amount. Receive calls may still return less than
+ the low water mark if an error occurs, a signal is caught, or the type of
+ data next in the receive queue is different than that returned.
+
+ SO_SNDTIMEO is an option to set a timeout value for output operations.
+ It accepts a struct timeval parameter with the number of seconds and
+ microseconds used to limit waits for output operations to complete. If a
+ send operation has blocked for this much time, it returns with a partial
+ count or with the error EWOULDBLOCK if no data was sent. In the current
+ implementation, this timer is restarted each time additional data are
+ delivered to the protocol, implying that the limit applies to output
+ portions ranging in size from the low water mark to the high water mark
+ for output. SO_RCVTIMEO is an option to set a timeout value for input
+ operations. It accepts a struct timeval parameter with the number of
+ seconds and microseconds used to limit waits for input operations to
+ complete. In the current implementation, this timer is restarted each
+ time additional data are received by the protocol, and thus the limit is
+ in effect an inactivity timer. If a receive operation has been blocked
+ for this much time without receiving additional data, it returns with a
+ short count or with the error EWOULDBLOCK if no data were received.
+
+ If the SO_TIMESTAMP option is enabled on a SOCK_DGRAM socket, the
+ recvmsg(2) call will return a timestamp corresponding to when the
+ datagram was received. The msg_control field in the msghdr structure
+ points to a buffer that contains a cmsghdr structure followed by a struct
+ timeval. The cmsghdr fields have the following values:
+
+ cmsg_len = CMSG_LEN(sizeof(struct timeval))
+ cmsg_level = SOL_SOCKET
+ cmsg_type = SCM_TIMESTAMP
+
+ SO_PEERCRED fetches the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bo_\bc_\bk_\bp_\be_\be_\br_\bc_\br_\be_\bd credentials from the other
+ side of the connection (currently only possible on AF_UNIX sockets).
+ These credentials are from the time that bind(2) or connect(2) were
+ called.
+
+ The SO_RTABLE option gets or sets the routing table which will be used by
+ the socket for address lookups. If a protocol family of the socket
+ doesn't support switching routing tables, the ENOPROTOOPT error is
+ returned. Only the superuser is allowed to change the routing table if
+ it is already set to a non-zero value. A socket's chosen routing table
+ is initialized from the process's configuration, previously selected
+ using setrtable(2).
+
+ SO_SPLICE can splice together two TCP or UDP sockets for zero-copy data
+ transfers. Both sockets must be of the same type. In the first form,
+ s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() is called with the source socket _\bs and the drain socket's
+ _\bi_\bn_\bt file descriptor as _\bo_\bp_\bt_\bv_\ba_\bl. In the second form, _\bo_\bp_\bt_\bv_\ba_\bl is a _\bs_\bt_\br_\bu_\bc_\bt
+ _\bs_\bp_\bl_\bi_\bc_\be with the drain socket in _\bs_\bp_\b__\bf_\bd, a positive maximum number of bytes
+ or 0 in _\bs_\bp_\b__\bm_\ba_\bx and an idle timeout _\bs_\bp_\b__\bi_\bd_\bl_\be in the form of a _\bs_\bt_\br_\bu_\bc_\bt
+ _\bt_\bi_\bm_\be_\bv_\ba_\bl. If -1 is given as drain socket, the source socket _\bs gets
+ unspliced. Otherwise the spliced data transfer continues within the
+ kernel until the optional maximum is reached, one of the connections
+ terminates, idle timeout expires or an error occurs. A successful
+ select(2), poll(2), or kqueue(2) operation testing the ability to read
+ from the source socket indicates that the splicing has terminated. The
+ error status can be examined with SO_ERROR at the source socket. The
+ ETIMEDOUT error is set if there was no data transferred between two
+ sockets during the _\bs_\bp_\b__\bi_\bd_\bl_\be period of time. The EFBIG error is set after
+ exactly _\bs_\bp_\b__\bm_\ba_\bx bytes have been transferred. Note that if a maximum is
+ given, it is only guaranteed that no more bytes are transferred. A short
+ splice can happen, but then a second call to splice will transfer the
+ remaining data immediately. The SO_SPLICE option with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and
+ an _\bo_\bf_\bf_\b__\bt value as _\bo_\bp_\bt_\bv_\ba_\bl can be used to retrieve the number of bytes
+ transferred so far from the source socket _\bs. A successful new splice
+ resets this number.
+
+ Finally, SO_TYPE and SO_ERROR are options used only with g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt().
+ SO_TYPE returns the type of the socket, such as SOCK_STREAM; it is useful
+ for servers that inherit sockets on startup. SO_ERROR returns any
+ pending error on the socket and clears the error status. It may be used
+ to check for asynchronous errors on connected datagram sockets or for
+ other asynchronous errors.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The call succeeds unless:
+
+ [EBADF] The argument _\bs is not a valid descriptor.
+
+ [ENOTSOCK] The argument _\bs is a file, not a socket.
+
+ [ENOPROTOOPT] The option is unknown at the level indicated.
+
+ [EOPNOTSUPP] The option is unsupported.
+
+ [EFAULT] The address pointed to by _\bo_\bp_\bt_\bv_\ba_\bl is not in a valid
+ part of the process address space. For g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(),
+ this error may also be returned if _\bo_\bp_\bt_\bl_\be_\bn is not in a
+ valid part of the process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), getrtable(2), ioctl(2), poll(2), select(2), socket(2),
+ getprotoent(3), divert(4), pf.conf(5), protocols(5), sosplice(9)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() and s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt() system call appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ Several of the socket options should be handled at lower levels of the
+ system.
+
+N\bNA\bAM\bME\bE
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by, s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by - get/set date and time
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by(_\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be _\b*_\bt_\bz_\bp);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bp, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be _\b*_\bt_\bz_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ N\bNo\bot\bte\be:\b: t\bti\bim\bme\bez\bzo\bon\bne\be i\bis\bs n\bno\bo l\blo\bon\bng\bge\ber\br u\bus\bse\bed\bd;\b; t\bth\bhi\bis\bs i\bin\bnf\bfo\bor\brm\bma\bat\bti\bio\bon\bn i\bis\bs k\bke\bep\bpt\bt o\bou\but\bts\bsi\bid\bde\be t\bth\bhe\be
+ k\bke\ber\brn\bne\bel\bl.\b.
+
+ The system's notion of the current Greenwich time and the current time
+ zone is obtained with the g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() call, and set with the
+ s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() call. The time is expressed in seconds and microseconds
+ since midnight (0 hour), January 1, 1970. The resolution of the system
+ clock is hardware dependent, and the time may be updated continuously or
+ in ``ticks''. If _\bt_\bp or _\bt_\bz_\bp is NULL, the associated time information will
+ not be returned or set.
+
+ The structures pointed to by _\bt_\bp and _\bt_\bz_\bp are defined in <_\bs_\by_\bs_\b/_\bt_\bi_\bm_\be_\b._\bh> as:
+
+ struct timeval {
+ time_t tv_sec; /* seconds since Jan. 1, 1970 */
+ suseconds_t tv_usec; /* and microseconds */
+ };
+
+ struct timezone {
+ int tz_minuteswest; /* of Greenwich */
+ int tz_dsttime; /* type of dst correction to apply */
+ };
+
+ The _\bt_\bi_\bm_\be_\bz_\bo_\bn_\be structure indicates the local time zone (measured in minutes
+ of time westward from Greenwich), and a flag that, if nonzero, indicates
+ that Daylight Saving time applies locally during the appropriate part of
+ the year.
+
+ Only the superuser may set the time of day or time zone. If the system
+ securelevel is greater than 1 (see init(8)), the time may only be
+ advanced. This limitation is imposed to prevent a malicious superuser
+ from setting arbitrary time stamps on files. The system time can still
+ be adjusted backwards using the adjtime(2) system call even when the
+ system is secure.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() and s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() will succeed unless:
+
+ [EFAULT] An argument address referenced invalid memory.
+
+ In addition, s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() may return the following error:
+
+ [EPERM] A user other than the superuser attempted to set the
+ time.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ date(1), adjtime(2), clock_gettime(2), getitimer(2), ctime(3), time(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() function conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ As predecessors of these functions, former system calls t\bti\bim\bme\be() and
+ s\bst\bti\bim\bme\be() first appeared in Version 1 AT&T UNIX, and f\bft\bti\bim\bme\be() first appeared
+ in Version 7 AT&T UNIX. The g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() and s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() system
+ calls first appeared in 4.1cBSD.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Setting the time with s\bse\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() is dangerous; if possible use
+ adjtime(2) instead. Many daemon programming techniques utilize time-
+ delta techniques using the results from g\bge\bet\btt\bti\bim\bme\beo\bof\bfd\bda\bay\by() instead of from
+ clock_gettime(2) on the CLOCK_MONOTONIC clock. Time jumps can cause
+ these programs to malfunction in unexpected ways. If the time must be
+ set, consider rebooting the machine for safety.
+
+N\bNA\bAM\bME\bE
+ s\bse\bet\btu\bui\bid\bd, s\bse\bet\bte\beu\bui\bid\bd, s\bse\bet\btg\bgi\bid\bd, s\bse\bet\bte\beg\bgi\bid\bd - set user and group ID
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bse\bet\btu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\btg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\bg_\bi_\bd);
+
+ _\bi_\bn_\bt
+ s\bse\bet\bte\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bse\bet\btu\bui\bid\bd() function sets the real and effective user IDs and the saved
+ set-user-ID of the current process to the specified value. The s\bse\bet\btu\bui\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified user ID is the same as the effective user ID. If
+ not, but the specified user ID is the same as the real user ID, s\bse\bet\btu\bui\bid\bd()
+ will set the effective user ID to the real user ID.
+
+ The s\bse\bet\btg\bgi\bid\bd() function sets the real and effective group IDs and the saved
+ set-group-ID of the current process to the specified value. The s\bse\bet\btg\bgi\bid\bd()
+ function is permitted if the effective user ID is that of the superuser,
+ or if the specified group ID is the same as the effective group ID. If
+ not, but the specified group ID is the same as the real group ID,
+ s\bse\bet\btg\bgi\bid\bd() will set the effective group ID to the real group ID.
+ Supplementary group IDs remain unchanged.
+
+ The s\bse\bet\bte\beu\bui\bid\bd() function (s\bse\bet\bte\beg\bgi\bid\bd()) sets the effective user ID (group ID)
+ of the current process. The effective user ID may be set to the value of
+ the real user ID or the saved set-user-ID (see intro(2) and execve(2));
+ in this way, the effective user ID of a set-user-ID executable may be
+ toggled by switching to the real user ID, then re-enabled by reverting to
+ the set-user-ID value. Similarly, the effective group ID may be set to
+ the value of the real group ID or the saved set-group-ID.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions return the
+ value 0 if successful; otherwise the value -1 is returned and the global
+ variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bse\bet\btu\bui\bid\bd() and s\bse\bet\bte\beu\bui\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bu_\bi_\bd or
+ _\be_\bu_\bi_\bd is not the process's real, effective, or saved
+ UID.
+
+ s\bse\bet\btg\bgi\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() will succeed unless:
+
+ [EPERM] The user is not the superuser and the requested _\bg_\bi_\bd or
+ _\be_\bg_\bi_\bd is not the process's real, effective, or saved
+ GID.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ getgid(2), getuid(2), issetugid(2), setgroups(2), setregid(2),
+ setresgid(2), setresuid(2), setreuid(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bse\bet\btu\bui\bid\bd(), s\bse\bet\bte\beu\bui\bid\bd(), s\bse\bet\btg\bgi\bid\bd(), and s\bse\bet\bte\beg\bgi\bid\bd() functions conform to
+ IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bse\bet\btu\bui\bid\bd() system call first appeared in Version 1 AT&T UNIX; s\bse\bet\btg\bgi\bid\bd()
+ in Version 4 AT&T UNIX; and s\bse\bet\bte\beu\bui\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() in 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bsh\bhm\bma\bat\bt, s\bsh\bhm\bmd\bdt\bt - map/unmap shared memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsh\bhm\bm.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd _\b*
+ s\bsh\bhm\bma\bat\bt(_\bi_\bn_\bt _\bs_\bh_\bm_\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bs_\bh_\bm_\ba_\bd_\bd_\br, _\bi_\bn_\bt _\bs_\bh_\bm_\bf_\bl_\bg);
+
+ _\bi_\bn_\bt
+ s\bsh\bhm\bmd\bdt\bt(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bs_\bh_\bm_\ba_\bd_\bd_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsh\bhm\bma\bat\bt() maps the shared memory segment associated with the shared memory
+ identifier _\bs_\bh_\bm_\bi_\bd into the address space of the calling process. The
+ address at which the segment is mapped is determined by the _\bs_\bh_\bm_\ba_\bd_\bd_\br
+ parameter. If it is equal to 0, the system will pick an address itself.
+ Otherwise, an attempt is made to map the shared memory segment at the
+ address _\bs_\bh_\bm_\ba_\bd_\bd_\br specifies. If SHM_RND is set in _\bs_\bh_\bm_\bf_\bl_\bg, the system will
+ round the address down to a multiple of SHMLBA bytes (SHMLBA is defined
+ in <_\bs_\by_\bs_\b/_\bs_\bh_\bm_\b._\bh>).
+
+ A shared memory segment can be mapped read-only by specifying the
+ SHM_RDONLY flag in _\bs_\bh_\bm_\bf_\bl_\bg.
+
+ s\bsh\bhm\bmd\bdt\bt() unmaps the shared memory segment that is currently mapped at
+ _\bs_\bh_\bm_\ba_\bd_\bd_\br from the calling process' address space. _\bs_\bh_\bm_\ba_\bd_\bd_\br must be a value
+ returned by a prior s\bsh\bhm\bma\bat\bt() call. A shared memory segment will remain
+ existent until it is removed by a call to shmctl(2) with the IPC_RMID
+ command.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ s\bsh\bhm\bma\bat\bt() returns the address at which the shared memory segment has been
+ mapped into the calling process' address space when successful, s\bsh\bhm\bmd\bdt\bt()
+ returns 0 on successful completion. Otherwise, a value of -1 is
+ returned, and the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsh\bhm\bma\bat\bt() will fail if:
+
+ [EACCES] The calling process has no permission to access this
+ shared memory segment.
+
+ [ENOMEM] There is not enough available data space for the
+ calling process to map the shared memory segment.
+
+ [EINVAL] _\bs_\bh_\bm_\bi_\bd is not a valid shared memory identifier.
+
+ _\bs_\bh_\bm_\ba_\bd_\bd_\br specifies an illegal address.
+
+ [EMFILE] The number of shared memory segments has reached the
+ system-wide limit.
+
+ s\bsh\bhm\bmd\bdt\bt() will fail if:
+
+ [EINVAL] _\bs_\bh_\bm_\ba_\bd_\bd_\br is not the start address of a mapped shared
+ memory segment.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ipcrm(1), ipcs(1), mmap(2), shmctl(2), shmget(2)
+
+N\bNA\bAM\bME\bE
+ s\bsh\bhm\bmc\bct\btl\bl - shared memory control operations
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsh\bhm\bm.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsh\bhm\bmc\bct\btl\bl(_\bi_\bn_\bt _\bs_\bh_\bm_\bi_\bd, _\bi_\bn_\bt _\bc_\bm_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bh_\bm_\bi_\bd_\b__\bd_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsh\bhm\bmc\bct\btl\bl() system call performs some control operations on the shared
+ memory area specified by _\bs_\bh_\bm_\bi_\bd.
+
+ Each shared memory segment has a data structure associated with it, parts
+ of which may be altered by s\bsh\bhm\bmc\bct\btl\bl() and parts of which determine the
+ actions of s\bsh\bhm\bmc\bct\btl\bl().
+
+ This structure is defined as follows in <_\bs_\by_\bs_\b/_\bs_\bh_\bm_\b._\bh>:
+
+ struct shmid_ds {
+ struct ipc_perm shm_perm; /* operation permissions */
+ int shm_segsz; /* size of segment in bytes */
+ pid_t shm_lpid; /* pid of last shm op */
+ pid_t shm_cpid; /* pid of creator */
+ short shm_nattch; /* # of current attaches */
+ time_t shm_atime; /* last shmat() time*/
+ time_t shm_dtime; /* last shmdt() time */
+ time_t shm_ctime; /* last change by shmctl() */
+ void *shm_internal; /* sysv stupidity */
+ };
+
+ The ipc_perm structure used inside the shmid_ds structure is defined in
+ <_\bs_\by_\bs_\b/_\bi_\bp_\bc_\b._\bh> and looks like this:
+
+ struct ipc_perm {
+ uid_t cuid; /* creator user id */
+ gid_t cgid; /* creator group id */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ mode_t mode; /* r/w permission (see chmod(2)) */
+ u_short seq; /* sequence # (to generate unique msg/sem/shm id) */
+ key_t key; /* user specified msg/sem/shm key */
+ };
+
+ The operation to be performed by s\bsh\bhm\bmc\bct\btl\bl() is specified in _\bc_\bm_\bd and is one
+ of:
+
+ IPC_STAT Gather information about the shared memory segment and place
+ it in the structure pointed to by _\bb_\bu_\bf.
+
+ IPC_SET Set the value of the _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd, _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd and
+ _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be fields in the structure associated with _\bs_\bh_\bm_\bi_\bd.
+ The values are taken from the corresponding fields in the
+ structure pointed to by _\bb_\bu_\bf. This operation can only be
+ executed by the superuser, or a process that has an effective
+ user ID equal to either _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd in the
+ data structure associated with the shared memory segment.
+
+ IPC_RMID Mark the shared memory segment specified by _\bs_\bh_\bm_\bi_\bd for removal
+ when it is no longer in use by any process. When it is
+ removed, all data associated with it will be destroyed too.
+ Only the superuser or a process with an effective UID equal to
+ the _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd or _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd values in the data structure
+ associated with the queue can do this.
+
+ The read and write permissions on a shared memory identifier are
+ determined by the _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be field in the same way as is done with
+ files (see chmod(2)), but the effective UID can match either the
+ _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd field or the _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd field, and the effective GID can
+ match either _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd or _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsh\bhm\bmc\bct\btl\bl() will fail if:
+
+ [EPERM] _\bc_\bm_\bd is equal to IPC_SET or IPC_RMID and the caller is
+ not the superuser, nor does the effective UID match
+ either the _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd or _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd fields of the
+ data structure associated with the shared memory
+ segment.
+
+ An attempt is made to increase the value of _\bs_\bh_\bm_\b__\bq_\bb_\by_\bt_\be_\bs
+ through IPC_SET but the caller is not the superuser.
+
+ [EACCES] The command is IPC_STAT and the caller has no read
+ permission for this shared memory segment.
+
+ [EINVAL] _\bs_\bh_\bm_\bi_\bd is not a valid shared memory segment identifier.
+
+ _\bc_\bm_\bd is not a valid command.
+
+ [EFAULT] _\bb_\bu_\bf specifies an invalid address.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ shmat(2), shmget(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Segments which are marked for removal (but not yet removed since they are
+ still in use) can be attached to by new callers using shmat(2). This is
+ permitted as an extension beyond the standards.
+
+N\bNA\bAM\bME\bE
+ s\bsh\bhm\bma\bat\bt, s\bsh\bhm\bmd\bdt\bt - map/unmap shared memory
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsh\bhm\bm.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd _\b*
+ s\bsh\bhm\bma\bat\bt(_\bi_\bn_\bt _\bs_\bh_\bm_\bi_\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bs_\bh_\bm_\ba_\bd_\bd_\br, _\bi_\bn_\bt _\bs_\bh_\bm_\bf_\bl_\bg);
+
+ _\bi_\bn_\bt
+ s\bsh\bhm\bmd\bdt\bt(_\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bs_\bh_\bm_\ba_\bd_\bd_\br);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsh\bhm\bma\bat\bt() maps the shared memory segment associated with the shared memory
+ identifier _\bs_\bh_\bm_\bi_\bd into the address space of the calling process. The
+ address at which the segment is mapped is determined by the _\bs_\bh_\bm_\ba_\bd_\bd_\br
+ parameter. If it is equal to 0, the system will pick an address itself.
+ Otherwise, an attempt is made to map the shared memory segment at the
+ address _\bs_\bh_\bm_\ba_\bd_\bd_\br specifies. If SHM_RND is set in _\bs_\bh_\bm_\bf_\bl_\bg, the system will
+ round the address down to a multiple of SHMLBA bytes (SHMLBA is defined
+ in <_\bs_\by_\bs_\b/_\bs_\bh_\bm_\b._\bh>).
+
+ A shared memory segment can be mapped read-only by specifying the
+ SHM_RDONLY flag in _\bs_\bh_\bm_\bf_\bl_\bg.
+
+ s\bsh\bhm\bmd\bdt\bt() unmaps the shared memory segment that is currently mapped at
+ _\bs_\bh_\bm_\ba_\bd_\bd_\br from the calling process' address space. _\bs_\bh_\bm_\ba_\bd_\bd_\br must be a value
+ returned by a prior s\bsh\bhm\bma\bat\bt() call. A shared memory segment will remain
+ existent until it is removed by a call to shmctl(2) with the IPC_RMID
+ command.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ s\bsh\bhm\bma\bat\bt() returns the address at which the shared memory segment has been
+ mapped into the calling process' address space when successful, s\bsh\bhm\bmd\bdt\bt()
+ returns 0 on successful completion. Otherwise, a value of -1 is
+ returned, and the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsh\bhm\bma\bat\bt() will fail if:
+
+ [EACCES] The calling process has no permission to access this
+ shared memory segment.
+
+ [ENOMEM] There is not enough available data space for the
+ calling process to map the shared memory segment.
+
+ [EINVAL] _\bs_\bh_\bm_\bi_\bd is not a valid shared memory identifier.
+
+ _\bs_\bh_\bm_\ba_\bd_\bd_\br specifies an illegal address.
+
+ [EMFILE] The number of shared memory segments has reached the
+ system-wide limit.
+
+ s\bsh\bhm\bmd\bdt\bt() will fail if:
+
+ [EINVAL] _\bs_\bh_\bm_\ba_\bd_\bd_\br is not the start address of a mapped shared
+ memory segment.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ipcrm(1), ipcs(1), mmap(2), shmctl(2), shmget(2)
+
+N\bNA\bAM\bME\bE
+ s\bsh\bhm\bmg\bge\bet\bt - get shared memory area identifier
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsh\bhm\bm.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsh\bhm\bmg\bge\bet\bt(_\bk_\be_\by_\b__\bt _\bk_\be_\by, _\bs_\bi_\bz_\be_\b__\bt _\bs_\bi_\bz_\be, _\bi_\bn_\bt _\bs_\bh_\bm_\bf_\bl_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsh\bhm\bmg\bge\bet\bt() returns the shared memory identifier associated with the key
+ _\bk_\be_\by.
+
+ A shared memory segment is created if either _\bk_\be_\by is equal to IPC_PRIVATE,
+ or _\bk_\be_\by does not have a shared memory segment identifier associated with
+ it, and the IPC_CREAT bit is set in _\bs_\bh_\bm_\bf_\bl_\bg.
+
+ If a new shared memory segment is created, the data structure associated
+ with it (the _\bs_\bh_\bm_\bi_\bd_\b__\bd_\bs structure, see shmctl(2)) is initialized as
+ follows:
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bu_\bi_\bd and _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bu_\bi_\bd are set to the effective uid of the
+ calling process.
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bg_\bi_\bd and _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bc_\bg_\bi_\bd are set to the effective gid of the
+ calling process.
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bp_\be_\br_\bm_\b._\bm_\bo_\bd_\be is set to the lower 9 bits of _\bs_\bh_\bm_\bf_\bl_\bg.
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bl_\bp_\bi_\bd, _\bs_\bh_\bm_\b__\bn_\ba_\bt_\bt_\bc_\bh, _\bs_\bh_\bm_\b__\ba_\bt_\bi_\bm_\be, and _\bs_\bh_\bm_\b__\bd_\bt_\bi_\bm_\be are set to 0.
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bc_\bt_\bi_\bm_\be is set to the current time.
+
+ +\b+\bo\bo _\bs_\bh_\bm_\b__\bs_\be_\bg_\bs_\bz is set to the value of _\bs_\bi_\bz_\be.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion a positive shared memory segment identifier is
+ returned. Otherwise, -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set
+ to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [EACCES] A shared memory segment is already associated with _\bk_\be_\by
+ and the caller has no permission to access it.
+
+ [EEXIST] Both IPC_CREAT and IPC_EXCL are set in _\bs_\bh_\bm_\bf_\bl_\bg, and a
+ shared memory segment is already associated with _\bk_\be_\by.
+
+ [EINVAL] A shared memory segment is already associated with _\bk_\be_\by
+ and its _\bs_\bi_\bz_\be is less than the requested size.
+
+ [ENOSPC] A new shared memory identifier could not be created
+ because the system limit for the number of shared
+ memory identifiers has been reached.
+
+ [ENOENT] IPC_CREAT was not set in _\bs_\bh_\bm_\bf_\bl_\bg and no shared memory
+ segment associated with _\bk_\be_\by was found.
+
+ [ENOMEM] There is not enough memory left to create a shared
+ memory segment of the requested size.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ipcrm(1), ipcs(1), mmap(2), shmat(2), shmctl(2), ftok(3)
+
+N\bNA\bAM\bME\bE
+ s\bsh\bhu\but\btd\bdo\bow\bwn\bn - disable sends or receives on a socket
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsh\bhu\but\btd\bdo\bow\bwn\bn(_\bi_\bn_\bt _\bs, _\bi_\bn_\bt _\bh_\bo_\bw);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsh\bhu\but\btd\bdo\bow\bwn\bn() system call disables sends or receives on a socket.
+
+ If the file descriptor _\bs is associated with a SOCK_STREAM socket, all or
+ part of the full-duplex connection will be shut down.
+
+ The _\bh_\bo_\bw argument specifies the type of shutdown. Possible values are:
+
+ SHUT_RD Further receives will be disallowed.
+
+ SHUT_WR Further sends will be disallowed. This may cause
+ actions specific to the protocol family of the socket
+ _\bs to happen.
+
+ SHUT_RDWR Further sends and receives will be disallowed.
+
+ The following protocol specific actions apply to the use of SHUT_WR based
+ on the properties of the socket associated with the file descriptor _\bs:
+
+ DOMAIN TYPE PROTOCOL RETURN VALUE AND ACTION
+
+
+ AF_INET SOCK_DGRAM IPPROTO_UDP Return 0. ICMP messages
+ will _\bn_\bo_\bt be generated.
+ AF_INET SOCK_STREAM IPPROTO_TCP Return 0. Send queued
+ data, wait for ACK, then
+ send FIN.
+ AF_INET6 SOCK_DGRAM IPPROTO_UDP Return 0. ICMP messages
+ will _\bn_\bo_\bt be generated.
+ AF_INET6 SOCK_STREAM IPPROTO_TCP Return 0. Send queued
+ data, wait for ACK, then
+ send FIN.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The s\bsh\bhu\but\btd\bdo\bow\bwn\bn() system call fails if:
+
+ [EBADF] The _\bs argument is not a valid file descriptor.
+
+ [EINVAL] The _\bh_\bo_\bw argument is invalid.
+
+ [ENOTCONN] The _\bs argument specifies a SOCK_STREAM socket which is
+ not connected.
+
+ [ENOTSOCK] The _\bs argument does not refer to a socket.
+
+ [EOPNOTSUPP] The socket associated with the file descriptor _\bs does
+ not support this operation.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ connect(2), socket(2), inet(4), inet6(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsh\bhu\but\btd\bdo\bow\bwn\bn() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsh\bhu\but\btd\bdo\bow\bwn\bn() system call first appeared in 4.1cBSD. The SHUT_RD,
+ SHUT_WR, and SHUT_RDWR constants appeared in IEEE Std 1003.1g-2000
+ (``POSIX.1g'').
+
+B\bBU\bUG\bGS\bS
+ The ICMP ``port unreachable'' message should be generated in response to
+ datagrams received on a local port to which _\bs is bound after s\bsh\bhu\but\btd\bdo\bow\bwn\bn()
+ is called.
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bga\bac\bct\bti\bio\bon\bn - software signal facilities
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ struct sigaction {
+ union { /* signal handler */
+ void (*__sa_handler)(int);
+ void (*__sa_sigaction)(int, siginfo_t *, void *);
+ } __sigaction_u;
+ sigset_t sa_mask; /* signal mask to apply */
+ int sa_flags; /* see signal options below */
+ };
+
+ #\b#d\bde\bef\bfi\bin\bne\be s\bsa\ba_\b_h\bha\ban\bnd\bdl\ble\ber\br _\b__\b_s\bsi\big\bga\bac\bct\bti\bio\bon\bn_\b_u\bu.\b._\b__\b_s\bsa\ba_\b_h\bha\ban\bnd\bdl\ble\ber\br
+ #\b#d\bde\bef\bfi\bin\bne\be s\bsa\ba_\b_s\bsi\big\bga\bac\bct\bti\bio\bon\bn _\b__\b_s\bsi\big\bga\bac\bct\bti\bio\bon\bn_\b_u\bu.\b._\b__\b_s\bsa\ba_\b_s\bsi\big\bga\bac\bct\bti\bio\bon\bn
+
+ _\bi_\bn_\bt
+ s\bsi\big\bga\bac\bct\bti\bio\bon\bn(_\bi_\bn_\bt _\bs_\bi_\bg, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bi_\bg_\ba_\bc_\bt_\bi_\bo_\bn _\b*_\ba_\bc_\bt, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bi_\bg_\ba_\bc_\bt_\bi_\bo_\bn _\b*_\bo_\ba_\bc_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The system defines a set of signals that may be delivered to a process.
+ Signal delivery resembles the occurrence of a hardware interrupt: the
+ signal is normally blocked from further occurrence, the current process
+ context is saved, and a new one is built. A process may specify a
+ _\bh_\ba_\bn_\bd_\bl_\be_\br to which a signal is delivered, or specify that a signal is to be
+ _\bi_\bg_\bn_\bo_\br_\be_\bd. A process may also specify that a default action is to be taken
+ by the system when a signal occurs. A signal may also be _\bb_\bl_\bo_\bc_\bk_\be_\bd, in
+ which case its delivery is postponed until it is _\bu_\bn_\bb_\bl_\bo_\bc_\bk_\be_\bd. The action
+ to be taken on delivery is determined at the time of delivery. Normally,
+ signal handlers execute on the current stack of the process. This may be
+ changed, on a per-handler basis, so that signals are taken on a special
+ _\bs_\bi_\bg_\bn_\ba_\bl _\bs_\bt_\ba_\bc_\bk.
+
+ Signal routines normally execute with the signal that caused their
+ invocation _\bb_\bl_\bo_\bc_\bk_\be_\bd, but other signals may yet occur. A global _\bs_\bi_\bg_\bn_\ba_\bl
+ _\bm_\ba_\bs_\bk defines the set of signals currently blocked from delivery to a
+ process. The signal mask for a process is initialized from that of its
+ parent (normally empty). It may be changed with a sigprocmask(2) call,
+ or when a signal is delivered to the process.
+
+ When a signal condition arises for a process, the signal is added to a
+ set of signals pending for the process. If the signal is not currently
+ _\bb_\bl_\bo_\bc_\bk_\be_\bd by the process then it is delivered to the process. Signals may
+ be delivered any time a process enters the operating system (e.g., during
+ a system call, page fault or trap, or clock interrupt). If multiple
+ signals are ready to be delivered at the same time, any signals that
+ could be caused by traps are delivered first. Additional signals may be
+ processed at the same time, with each appearing to interrupt the handlers
+ for the previous signals before their first instructions. The set of
+ pending signals is returned by the sigpending(2) function. When a caught
+ signal is delivered, the current state of the process is saved, a new
+ signal mask is calculated (as described below), and the signal handler is
+ invoked. The call to the handler is arranged so that if the signal
+ handling routine returns normally the process will resume execution in
+ the context from before the signal's delivery. If the process wishes to
+ resume in a different context, then it must arrange to restore the
+ previous context itself.
+
+ When a signal is delivered to a process a new signal mask is installed
+ for the duration of the process' signal handler (or until a
+ sigprocmask(2) call is made). This mask is formed by taking the union of
+ the current signal mask set, the signal to be delivered, and the signal
+ mask _\bs_\ba_\b__\bm_\ba_\bs_\bk associated with the handler to be invoked, but always
+ excluding SIGKILL and SIGSTOP.
+
+ s\bsi\big\bga\bac\bct\bti\bio\bon\bn() assigns an action for a signal specified by _\bs_\bi_\bg. If _\ba_\bc_\bt is
+ non-zero, it specifies an action (SIG_DFL, SIG_IGN, or a handler routine)
+ and mask to be used when delivering the specified signal. If _\bo_\ba_\bc_\bt is
+ non-zero, the previous handling information for the signal is returned to
+ the user.
+
+ Once a signal handler is installed, it normally remains installed until
+ another s\bsi\big\bga\bac\bct\bti\bio\bon\bn() call is made, or an execve(2) is performed. The
+ value of _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br (or, if the SA_SIGINFO flag is set, the value of
+ _\bs_\ba_\b__\bs_\bi_\bg_\ba_\bc_\bt_\bi_\bo_\bn instead) indicates what action should be performed when a
+ signal arrives. A signal-specific default action may be reset by setting
+ _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br to SIG_DFL. Alternately, if the SA_RESETHAND flag is set the
+ default action will be reinstated when the signal is first posted. The
+ defaults are process termination, possibly with core dump; no action;
+ stopping the process; or continuing the process. See the signal list
+ below for each signal's default action. If _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br is SIG_DFL, the
+ default action for the signal is to discard the signal, and if a signal
+ is pending, the pending signal is discarded even if the signal is masked.
+ If _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br is set to SIG_IGN, current and pending instances of the
+ signal are ignored and discarded. If _\bs_\bi_\bg is SIGCHLD and _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br is
+ set to SIG_IGN, the SA_NOCLDWAIT flag (described below) is implied.
+
+ Options may be specified by setting _\bs_\ba_\b__\bf_\bl_\ba_\bg_\bs. The meaning of the various
+ bits is as follows:
+
+ SA_NOCLDSTOP If this bit is set when installing a catching
+ function for the SIGCHLD signal, the SIGCHLD signal
+ will be generated only when a child process exits,
+ not when a child process stops.
+
+ SA_NOCLDWAIT If this bit is set when calling s\bsi\big\bga\bac\bct\bti\bio\bon\bn() for the
+ SIGCHLD signal, the system will not create zombie
+ processes when children of the calling process
+ exit, though existing zombies will remain. If the
+ calling process subsequently issues a waitpid(2)
+ (or equivalent) and there are no previously
+ existing zombie child processes that match the
+ waitpid(2) criteria, it blocks until all of the
+ calling process's child processes that would match
+ terminate, and then returns a value of -1 with
+ _\be_\br_\br_\bn_\bo set to ECHILD.
+
+ SA_ONSTACK If this bit is set, the system will deliver the
+ signal to the process on a _\bs_\bi_\bg_\bn_\ba_\bl _\bs_\bt_\ba_\bc_\bk, specified
+ with sigaltstack(2).
+
+ SA_NODEFER If this bit is set, further occurrences of the
+ delivered signal are not masked during the
+ execution of the handler.
+
+ SA_RESETHAND If this bit is set, the handler is reset back to
+ SIG_DFL at the moment the signal is delivered.
+
+ SA_SIGINFO If this bit is set, the 2nd argument of the handler
+ is set to be a pointer to a _\bs_\bi_\bg_\bi_\bn_\bf_\bo_\b__\bt structure as
+ described in <_\bs_\by_\bs_\b/_\bs_\bi_\bg_\bi_\bn_\bf_\bo_\b._\bh>. It provides much
+ more information about the causes and attributes of
+ the signal that is being delivered.
+
+ SA_RESTART If a signal is caught during the system calls
+ listed below, the call may be forced to terminate
+ with the error EINTR, the call may return with a
+ data transfer shorter than requested, or the call
+ may be restarted. Restarting of pending calls is
+ requested by setting the SA_RESTART bit in
+ _\bs_\ba_\b__\bf_\bl_\ba_\bg_\bs. The affected system calls include
+ read(2), write(2), sendto(2), recvfrom(2),
+ sendmsg(2) and recvmsg(2) on a communications
+ channel or a slow device (such as a terminal, but
+ not a regular file) and during a wait(2) or
+ ioctl(2). However, calls that have already
+ committed are not restarted, but instead return a
+ partial success (for example, a short read count).
+
+ After a fork(2) or vfork(2), all signals, the signal mask, the signal
+ stack, and the restart/interrupt flags are inherited by the child.
+
+ execve(2) reinstates the default action for all signals which were caught
+ and resets all signals to be caught on the user stack. Ignored signals
+ remain ignored; the signal mask remains the same; signals that restart
+ pending system calls continue to do so.
+
+ The following is a list of all signals with names as in the include file
+ <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>:
+
+ N\bNa\bam\bme\be D\bDe\bef\bfa\bau\bul\blt\bt A\bAc\bct\bti\bio\bon\bn D\bDe\bes\bsc\bcr\bri\bip\bpt\bti\bio\bon\bn
+ SIGHUP terminate process terminal line hangup
+ SIGINT terminate process interrupt program
+ SIGQUIT create core image quit program
+ SIGILL create core image illegal instruction
+ SIGTRAP create core image trace trap
+ SIGABRT create core image abort(3) call (formerly SIGIOT)
+ SIGEMT create core image emulate instruction executed
+ SIGFPE create core image floating-point exception
+ SIGKILL terminate process kill program (cannot be caught or
+ ignored)
+ SIGBUS create core image bus error
+ SIGSEGV create core image segmentation violation
+ SIGSYS create core image system call given invalid argument
+ SIGPIPE terminate process write on a pipe with no reader
+ SIGALRM terminate process real-time timer expired
+ SIGTERM terminate process software termination signal
+ SIGURG discard signal urgent condition present on socket
+ SIGSTOP stop process stop (cannot be caught or ignored)
+ SIGTSTP stop process stop signal generated from keyboard
+ SIGCONT discard signal continue after stop
+ SIGCHLD discard signal child status has changed
+ SIGTTIN stop process background read attempted from control
+ terminal
+ SIGTTOU stop process background write attempted to control
+ terminal
+ SIGIO discard signal I/O is possible on a descriptor (see
+ fcntl(2))
+ SIGXCPU terminate process CPU time limit exceeded (see
+ setrlimit(2))
+ SIGXFSZ terminate process file size limit exceeded (see
+ setrlimit(2))
+ SIGVTALRM terminate process virtual time alarm (see setitimer(2))
+ SIGPROF terminate process profiling timer alarm (see
+ setitimer(2))
+ SIGWINCH discard signal window size change
+ SIGINFO discard signal status request from keyboard
+ SIGUSR1 terminate process user defined signal 1
+ SIGUSR2 terminate process user defined signal 2
+ SIGTHR discard signal thread AST
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+ The handler routine can be declared:
+
+ void
+ handler(int sig)
+
+ If the SA_SIGINFO option is enabled, the canonical way to declare it is:
+
+ void
+ handler(int sig, siginfo_t *sip, struct sigcontext *scp)
+
+ Here _\bs_\bi_\bg is the signal number, into which the hardware faults and traps
+ are mapped. If the SA_SIGINFO option is set, _\bs_\bi_\bp is a pointer to a
+ siginfo_t as described in <_\bs_\by_\bs_\b/_\bs_\bi_\bg_\bi_\bn_\bf_\bo_\b._\bh>. If SA_SIGINFO is not set,
+ this pointer will be NULL instead. The function specified in
+ _\bs_\ba_\b__\bs_\bi_\bg_\ba_\bc_\bt_\bi_\bo_\bn will be called instead of the function specified by
+ _\bs_\ba_\b__\bh_\ba_\bn_\bd_\bl_\be_\br (Note that in some implementations these are in fact the
+ same). _\bs_\bc_\bp is a pointer to the _\bs_\bi_\bg_\bc_\bo_\bn_\bt_\be_\bx_\bt structure (defined in
+ <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>), used to restore the context from before the signal.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsi\big\bga\bac\bct\bti\bio\bon\bn() will fail and no new signal handler will be installed if one
+ of the following occurs:
+
+ [EFAULT] Either _\ba_\bc_\bt or _\bo_\ba_\bc_\bt points to memory that is not a
+ valid part of the process address space.
+
+ [EINVAL] _\bs_\bi_\bg is not a valid signal number.
+
+ [EINVAL] An attempt is made to ignore or supply a handler for
+ SIGKILL or SIGSTOP.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ kill(1), kill(2), ptrace(2), sigaltstack(2), sigprocmask(2),
+ sigsuspend(2), wait(2), setjmp(3), sigblock(3), sigpause(3),
+ sigsetops(3), sigvec(3), tty(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsi\big\bga\bac\bct\bti\bio\bon\bn() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+ The SA_ONSTACK flag and the SIGPROF, SIGSYS, SIGTRAP, SIGVTALRM, SIGXCPU,
+ and SIGXFSZ signals conform to the X/Open System Interfaces option of
+ that standard. The standard marks SIGPROF as obsolescent. The signals
+ SIGEMT, SIGINFO, SIGIO, and SIGWINCH are Berkeley extensions. These
+ signals are available on most BSD-derived systems. The SIGTHR signal is
+ specific to OpenBSD and is part of the implementation of thread
+ cancellation; _\bs_\bi_\bg_\ba_\bc_\bt_\bi_\bo_\bn and other signal interfaces may reject attempts
+ to use or alter the handling of SIGTHR.
+
+ The following functions are either reentrant or not interruptible by
+ signals and are async-signal-safe. Therefore applications may invoke
+ them, without restriction, from signal-catching functions:
+
+ Standard Interfaces:
+
+ _\b_e\bex\bxi\bit\bt(), _\b_E\bEx\bxi\bit\bt(), a\bab\bbo\bor\brt\bt(), a\bac\bcc\bce\bep\bpt\bt(), a\bac\bcc\bce\bes\bss\bs(), a\bal\bla\bar\brm\bm(), b\bbi\bin\bnd\bd(),
+ c\bcf\bfg\bge\bet\bti\bis\bsp\bpe\bee\bed\bd(), c\bcf\bfg\bge\bet\bto\bos\bsp\bpe\bee\bed\bd(), c\bcf\bfs\bse\bet\bti\bis\bsp\bpe\bee\bed\bd(), c\bcf\bfs\bse\bet\bto\bos\bsp\bpe\bee\bed\bd(), c\bch\bhd\bdi\bir\br(),
+ c\bch\bhm\bmo\bod\bd(), c\bch\bho\bow\bwn\bn(), c\bcl\blo\boc\bck\bk_\b_g\bge\bet\btt\bti\bim\bme\be(), c\bcl\blo\bos\bse\be(), c\bco\bon\bnn\bne\bec\bct\bt(), c\bcr\bre\bea\bat\bt(), d\bdu\bup\bp(),
+ d\bdu\bup\bp2\b2(), e\bex\bxe\bec\bcl\bl(), e\bex\bxe\bec\bcl\ble\be(), e\bex\bxe\bec\bcv\bv(), e\bex\bxe\bec\bcv\bve\be(), f\bfa\bac\bcc\bce\bes\bss\bsa\bat\bt(), f\bfc\bch\bhd\bdi\bir\br(),
+ f\bfc\bch\bhm\bmo\bod\bd(), f\bfc\bch\bhm\bmo\bod\bda\bat\bt(), f\bfc\bch\bho\bow\bwn\bn(), f\bfc\bch\bho\bow\bwn\bna\bat\bt(), f\bfc\bcn\bnt\btl\bl(), f\bfd\bda\bat\bta\bas\bsy\byn\bnc\bc(), f\bfo\bor\brk\bk(),
+ f\bfp\bpa\bat\bth\bhc\bco\bon\bnf\bf(), f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), f\bfs\bsy\byn\bnc\bc(), f\bft\btr\bru\bun\bnc\bca\bat\bte\be(), f\bfu\but\bti\bim\bme\ben\bns\bs(),
+ f\bfu\but\bti\bim\bme\bes\bs(), g\bge\bet\bte\beg\bgi\bid\bd(), g\bge\bet\bte\beu\bui\bid\bd(), g\bge\bet\btg\bgi\bid\bd(), g\bge\bet\btg\bgr\bro\bou\bup\bps\bs(), g\bge\bet\btp\bpe\bee\ber\brn\bna\bam\bme\be(),
+ g\bge\bet\btp\bpg\bgr\brp\bp(), g\bge\bet\btp\bpi\bid\bd(), g\bge\bet\btp\bpp\bpi\bid\bd(), g\bge\bet\bts\bso\boc\bck\bkn\bna\bam\bme\be(), g\bge\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), g\bge\bet\btu\bui\bid\bd(),
+ k\bki\bil\bll\bl(), l\bli\bin\bnk\bk(), l\bli\bin\bnk\bka\bat\bt(), l\bli\bis\bst\bte\ben\bn(), l\bls\bse\bee\bek\bk(), l\bls\bst\bta\bat\bt(), m\bmk\bkd\bdi\bir\br(), m\bmk\bkd\bdi\bir\bra\bat\bt(),
+ m\bmk\bkf\bfi\bif\bfo\bo(), m\bmk\bkf\bfi\bif\bfo\boa\bat\bt(), m\bmk\bkn\bno\bod\bd(), m\bmk\bkn\bno\bod\bda\bat\bt(), o\bop\bpe\ben\bn(), o\bop\bpe\ben\bna\bat\bt(), p\bpa\bat\bth\bhc\bco\bon\bnf\bf(),
+ p\bpa\bau\bus\bse\be(), p\bpi\bip\bpe\be(), p\bpo\bol\bll\bl(), p\bps\bse\bel\ble\bec\bct\bt(), p\bpt\bth\bhr\bre\bea\bad\bd_\b_s\bsi\big\bgm\bma\bas\bsk\bk(), r\bra\bai\bis\bse\be(), r\bre\bea\bad\bd(),
+ r\bre\bea\bad\bdl\bli\bin\bnk\bk(), r\bre\bea\bad\bdl\bli\bin\bnk\bka\bat\bt(), r\bre\bec\bcv\bv(), r\bre\bec\bcv\bvf\bfr\bro\bom\bm(), r\bre\bec\bcv\bvm\bms\bsg\bg(), r\bre\ben\bna\bam\bme\be(),
+ r\bre\ben\bna\bam\bme\bea\bat\bt(), r\brm\bmd\bdi\bir\br(), s\bse\bel\ble\bec\bct\bt(), s\bse\ben\bnd\bd(), s\bse\ben\bnd\bdm\bms\bsg\bg(), s\bse\ben\bnd\bdt\bto\bo(), s\bse\bet\btg\bgi\bid\bd(),
+ s\bse\bet\btp\bpg\bgi\bid\bd(), s\bse\bet\bts\bsi\bid\bd(), s\bse\bet\bts\bso\boc\bck\bko\bop\bpt\bt(), s\bse\bet\btu\bui\bid\bd(), s\bsh\bhu\but\btd\bdo\bow\bwn\bn(), s\bsi\big\bga\bac\bct\bti\bio\bon\bn(),
+ s\bsi\big\bga\bad\bdd\bds\bse\bet\bt(), s\bsi\big\bgd\bde\bel\bls\bse\bet\bt(), s\bsi\big\bge\bem\bmp\bpt\bty\bys\bse\bet\bt(), s\bsi\big\bgf\bfi\bil\bll\bls\bse\bet\bt(), s\bsi\big\bgi\bis\bsm\bme\bem\bmb\bbe\ber\br(),
+ s\bsi\big\bgn\bna\bal\bl(), s\bsi\big\bgp\bpa\bau\bus\bse\be(), s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg(), s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk(), s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd(), s\bsl\ble\bee\bep\bp(),
+ s\bso\boc\bck\bka\bat\btm\bma\bar\brk\bk(), s\bso\boc\bck\bke\bet\bt(), s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br(), s\bst\bta\bat\bt(), s\bst\btr\brc\bca\bat\bt(), s\bst\btr\brc\bcp\bpy\by(),
+ s\bst\btr\brn\bnc\bca\bat\bt(), s\bst\btr\brn\bnc\bcp\bpy\by(), s\bsy\bym\bml\bli\bin\bnk\bk(), s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt(), s\bsy\bys\bsc\bco\bon\bnf\bf(), t\btc\bcd\bdr\bra\bai\bin\bn(),
+ t\btc\bcf\bfl\blo\bow\bw(), t\btc\bcf\bfl\blu\bus\bsh\bh(), t\btc\bcg\bge\bet\bta\bat\btt\btr\br(), t\btc\bcg\bge\bet\btp\bpg\bgr\brp\bp(), t\btc\bcs\bse\ben\bnd\bdb\bbr\bre\bea\bak\bk(),
+ t\btc\bcs\bse\bet\bta\bat\btt\btr\br(), t\btc\bcs\bse\bet\btp\bpg\bgr\brp\bp(), t\bti\bim\bme\be(), t\bti\bim\bme\bes\bs(), u\bum\bma\bas\bsk\bk(), u\bun\bna\bam\bme\be(), u\bun\bnl\bli\bin\bnk\bk(),
+ u\bun\bnl\bli\bin\bnk\bka\bat\bt(), u\but\bti\bim\bme\be(), u\but\bti\bim\bme\ben\bns\bsa\bat\bt(), u\but\bti\bim\bme\bes\bs(), w\bwa\bai\bit\bt(), w\bwa\bai\bit\btp\bpi\bid\bd(), w\bwr\bri\bit\bte\be(),
+ and perhaps some others.
+
+ Extension Interfaces:
+
+ a\bac\bcc\bce\bep\bpt\bt4\b4(), c\bch\bhf\bfl\bla\bag\bgs\bs(), d\bdu\bup\bp3\b3(), f\bfc\bch\bhf\bfl\bla\bag\bgs\bs(), g\bge\bet\bte\ben\bnt\btr\bro\bop\bpy\by(), g\bge\bet\btr\bre\bes\bsg\bgi\bid\bd(),
+ g\bge\bet\btr\bre\bes\bsu\bui\bid\bd(), p\bpi\bip\bpe\be2\b2(), p\bpp\bpo\bol\bll\bl(), s\bse\ben\bnd\bds\bsy\bys\bsl\blo\bog\bg(), s\bse\bet\btr\bre\bes\bsg\bgi\bid\bd(), s\bse\bet\btr\bre\bes\bsu\bui\bid\bd(),
+ s\bst\btr\brl\blc\bca\bat\bt(), s\bst\btr\brl\blc\bcp\bpy\by(), w\bwa\bai\bit\bt3\b3(), w\bwa\bai\bit\bt4\b4().
+
+ In addition, access and updates to _\be_\br_\br_\bn_\bo are guaranteed to be safe. Most
+ functions not in the above lists are considered to be unsafe with respect
+ to signals. That is to say, the behaviour of such functions when called
+ from a signal handler is undefined. In general though, signal handlers
+ should do little more than set a flag, ideally of type volatile
+ sig_atomic_t; most other actions are not safe.
+
+ Additionally, it is advised that signal handlers guard against
+ modification of the external symbol _\be_\br_\br_\bn_\bo by the above functions, saving
+ it at entry and restoring it on return, thus:
+
+ void
+ handler(int sig)
+ {
+ int save_errno = errno;
+
+ ...
+ errno = save_errno;
+ }
+
+ The functions below are async-signal-safe in OpenBSD except when used
+ with floating-point arguments or directives, but are probably unsafe on
+ other systems:
+
+ d\bdp\bpr\bri\bin\bnt\btf\bf() Safe.
+ v\bvd\bdp\bpr\bri\bin\bnt\btf\bf() Safe.
+ s\bsn\bnp\bpr\bri\bin\bnt\btf\bf() Safe.
+ v\bvs\bsn\bnp\bpr\bri\bin\bnt\btf\bf() Safe.
+ s\bsy\bys\bsl\blo\bog\bg_\b_r\br() Safe if the _\bs_\by_\bs_\bl_\bo_\bg_\b__\bd_\ba_\bt_\ba struct is initialized as a
+ local variable.
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bga\bal\blt\bts\bst\bta\bac\bck\bk - set and/or get signal stack context
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ typedef struct sigaltstack {
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+ } stack_t;
+ _\bi_\bn_\bt
+ s\bsi\big\bga\bal\blt\bts\bst\bta\bac\bck\bk(_\bc_\bo_\bn_\bs_\bt _\bs_\bt_\ba_\bc_\bk_\b__\bt _\b*_\bs_\bs, _\bs_\bt_\ba_\bc_\bk_\b__\bt _\b*_\bo_\bs_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsi\big\bga\bal\blt\bts\bst\bta\bac\bck\bk() allows users to define an alternate stack on which signals
+ delivered to this thread are to be processed. If _\bs_\bs is non-zero and
+ SS_DISABLE is set in _\bs_\bs_\b__\bf_\bl_\ba_\bg_\bs, the signal stack will be disabled. A
+ disabled stack will cause all signals to be taken on the regular user
+ stack. Trying to disable an active stack will cause k\bkq\bqu\bue\beu\bue\be to return -1
+ with _\be_\br_\br_\bn_\bo set to EPERM.
+
+ Otherwise, _\bs_\bs_\b__\bs_\bp specifies a pointer to a space to be used as the signal
+ stack and _\bs_\bs_\b__\bs_\bi_\bz_\be specifies the size of that space. When a signal's
+ action indicates its handler should execute on the signal stack
+ (specified with a sigaction(2) call), the system checks to see if the
+ thread is currently executing on that stack. If the thread is not
+ currently executing on the signal stack, the system arranges a switch to
+ the signal stack for the duration of the signal handler's execution.
+
+ If _\bo_\bs_\bs is non-zero, the current signal stack state is returned. The
+ _\bs_\bs_\b__\bf_\bl_\ba_\bg_\bs field will contain the value SS_ONSTACK if the thread is
+ currently on a signal stack and SS_DISABLE if the signal stack is
+ currently disabled.
+
+N\bNO\bOT\bTE\bES\bS
+ The value SIGSTKSZ is defined to be the number of bytes/chars that would
+ be used to cover the usual case when allocating an alternate stack area.
+ The following code fragment is typically used to allocate an alternate
+ stack.
+
+ if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
+ /* error return */
+ sigstk.ss_size = SIGSTKSZ;
+ sigstk.ss_flags = 0;
+ if (sigaltstack(&sigstk, 0) == -1)
+ perror("sigaltstack");
+
+ An alternative approach is provided for programs with signal handlers
+ that require a specific amount of stack space other than the default
+ size. The value MINSIGSTKSZ is defined to be the number of bytes/chars
+ that is required by the operating system to implement the alternate stack
+ feature. In computing an alternate stack size, programs should add
+ MINSIGSTKSZ to their stack requirements to allow for the operating system
+ overhead.
+
+ Signal stacks are automatically adjusted for the direction of stack
+ growth and alignment requirements. Signal stacks may or may not be
+ protected by the hardware and are not ``grown'' automatically as is done
+ for the normal stack. If the stack overflows and this space is not
+ protected unpredictable results may occur.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsi\big\bga\bal\blt\bts\bst\bta\bac\bck\bk() will fail and the signal stack context will remain
+ unchanged if one of the following occurs.
+
+ [EFAULT] Either _\bs_\bs or _\bo_\bs_\bs points to memory that is not a valid part of
+ the process address space.
+
+ [EINVAL] The _\bs_\bs_\b__\bf_\bl_\ba_\bg_\bs member pointed to by the _\bs_\bs argument contains
+ flags other than SS_DISABLE.
+
+ [ENOMEM] Size of alternate stack area is less than or equal to
+ MINSIGSTKSZ.
+
+ [EPERM] An attempt was made to disable an active stack.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sigaction(2), setjmp(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The k\bkq\bqu\bue\beu\bue\be function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor to s\bsi\big\bga\bal\blt\bts\bst\bta\bac\bck\bk, the s\bsi\big\bgs\bst\bta\bac\bck\bk() system call, appeared in
+ 4.2BSD.
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg - get pending signals
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg(_\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg function returns a mask of the signals pending for
+ delivery to the calling process in the location indicated by _\bs_\be_\bt.
+ Signals may be pending because they are currently masked, or transiently
+ before delivery (although the latter case is not normally detectable).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg function does not currently detect any errors.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sigaction(2), sigprocmask(2), sigsetops(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsi\big\bgp\bpe\ben\bnd\bdi\bin\bng\bg function is defined by IEEE Std 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk - manipulate current signal mask
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk(_\bi_\bn_\bt _\bh_\bo_\bw, _\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bs_\be_\bt, _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bo_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk() function examines and/or changes the current signal
+ mask (those signals that are blocked from delivery). Signals are blocked
+ if they are members of the current signal mask set.
+
+ If _\bs_\be_\bt is not null, the action of s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk() depends on the value of
+ the parameter _\bh_\bo_\bw, which can be one of the following values:
+
+ SIG_BLOCK The new mask is the union of the current mask and the
+ specified _\bs_\be_\bt.
+
+ SIG_UNBLOCK The new mask is the intersection of the current mask and the
+ complement of the specified _\bs_\be_\bt.
+
+ SIG_SETMASK The current mask is replaced by the specified _\bs_\be_\bt.
+
+ If _\bo_\bs_\be_\bt is not null, it is set to the previous value of the signal mask.
+ When _\bs_\be_\bt is null, the value of _\bh_\bo_\bw is insignificant and the mask remains
+ unchanged, providing a way to examine the signal mask without
+ modification.
+
+ The system quietly disallows SIGKILL or SIGSTOP to be blocked.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk() call will fail and the signal mask will be unchanged if
+ one of the following occurs:
+
+ [EINVAL] _\bh_\bo_\bw has a value other than those listed here.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ kill(2), sigaction(2), sigsuspend(2), sigsetops(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsi\big\bgp\bpr\bro\boc\bcm\bma\bas\bsk\bk() function call is expected to conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bgr\bre\bet\btu\bur\brn\bn - return from signal
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsi\big\bgr\bre\bet\btu\bur\brn\bn(_\bs_\bt_\br_\bu_\bc_\bt _\bs_\bi_\bg_\bc_\bo_\bn_\bt_\be_\bx_\bt _\b*_\bs_\bc_\bp);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsi\big\bgr\bre\bet\btu\bur\brn\bn() allows users to atomically unmask, switch stacks, and return
+ from a signal context. The processes signal mask and stack status are
+ restored from the context. The system call does not return; the users
+ stack pointer, frame pointer, argument pointer, and processor status
+ longword are restored from the context. Execution resumes at the
+ specified pc. This system call is used by the trampoline code and
+ longjmp(3) when returning from a signal to the previously executing
+ program.
+
+ Note that sigcontext contains machine dependent information.
+
+N\bNO\bOT\bTE\bES\bS
+ This system call is not available in 4.2BSD hence it should not be used
+ if backward compatibility is needed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If successful, the system call does not return. Otherwise, a value of -1
+ is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsi\big\bgr\bre\bet\btu\bur\brn\bn() will fail and the process context will remain unchanged if
+ one of the following occurs.
+
+ [EFAULT] _\bs_\bc_\bp points to memory that is not a valid part of the
+ process address space.
+
+ [EINVAL] The process status longword is invalid or would
+ improperly raise the privilege level of the process.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sigaction(2), setjmp(3)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsi\big\bgr\bre\bet\btu\bur\brn\bn() function call appeared in 4.3BSD.
+
+N\bNA\bAM\bME\bE
+ s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd - atomically change the signal mask and wait for interrupt
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsi\big\bgn\bna\bal\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd(_\bc_\bo_\bn_\bs_\bt _\bs_\bi_\bg_\bs_\be_\bt_\b__\bt _\b*_\bs_\bi_\bg_\bm_\ba_\bs_\bk);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd() temporarily changes the blocked signal mask to the set to
+ which _\bs_\bi_\bg_\bm_\ba_\bs_\bk points, and then waits for a signal to arrive; on return
+ the previous set of masked signals is restored. The signal mask set is
+ usually empty to indicate that all signals are to be unblocked for the
+ duration of the call.
+
+ In normal usage, a signal is blocked using sigprocmask(2) to begin a
+ critical section, variables modified on the occurrence of the signal are
+ examined to determine that there is no work to be done, and the process
+ pauses awaiting work by using s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd() with the previous mask
+ returned by sigprocmask(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd() function always terminates by being interrupted,
+ returning -1 with _\be_\br_\br_\bn_\bo set to EINTR.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sigaction(2), sigprocmask(2), sigsetops(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsi\big\bgs\bsu\bus\bsp\bpe\ben\bnd\bd function call conforms to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+N\bNA\bAM\bME\bE
+ s\bso\boc\bck\bke\bet\bt - create an endpoint for communication
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bso\boc\bck\bke\bet\bt(_\bi_\bn_\bt _\bd_\bo_\bm_\ba_\bi_\bn, _\bi_\bn_\bt _\bt_\by_\bp_\be, _\bi_\bn_\bt _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bso\boc\bck\bke\bet\bt() creates an endpoint for communication and returns a descriptor.
+
+ The _\bd_\bo_\bm_\ba_\bi_\bn parameter specifies a communications domain within which
+ communication will take place; this selects the protocol family which
+ should be used. These families are defined in the include file
+ <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>. The currently understood formats are:
+
+ AF_UNIX UNIX internal protocols
+ AF_INET ARPA Internet protocols
+ AF_INET6 IPv6 (Internet Protocol version 6) protocols
+
+ The socket has the indicated _\bt_\by_\bp_\be, which specifies the semantics of
+ communication. Currently defined types are:
+
+ SOCK_STREAM
+ SOCK_DGRAM
+ SOCK_RAW
+ SOCK_SEQPACKET
+
+ A SOCK_STREAM type provides sequenced, reliable, two-way connection based
+ byte streams. An out-of-band data transmission mechanism may be
+ supported. A SOCK_DGRAM socket supports datagrams (connectionless,
+ unreliable messages of a fixed (typically small) maximum length). A
+ SOCK_SEQPACKET socket may provide a sequenced, reliable, two-way
+ connection-based data transmission path for datagrams of fixed maximum
+ length; a consumer may be required to read an entire packet with each
+ read system call. This facility is protocol specific, and presently
+ implemented only for AF_UNIX. SOCK_RAW sockets provide access to
+ internal network protocols and interfaces, and are available only to the
+ superuser.
+
+ Any combination of the following flags may additionally be used in the
+ _\bt_\by_\bp_\be argument:
+
+ SOCK_CLOEXEC Set close-on-exec flag on the new descriptor.
+ SOCK_NONBLOCK Set non-blocking I/O mode on the new socket.
+
+ The _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl specifies a particular protocol to be used with the socket.
+ Normally only a single protocol exists to support a particular socket
+ type within a given protocol family. However, it is possible that many
+ protocols may exist, in which case a particular protocol must be
+ specified in this manner. The protocol number to use is particular to
+ the ``communication domain'' in which communication is to take place; see
+ protocols(5). A value of 0 for _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl will let the system select an
+ appropriate protocol for the requested socket type.
+
+ Sockets of type SOCK_STREAM are full-duplex byte streams. A stream
+ socket must be in a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd state before any data may be sent or
+ received on it. A connection to another socket is created with a
+ connect(2) call. Once connected, data may be transferred using read(2)
+ and write(2) calls or some variant of the send(2) and recv(2) calls.
+ When a session has been completed a close(2) may be performed. Out-of-
+ band data may also be transmitted as described in send(2) and received as
+ described in recv(2).
+
+ The communications protocols used to implement a SOCK_STREAM ensure that
+ data is not lost or duplicated. If a piece of data for which the peer
+ protocol has buffer space cannot be successfully transmitted within a
+ reasonable length of time, then the connection is considered broken and
+ calls will indicate an error with -1 returns and with ETIMEDOUT as the
+ specific code in the global variable _\be_\br_\br_\bn_\bo. The protocols optionally
+ keep sockets ``warm'' by forcing transmissions roughly every minute in
+ the absence of other activity. An error is then indicated if no response
+ can be elicited on an otherwise idle connection for an extended period
+ (e.g., 5 minutes). A SIGPIPE signal is raised if a process sends on a
+ broken stream; this causes naive processes, which do not handle the
+ signal, to exit.
+
+ SOCK_SEQPACKET sockets employ the same system calls as SOCK_STREAM
+ sockets. The only difference is that read(2) calls will return only the
+ amount of data requested, and any remaining in the arriving packet will
+ be discarded.
+
+ SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to
+ correspondents named in send(2) calls. Datagrams are generally received
+ with recvfrom(2), which returns the next datagram with its return
+ address.
+
+ An fcntl(2) call can be used to specify a process group to receive a
+ SIGURG signal when the out-of-band data arrives. It may also enable non-
+ blocking I/O and asynchronous notification of I/O events via SIGIO.
+
+ The operation of sockets is controlled by socket level _\bo_\bp_\bt_\bi_\bo_\bn_\bs. These
+ options are defined in the file <_\bs_\by_\bs_\b/_\bs_\bo_\bc_\bk_\be_\bt_\b._\bh>. setsockopt(2) and
+ getsockopt(2) are used to set and get options, respectively.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ A -1 is returned if an error occurs, otherwise the return value is a
+ descriptor referencing the socket.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The s\bso\boc\bck\bke\bet\bt() call fails if:
+
+ [EAFNOSUPPORT] The specified address family is not supported on this
+ machine.
+
+ [EPROTONOSUPPORT] The protocol type or the specified protocol is not
+ supported within this domain.
+
+ [EPROTOTYPE] The combination of the specified protocol and type is
+ not supported.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ [ENOBUFS] Insufficient resources were available in the system to
+ perform the operation.
+
+ [EACCES] Permission to create a socket of the specified type
+ and/or protocol is denied.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ accept(2), bind(2), connect(2), getsockname(2), getsockopt(2), ioctl(2),
+ listen(2), poll(2), read(2), recv(2), select(2), send(2), setsockopt(2),
+ shutdown(2), socketpair(2), write(2), getprotoent(3), inet(4), inet6(4),
+ netintro(4), unix(4)
+
+ _\bA_\bn _\bI_\bn_\bt_\br_\bo_\bd_\bu_\bc_\bt_\bo_\br_\by _\b4_\b._\b3 _\bB_\bS_\bD _\bI_\bn_\bt_\be_\br_\bp_\br_\bo_\bc_\be_\bs_\bs _\bC_\bo_\bm_\bm_\bu_\bn_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bT_\bu_\bt_\bo_\br_\bi_\ba_\bl, reprinted in
+ UNIX Programmer's Supplementary Documents Volume 1.
+
+ _\bB_\bS_\bD _\bI_\bn_\bt_\be_\br_\bp_\br_\bo_\bc_\be_\bs_\bs _\bC_\bo_\bm_\bm_\bu_\bn_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bT_\bu_\bt_\bo_\br_\bi_\ba_\bl, reprinted in UNIX Programmer's
+ Supplementary Documents Volume 1.
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bso\boc\bck\bke\bet\bt() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bso\boc\bck\bke\bet\bt() system call first appeared in 4.1cBSD.
+
+N\bNA\bAM\bME\bE
+ s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br - create a pair of connected sockets
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br(_\bi_\bn_\bt _\bd, _\bi_\bn_\bt _\bt_\by_\bp_\be, _\bi_\bn_\bt _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl, _\bi_\bn_\bt _\bs_\bv_\b[_\b2_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br() call creates an unnamed pair of connected sockets in the
+ specified domain _\bd, of the specified _\bt_\by_\bp_\be, and using the optionally
+ specified _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl. The descriptors used in referencing the new sockets
+ are returned in _\bs_\bv[0] and _\bs_\bv[1]. The two sockets are indistinguishable.
+
+ Any combination of the following flags may additionally be used in the
+ _\bt_\by_\bp_\be argument:
+
+ SOCK_CLOEXEC Set close-on-exec flag on both the new descriptors.
+ SOCK_NONBLOCK Set non-blocking I/O mode on both the new sockets.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The call succeeds unless:
+
+ [EAFNOSUPPORT] The specified address family is not supported on this
+ machine.
+
+ [EPROTONOSUPPORT] The specified protocol is not supported on this
+ machine.
+
+ [EOPNOTSUPP] The specified protocol does not support creation of
+ socket pairs.
+
+ [EPROTOTYPE] The combination of the specified protocol and type is
+ not supported.
+
+ [EMFILE] The per-process descriptor table is full.
+
+ [ENFILE] The system file table is full.
+
+ [ENOBUFS] Insufficient resources were available in the system to
+ perform the operation.
+
+ [EFAULT] The address _\bs_\bv does not specify a valid part of the
+ process address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ pipe(2), read(2), socket(2), write(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bso\boc\bck\bke\bet\btp\bpa\bai\bir\br() function call appeared in 4.2BSD.
+
+B\bBU\bUG\bGS\bS
+ This call is currently implemented only for the LOCAL domain. Many
+ operating systems only accept a _\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl of PF_UNSPEC, so that should be
+ used instead of PF_LOCAL for maximal portability.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\bt, l\bls\bst\bta\bat\bt, f\bfs\bst\bta\bat\bta\bat\bt, f\bfs\bst\bta\bat\bt - get file status
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ l\bls\bst\bta\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\bta\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt _\b*_\bs_\bb, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bst\bta\bat\bt() function obtains information about the file pointed to by
+ _\bp_\ba_\bt_\bh. Read, write, or execute permission of the named file is not
+ required, but all directories listed in the path name leading to the file
+ must be searchable.
+
+ The l\bls\bst\bta\bat\bt() function is identical to s\bst\bta\bat\bt() except when the named file is
+ a symbolic link, in which case l\bls\bst\bta\bat\bt() returns information about the link
+ itself, not the file the link references.
+
+ The f\bfs\bst\bta\bat\bta\bat\bt() function is equivalent to either the s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt()
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the file whose information is returned is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If f\bfs\bst\bta\bat\bta\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to s\bst\bta\bat\bt() or l\bls\bst\bta\bat\bt(), depending on
+ whether or not the AT_SYMLINK_NOFOLLOW bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the status
+ of the symbolic link is returned.
+
+ The f\bfs\bst\bta\bat\bt() function obtains the same information about an open file
+ known by the file descriptor _\bf_\bd.
+
+ The _\bs_\bb argument is a pointer to a s\bst\bta\bat\bt() structure as defined by
+ <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> (shown below) and into which information is placed
+ concerning the file.
+
+ struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last data modification */
+ struct timespec st_ctim; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize;/* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ };
+
+ The time-related fields of struct stat are represented in struct timespec
+ format, which has nanosecond precision. However, the actual precision is
+ generally limited by the file system holding the file. The fields are as
+ follows:
+
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm Time when file data was last accessed. Set when the file
+ system object was created and updated by the utimes(2) and
+ read(2) system calls.
+
+ _\bs_\bt_\b__\bm_\bt_\bi_\bm Time when file data was last modified. Changed by the
+ truncate(2), utimes(2), and write(2) system calls. For
+ directories, changed by any system call that alters which
+ files are in the directory, such as the unlink(2), rename(2),
+ mkdir(2), and symlink(2) system calls.
+
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm Time when file status was last changed (inode data
+ modification). Changed by the chmod(2), chown(2), link(2),
+ rename(2), unlink(2), utimes(2), and write(2) system calls.
+
+ In addition, all the time fields are set to the current time when a file
+ system object is first created by the mkdir(2), mkfifo(2), mknod(2),
+ open(2), and symlink(2) system calls.
+
+ For compatibility with previous standards, _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be, and
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be macros are provided that expand to the _\bt_\bv_\b__\bs_\be_\bc_\bs member of their
+ respective struct timespec member. Deprecated macros are also provided
+ for some transitional names: _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc, _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bn_\bs_\be_\bc,
+ _\bs_\bt_\b__\ba_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, _\bs_\bt_\b__\bm_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc, and _\bs_\bt_\b__\bc_\bt_\bi_\bm_\be_\bs_\bp_\be_\bc
+
+ The size-related fields of the struct stat are as follows:
+
+ _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be The optimal I/O block size for the file.
+
+ _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs The actual number of blocks allocated for the file in
+ 512-byte units. As short symbolic links are stored in the
+ inode, this number may be zero.
+
+ The status information word _\bs_\bt_\b__\bm_\bo_\bd_\be has the following bits:
+
+ #define S_IFMT 0170000 /* type of file mask */
+ #define S_IFIFO 0010000 /* named pipe (fifo) */
+ #define S_IFCHR 0020000 /* character special */
+ #define S_IFDIR 0040000 /* directory */
+ #define S_IFBLK 0060000 /* block special */
+ #define S_IFREG 0100000 /* regular */
+ #define S_IFLNK 0120000 /* symbolic link */
+ #define S_IFSOCK 0140000 /* socket */
+ #define S_ISUID 0004000 /* set-user-ID on execution */
+ #define S_ISGID 0002000 /* set-group-ID on execution */
+ #define S_ISVTX 0001000 /* save swapped text even after use */
+ #define S_IRWXU 0000700 /* RWX mask for owner */
+ #define S_IRUSR 0000400 /* R for owner */
+ #define S_IWUSR 0000200 /* W for owner */
+ #define S_IXUSR 0000100 /* X for owner */
+ #define S_IRWXG 0000070 /* RWX mask for group */
+ #define S_IRGRP 0000040 /* R for group */
+ #define S_IWGRP 0000020 /* W for group */
+ #define S_IXGRP 0000010 /* X for group */
+ #define S_IRWXO 0000007 /* RWX mask for other */
+ #define S_IROTH 0000004 /* R for other */
+ #define S_IWOTH 0000002 /* W for other */
+ #define S_IXOTH 0000001 /* X for other */
+
+ The following macros test a file's type. If the file is of that type, a
+ non-zero value is returned; otherwise, 0 is returned.
+
+ S_ISBLK(st_mode m) /* block special */
+ S_ISCHR(st_mode m) /* char special */
+ S_ISDIR(st_mode m) /* directory */
+ S_ISFIFO(st_mode m) /* fifo */
+ S_ISLNK(st_mode m) /* symbolic link */
+ S_ISREG(st_mode m) /* regular file */
+ S_ISSOCK(st_mode m) /* socket */
+
+ For a list of access modes, see <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>, access(2), and chmod(2).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] A component of _\bn_\ba_\bm_\be does not exist or _\bn_\ba_\bm_\be is the
+ empty path.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EFAULT] _\bs_\bb or _\bn_\ba_\bm_\be points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ Additionally, f\bfs\bst\bta\bat\bta\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfs\bst\bta\bat\bt() will fail if:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bs_\bb points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from the file
+ system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), chown(2), clock_gettime(2), utimes(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ Previous versions of the system used different types for the _\bs_\bt_\b__\bd_\be_\bv,
+ _\bs_\bt_\b__\bu_\bi_\bd, _\bs_\bt_\b__\bg_\bi_\bd, _\bs_\bt_\b__\br_\bd_\be_\bv, _\bs_\bt_\b__\bs_\bi_\bz_\be, _\bs_\bt_\b__\bb_\bl_\bk_\bs_\bi_\bz_\be, and _\bs_\bt_\b__\bb_\bl_\bo_\bc_\bk_\bs fields.
+
+ The f\bfs\bst\bta\bat\bt(), f\bfs\bst\bta\bat\bta\bat\bt(), l\bls\bst\bta\bat\bt(), and s\bst\bta\bat\bt() functions are intended to
+ conform to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\bt() and f\bfs\bst\bta\bat\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh> header file and the _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt were introduced
+ in Version 7 AT&T UNIX.
+
+ An l\bls\bst\bta\bat\bt() function call appeared in 4.2BSD. The f\bfs\bst\bta\bat\bta\bat\bt() function
+ appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ The file generation number, _\bs_\bt_\b__\bg_\be_\bn, is only available to the superuser.
+
+ Certain programs written when the timestamps were just of type time_t
+ assumed that the members were consecutive (and could therefore be treated
+ as an array and have their address passed directly to utime(3)). The
+ transition to timestamps of type struct timespec broke them irrevocably.
+
+B\bBU\bUG\bGS\bS
+ Applying f\bfs\bst\bta\bat\bt() to a pipe or socket fails to fill in a unique device and
+ inode number pair. Applying f\bfs\bst\bta\bat\bt() to a socket also fails to fill in
+ the time fields.
+
+N\bNA\bAM\bME\bE
+ s\bst\bta\bat\btf\bfs\bs, f\bfs\bst\bta\bat\btf\bfs\bs - get file system statistics
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+ _\bi_\bn_\bt
+ f\bfs\bst\bta\bat\btf\bfs\bs(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bst\bta\bat\btf\bfs\bs() returns information about a mounted file system. _\bp_\ba_\bt_\bh is the
+ path name of any file within the mounted file system. _\bb_\bu_\bf is a pointer
+ to a s\bst\bta\bat\btf\bfs\bs structure defined as follows:
+
+ typedef struct { int32_t val[2]; } fsid_t;
+
+ #define MFSNAMELEN 16 /* length of fs type name, including nul */
+ #define MNAMELEN 90 /* length of buffer for returned name */
+
+ struct statfs {
+ u_int32_t f_flags; /* copy of mount flags */
+ u_int32_t f_bsize; /* file system block size */
+ u_int32_t f_iosize; /* optimal transfer block size */
+
+ /* unit is f_bsize */
+ u_int64_t f_blocks; /* total data blocks in file system */
+ u_int64_t f_bfree; /* free blocks in fs */
+ int64_t f_bavail; /* free blocks avail to non-superuser */
+
+ u_int64_t f_files; /* total file nodes in file system */
+ u_int64_t f_ffree; /* free file nodes in fs */
+ int64_t f_favail; /* free file nodes avail to non-root */
+
+ u_int64_t f_syncwrites; /* count of sync writes since mount */
+ u_int64_t f_syncreads; /* count of sync reads since mount */
+ u_int64_t f_asyncwrites; /* count of async writes since mount */
+ u_int64_t f_asyncreads; /* count of async reads since mount */
+
+ fsid_t f_fsid; /* file system id */
+ u_int32_t f_namemax; /* maximum filename length */
+ uid_t f_owner; /* user that mounted the file system */
+ u_int64_t f_ctime; /* last mount [-u] time */
+
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN]; /* mounted file system */
+ char f_mntfromspec[MNAMELEN]; /* special for mount request */
+ union mount_info mount_info; /* per-filesystem mount options */
+ };
+
+ f\bfs\bst\bta\bat\btf\bfs\bs() returns the same information about an open file referenced by
+ descriptor _\bf_\bd.
+
+ Note that _\bf_\b__\bf_\bs_\bi_\bd will be empty unless the user is the superuser.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bst\bta\bat\btf\bfs\bs() fails if one or more of the following are true:
+
+ [ENOTDIR] A component of the path prefix of _\bp_\ba_\bt_\bh is not a
+ directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The file referred to by _\bp_\ba_\bt_\bh does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix of _\bp_\ba_\bt_\bh.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating _\bp_\ba_\bt_\bh.
+
+ [EFAULT] _\bb_\bu_\bf or _\bp_\ba_\bt_\bh points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ f\bfs\bst\bta\bat\btf\bfs\bs() fails if one or more of the following are true:
+
+ [EBADF] _\bf_\bd is not a valid open file descriptor.
+
+ [EFAULT] _\bb_\bu_\bf points to an invalid address.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ df(1), getfsstat(2), mount(2), stat(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bst\bta\bat\btf\bfs\bs() function first appeared in 4.4BSD.
+
+N\bNA\bAM\bME\bE
+ s\bsw\bwa\bap\bpc\bct\btl\bl - modify swap configuration
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsw\bwa\bap\bp.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsw\bwa\bap\bpc\bct\btl\bl(_\bi_\bn_\bt _\bc_\bm_\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\ba_\br_\bg, _\bi_\bn_\bt _\bm_\bi_\bs_\bc);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsw\bwa\bap\bpc\bct\btl\bl() function is used to add and delete swap devices, and modify
+ their configuration.
+
+ The _\bc_\bm_\bd parameter specifies the operation to be performed. The _\ba_\br_\bg and
+ _\bm_\bi_\bs_\bc parameters have different meanings, depending on the _\bc_\bm_\bd parameter.
+
+ If _\bc_\bm_\bd is SWAP_NSWAP, the current number of swap devices in the
+ system is returned. The _\ba_\br_\bg and _\bm_\bi_\bs_\bc parameters are ignored.
+
+ If _\bc_\bm_\bd is SWAP_STATS, the current statistics for swap devices are
+ returned in the _\ba_\br_\bg parameter. No more than _\bm_\bi_\bs_\bc swap devices are
+ returned. The _\ba_\br_\bg parameter should point to an array of at least
+ _\bm_\bi_\bs_\bc struct swapent structures:
+
+ struct swapent {
+ dev_t se_dev; /* device id */
+ int se_flags; /* entry flags */
+ int se_nblks; /* total blocks */
+ int se_inuse; /* blocks in use */
+ int se_priority; /* priority */
+ char se_path[PATH_MAX]; /* path to entry */
+ };
+
+ The flags are defined as
+
+ SWF_INUSE in use: we have swapped here
+ SWF_ENABLE enabled: we can swap here
+ SWF_BUSY busy: I/O happening here
+ SWF_FAKE fake: still being built
+
+ All but SWAP_NSWAP and SWAP_STATS require superuser privileges.
+
+ If _\bc_\bm_\bd is SWAP_ON, the _\ba_\br_\bg parameter is used as a pathname of a
+ file to enable swapping to. The _\bm_\bi_\bs_\bc parameter is used to set the
+ priority of this swap device.
+
+ If _\bc_\bm_\bd is SWAP_OFF, the _\ba_\br_\bg parameter is used as the pathname of a
+ file to disable swapping from. The _\bm_\bi_\bs_\bc parameter is ignored.
+
+ If _\bc_\bm_\bd is SWAP_CTL, the _\ba_\br_\bg and _\bm_\bi_\bs_\bc parameters have the same
+ function as for the SWAP_ON case, except that they change the
+ priority of a currently enabled swap device.
+
+ When swapping is enabled on a block device, the first portion of the disk
+ is left unused to prevent any disklabel present from being overwritten.
+ This space is allocated from the swap device when the SWAP_ON command is
+ used.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If the _\bc_\bm_\bd parameter is SWAP_NSWAP or SWAP_STATS, s\bsw\bwa\bap\bpc\bct\btl\bl() returns the
+ number of swap devices, if successful. The SWAP_NSWAP command is always
+ successful. Otherwise it returns 0 on success and -1 on failure, setting
+ the global variable _\be_\br_\br_\bn_\bo to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ s\bsw\bwa\bap\bpc\bct\btl\bl() succeeds unless:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named device does not exist. For the SWAP_CTL
+ command, the named device is not currently enabled for
+ swapping.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The caller is not the superuser.
+
+ [EBUSY] The device specified by _\ba_\br_\bg has already been made
+ available for swapping.
+
+ [EINVAL] The device configured by _\ba_\br_\bg has no associated size,
+ or the _\bc_\bm_\bd was unknown.
+
+ [ENXIO] The major device number of _\ba_\br_\bg is out of range (this
+ indicates no device driver exists for the associated
+ hardware).
+
+ [EIO] An I/O error occurred while opening the swap device.
+
+ [EFAULT] _\ba_\br_\bg points outside the process' allocated address
+ space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ config(8), swapctl(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsw\bwa\bap\bpc\bct\btl\bl() function call appeared in NetBSD 1.3. The _\bs_\be_\b__\bp_\ba_\bt_\bh member
+ was added to _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bw_\ba_\bp_\be_\bn_\bt in NetBSD 1.4, when the header file was also
+ moved from <_\bv_\bm_\b/_\bv_\bm_\b__\bs_\bw_\ba_\bp_\b._\bh>.
+
+A\bAU\bUT\bTH\bHO\bOR\bRS\bS
+ The current swap system was designed and implemented by Matthew Green
+ <_\bm_\br_\bg_\b@_\be_\bt_\be_\br_\bn_\ba_\b._\bc_\bo_\bm_\b._\ba_\bu>, with help from Paul Kranenburg <_\bp_\bk_\b@_\bN_\be_\bt_\bB_\bS_\bD_\b._\bO_\bR_\bG> and
+ Leo Weppelman <_\bl_\be_\bo_\b@_\bN_\be_\bt_\bB_\bS_\bD_\b._\bO_\bR_\bG>, and insights from Jason R. Thorpe
+ <_\bt_\bh_\bo_\br_\bp_\be_\bj_\b@_\bN_\be_\bt_\bB_\bS_\bD_\b._\bO_\bR_\bG>.
+
+N\bNA\bAM\bME\bE
+ s\bsy\bym\bml\bli\bin\bnk\bk, s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt - make symbolic link to a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bym\bml\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ A symbolic link _\bn_\ba_\bm_\be_\b2 is created to _\bn_\ba_\bm_\be_\b1 (_\bn_\ba_\bm_\be_\b2 is the name of the file
+ created, _\bn_\ba_\bm_\be_\b1 is the string used in creating the symbolic link). Either
+ name may be an arbitrary path name; the files need not be on the same
+ file system, and the file specified by _\bn_\ba_\bm_\be_\b1 need not exist at all.
+
+ The s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() function is equivalent to s\bsy\bym\bml\bli\bin\bnk\bk() except that where
+ _\bn_\ba_\bm_\be_\b2 specifies a relative path, the newly created symbolic link is
+ created relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used and
+ the behavior is identical to a call to s\bsy\bym\bml\bli\bin\bnk\bk().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The symbolic link succeeds unless:
+
+ [ENOTDIR] A component of the _\bn_\ba_\bm_\be_\b2 prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] A component of the _\bn_\ba_\bm_\be_\b2 path prefix denies search
+ permission.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EEXIST] _\bn_\ba_\bm_\be_\b2 already exists.
+
+ [EIO] An I/O error occurred while making the directory entry
+ for _\bn_\ba_\bm_\be_\b2, or allocating the inode for _\bn_\ba_\bm_\be_\b2, or
+ writing out the link contents of _\bn_\ba_\bm_\be_\b2.
+
+ [EROFS] The file _\bn_\ba_\bm_\be_\b2 would reside on a read-only file
+ system.
+
+ [ENOSPC] The directory in which the entry for the new symbolic
+ link is being placed cannot be extended because there
+ is no space left on the file system containing the
+ directory.
+
+ [ENOSPC] The new symbolic link cannot be created because there
+ is no space left on the file system that will contain
+ the symbolic link.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the symbolic link is being created.
+
+ [EDQUOT] The directory in which the entry for the new symbolic
+ link is being placed cannot be extended because the
+ user's quota of disk blocks on the file system
+ containing the directory has been exhausted.
+
+ [EDQUOT] The new symbolic link cannot be created because the
+ user's quota of disk blocks on the file system that
+ will contain the symbolic link has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the symbolic link is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EFAULT] _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 points outside the process's allocated
+ address space.
+
+ Additionally, s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EBADF] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path and the
+ _\bf_\bd argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path and the
+ _\bf_\bd argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path but
+ search permission is denied for the directory which
+ the _\bf_\bd file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ln(1), link(2), readlink(2), unlink(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsy\bym\bml\bli\bin\bnk\bk() and s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsy\bym\bml\bli\bin\bnk\bk() system call first appeared in 4.1cBSD. The s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt()
+ system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ s\bsy\bym\bml\bli\bin\bnk\bk, s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt - make symbolic link to a file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bym\bml\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b1, _\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be_\b2);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ A symbolic link _\bn_\ba_\bm_\be_\b2 is created to _\bn_\ba_\bm_\be_\b1 (_\bn_\ba_\bm_\be_\b2 is the name of the file
+ created, _\bn_\ba_\bm_\be_\b1 is the string used in creating the symbolic link). Either
+ name may be an arbitrary path name; the files need not be on the same
+ file system, and the file specified by _\bn_\ba_\bm_\be_\b1 need not exist at all.
+
+ The s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() function is equivalent to s\bsy\bym\bml\bli\bin\bnk\bk() except that where
+ _\bn_\ba_\bm_\be_\b2 specifies a relative path, the newly created symbolic link is
+ created relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used and
+ the behavior is identical to a call to s\bsy\bym\bml\bli\bin\bnk\bk().
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The symbolic link succeeds unless:
+
+ [ENOTDIR] A component of the _\bn_\ba_\bm_\be_\b2 prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] A component of the _\bn_\ba_\bm_\be_\b2 path prefix denies search
+ permission.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EEXIST] _\bn_\ba_\bm_\be_\b2 already exists.
+
+ [EIO] An I/O error occurred while making the directory entry
+ for _\bn_\ba_\bm_\be_\b2, or allocating the inode for _\bn_\ba_\bm_\be_\b2, or
+ writing out the link contents of _\bn_\ba_\bm_\be_\b2.
+
+ [EROFS] The file _\bn_\ba_\bm_\be_\b2 would reside on a read-only file
+ system.
+
+ [ENOSPC] The directory in which the entry for the new symbolic
+ link is being placed cannot be extended because there
+ is no space left on the file system containing the
+ directory.
+
+ [ENOSPC] The new symbolic link cannot be created because there
+ is no space left on the file system that will contain
+ the symbolic link.
+
+ [ENOSPC] There are no free inodes on the file system on which
+ the symbolic link is being created.
+
+ [EDQUOT] The directory in which the entry for the new symbolic
+ link is being placed cannot be extended because the
+ user's quota of disk blocks on the file system
+ containing the directory has been exhausted.
+
+ [EDQUOT] The new symbolic link cannot be created because the
+ user's quota of disk blocks on the file system that
+ will contain the symbolic link has been exhausted.
+
+ [EDQUOT] The user's quota of inodes on the file system on which
+ the symbolic link is being created has been exhausted.
+
+ [EIO] An I/O error occurred while making the directory entry
+ or allocating the inode.
+
+ [EFAULT] _\bn_\ba_\bm_\be_\b1 or _\bn_\ba_\bm_\be_\b2 points outside the process's allocated
+ address space.
+
+ Additionally, s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [EBADF] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path and the
+ _\bf_\bd argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path and the
+ _\bf_\bd argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bn_\ba_\bm_\be_\b2 argument specifies a relative path but
+ search permission is denied for the directory which
+ the _\bf_\bd file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ ln(1), link(2), readlink(2), unlink(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsy\bym\bml\bli\bin\bnk\bk() and s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsy\bym\bml\bli\bin\bnk\bk() system call first appeared in 4.1cBSD. The s\bsy\bym\bml\bli\bin\bnk\bka\bat\bt()
+ system call has been available since OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ s\bsy\byn\bnc\bc - synchronize disk block in-core status with that on disk
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bv_\bo_\bi_\bd
+ s\bsy\byn\bnc\bc(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The s\bsy\byn\bnc\bc() function forces a write of dirty (modified) buffers in the
+ block buffer cache out to disk. The kernel keeps this information in
+ core to reduce the number of disk I/O transfers required by the system.
+ As information in the cache is lost after a system crash a s\bsy\byn\bnc\bc() call is
+ issued frequently by the in-kernel process update (about every 30
+ seconds).
+
+ The function fsync(2) may be used to synchronize individual file
+ descriptor attributes.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fsync(2), sync(8)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The s\bsy\byn\bnc\bc() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A s\bsy\byn\bnc\bc() function call appeared in Version 2 AT&T UNIX.
+
+B\bBU\bUG\bGS\bS
+ s\bsy\byn\bnc\bc() may return before the buffers are completely flushed.
+
+N\bNA\bAM\bME\bE
+ s\bsy\bys\bsa\bar\brc\bch\bh - architecture-dependent system call
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bys\bsa\bar\brc\bch\bh(_\bi_\bn_\bt _\bn_\bu_\bm_\bb_\be_\br, _\bv_\bo_\bi_\bd _\b*_\ba_\br_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsy\bys\bsa\bar\brc\bch\bh() performs the architecture-dependent function specified by
+ _\bn_\bu_\bm_\bb_\be_\br with the arguments specified by the _\ba_\br_\bg_\bs pointer. _\ba_\br_\bg_\bs is a
+ pointer to a structure defining the actual arguments of the function.
+ Symbolic constants and argument structures for the architecture-dependent
+ functions can be found in the header file <_\bm_\ba_\bc_\bh_\bi_\bn_\be_\b/_\bs_\by_\bs_\ba_\br_\bc_\bh_\b._\bh>.
+
+ The s\bsy\bys\bsa\bar\brc\bch\bh() system call should never be called directly by user
+ programs. Instead, they should access its functions using the
+ architecture-dependent library.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ See the manual pages for specific architecture-dependent function calls
+ for information about their return values.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The s\bsy\bys\bsa\bar\brc\bch\bh() function call appeared in NetBSD 0.9a.
+
+N\bNA\bAM\bME\bE
+ s\bsy\bys\bsc\bca\bal\bll\bl, _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl - indirect system call
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bsy\bys\bsc\bca\bal\bll\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ s\bsy\bys\bsc\bca\bal\bll\bl(_\bi_\bn_\bt _\bn_\bu_\bm_\bb_\be_\br, _\b._\b._\b.);
+
+ _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl(_\bq_\bu_\ba_\bd_\b__\bt _\bn_\bu_\bm_\bb_\be_\br, _\b._\b._\b.);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ s\bsy\bys\bsc\bca\bal\bll\bl() performs the system call whose assembly language interface has
+ the specified _\bn_\bu_\bm_\bb_\be_\br with the specified arguments. Symbolic constants
+ for system calls can be found in the header file <_\bs_\by_\bs_\b/_\bs_\by_\bs_\bc_\ba_\bl_\bl_\b._\bh>.
+
+ Since different system calls have different return types, a prototype of
+ _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl specifying the correct return type should be declared locally.
+ This is especially important for system calls returning larger-than-int
+ results.
+
+ The _\b__\b_s\bsy\bys\bsc\bca\bal\bll\bl form should be used when one or more of the parameters is a
+ 64-bit argument to ensure that argument alignment is correct. This
+ system call is useful for testing new system calls that do not have
+ entries in the C library.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The return values are defined by the system call being invoked. In
+ general, for system calls returning _\bi_\bn_\bt, a 0 return value indicates
+ success. A -1 return value indicates an error, and an error code is
+ stored in _\be_\br_\br_\bn_\bo.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessor of these functions, the former i\bin\bnd\bdi\bir\br() system call, first
+ appeared in Version 4 AT&T UNIX. The s\bsy\bys\bsc\bca\bal\bll\bl() function first appeared
+ in 3BSD.
+
+B\bBU\bUG\bGS\bS
+ There is no way to simulate system calls that have multiple return values
+ such as pipe(2).
+
+N\bNA\bAM\bME\bE
+ t\btr\bru\bun\bnc\bca\bat\bte\be, f\bft\btr\bru\bun\bnc\bca\bat\bte\be - truncate or extend a file to a specified length
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ t\btr\bru\bun\bnc\bca\bat\bte\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bo_\bf_\bf_\b__\bt _\bl_\be_\bn_\bg_\bt_\bh);
+
+ _\bi_\bn_\bt
+ f\bft\btr\bru\bun\bnc\bca\bat\bte\be(_\bi_\bn_\bt _\bf_\bd, _\bo_\bf_\bf_\b__\bt _\bl_\be_\bn_\bg_\bt_\bh);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ t\btr\bru\bun\bnc\bca\bat\bte\be() causes the file named by _\bp_\ba_\bt_\bh or referenced by _\bf_\bd to be
+ truncated or extended to _\bl_\be_\bn_\bg_\bt_\bh bytes in size. If the file was larger
+ than this size, the extra data is lost. If the file was smaller than
+ this size, it will be extended as if by writing bytes with the value
+ zero. With f\bft\btr\bru\bun\bnc\bca\bat\bte\be(), the file must be open for writing.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() will succeed unless:
+
+ [EINVAL] The _\bl_\be_\bn_\bg_\bt_\bh is a negative value.
+
+ [EIO] An I/O error occurred updating the inode.
+
+ In addition, t\btr\bru\bun\bnc\bca\bat\bte\be() may return the following errors:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] The named file is not writable by the user.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EISDIR] The named file is a directory.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [ETXTBSY] The file is a pure procedure (shared text) file that
+ is being executed.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ f\bft\btr\bru\bun\bnc\bca\bat\bte\be() may return the following errors:
+
+ [EBADF] The _\bf_\bd is not a valid descriptor.
+
+ [EINVAL] The _\bf_\bd references a socket, not a file.
+
+ [EINVAL] The _\bf_\bd is not open for writing.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ open(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The t\btr\bru\bun\bnc\bca\bat\bte\be() and f\bft\btr\bru\bun\bnc\bca\bat\bte\be() system calls first appeared in 4.1cBSD.
+
+B\bBU\bUG\bGS\bS
+ These calls should be generalized to allow ranges of bytes in a file to
+ be discarded.
+
+ Use of t\btr\bru\bun\bnc\bca\bat\bte\be() to extend a file is not portable.
+
+N\bNA\bAM\bME\bE
+ u\bum\bma\bas\bsk\bk - set file creation mode mask
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+
+ _\bm_\bo_\bd_\be_\b__\bt
+ u\bum\bma\bas\bsk\bk(_\bm_\bo_\bd_\be_\b__\bt _\bn_\bu_\bm_\ba_\bs_\bk);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The u\bum\bma\bas\bsk\bk() routine sets the process's file mode creation mask to _\bn_\bu_\bm_\ba_\bs_\bk
+ and returns the previous value of the mask. The 9 low-order access
+ permission bits of _\bn_\bu_\bm_\ba_\bs_\bk are used by system calls, including open(2),
+ mkdir(2), mkfifo(2) and mknod(2) to turn off corresponding bits requested
+ in the file mode (see chmod(2)). This clearing allows each user to
+ restrict the default access to his files.
+
+ The default mask value is S_IWGRP|S_IWOTH (022, write access for the
+ owner only). Child processes inherit the mask of the calling process.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ The previous value of the file mode mask is returned by the call.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The u\bum\bma\bas\bsk\bk() function is always successful.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ chmod(2), mkdir(2), mkfifo(2), mknod(2), open(2)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\bum\bma\bas\bsk\bk() function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The u\bum\bma\bas\bsk\bk() system call first appeared in Version 7 AT&T UNIX.
+
+N\bNA\bAM\bME\bE
+ u\bun\bnl\bli\bin\bnk\bk, u\bun\bnl\bli\bin\bnk\bka\bat\bt - remove directory entry
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\bun\bnl\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\bun\bnl\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The u\bun\bnl\bli\bin\bnk\bk() function removes the link named by _\bp_\ba_\bt_\bh from its directory
+ and decrements the link count of the file which was referenced by the
+ link. If that decrement reduces the link count of the file to zero, and
+ no process has the file open, then all resources associated with the file
+ are reclaimed. If one or more processes have the file open when the last
+ link is removed, the link is removed, but the removal of the file is
+ delayed until all references to it have been closed.
+
+ The u\bun\bnl\bli\bin\bnk\bka\bat\bt() function is equivalent to either the u\bun\bnl\bli\bin\bnk\bk() or rmdir(2)
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the directory entry to be removed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If u\bun\bnl\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to u\bun\bnl\bli\bin\bnk\bk() or rmdir(2), depending on
+ whether or not the AT_REMOVEDIR bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_REMOVEDIR Remove the directory entry specified by _\bp_\ba_\bt_\bh as a
+ directory, not a normal file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The u\bun\bnl\bli\bin\bnk\bk() and u\bun\bnl\bli\bin\bnk\bka\bat\bt() functions will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] Write permission is denied on the directory containing
+ the link to be removed.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The named file is a directory and the effective user
+ ID of the process is not the superuser, or the file
+ system containing the file does not permit the use of
+ u\bun\bnl\bli\bin\bnk\bk() on a directory.
+
+ [EPERM] The directory containing the file is marked sticky,
+ and neither the containing directory nor the file to
+ be removed are owned by the effective user ID.
+
+ [EPERM] The named file or the directory containing it has its
+ immutable or append-only flag set (see chflags(2)).
+
+ [EBUSY] The entry to be unlinked is the mount point for a
+ mounted file system.
+
+ [EIO] An I/O error occurred while deleting the directory
+ entry or deallocating the inode.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, u\bun\bnl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [ENOTDIR] The AT_REMOVEDIR flag bit is set and _\bp_\ba_\bt_\bh does not
+ name a directory.
+
+ [ENOTEMPTY] The AT_REMOVEDIR flag bit is set and the named
+ directory contains files other than `.' and `..' in
+ it.
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_REMOVEDIR.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ rm(1), chflags(2), close(2), link(2), rmdir(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\bun\bnl\bli\bin\bnk\bk() and u\bun\bnl\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The u\bun\bnl\bli\bin\bnk\bk() system call first appeared in Version 1 AT&T UNIX. The
+ u\bun\bnl\bli\bin\bnk\bka\bat\bt() function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ u\bun\bnl\bli\bin\bnk\bk, u\bun\bnl\bli\bin\bnk\bka\bat\bt - remove directory entry
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\bun\bnl\bli\bin\bnk\bk(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\bun\bnl\bli\bin\bnk\bka\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The u\bun\bnl\bli\bin\bnk\bk() function removes the link named by _\bp_\ba_\bt_\bh from its directory
+ and decrements the link count of the file which was referenced by the
+ link. If that decrement reduces the link count of the file to zero, and
+ no process has the file open, then all resources associated with the file
+ are reclaimed. If one or more processes have the file open when the last
+ link is removed, the link is removed, but the removal of the file is
+ delayed until all references to it have been closed.
+
+ The u\bun\bnl\bli\bin\bnk\bka\bat\bt() function is equivalent to either the u\bun\bnl\bli\bin\bnk\bk() or rmdir(2)
+ function depending on the value of _\bf_\bl_\ba_\bg (see below), except that where
+ _\bp_\ba_\bt_\bh specifies a relative path, the directory entry to be removed is
+ determined relative to the directory associated with file descriptor _\bf_\bd
+ instead of the current working directory.
+
+ If u\bun\bnl\bli\bin\bnk\bka\bat\bt() is passed the special value AT_FDCWD (defined in <_\bf_\bc_\bn_\bt_\bl_\b._\bh>)
+ in the _\bf_\bd parameter, the current working directory is used and the
+ behavior is identical to a call to u\bun\bnl\bli\bin\bnk\bk() or rmdir(2), depending on
+ whether or not the AT_REMOVEDIR bit is set in _\bf_\bl_\ba_\bg.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_REMOVEDIR Remove the directory entry specified by _\bp_\ba_\bt_\bh as a
+ directory, not a normal file.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ The u\bun\bnl\bli\bin\bnk\bk() and u\bun\bnl\bli\bin\bnk\bka\bat\bt() functions will fail if:
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix.
+
+ [EACCES] Write permission is denied on the directory containing
+ the link to be removed.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [EPERM] The named file is a directory and the effective user
+ ID of the process is not the superuser, or the file
+ system containing the file does not permit the use of
+ u\bun\bnl\bli\bin\bnk\bk() on a directory.
+
+ [EPERM] The directory containing the file is marked sticky,
+ and neither the containing directory nor the file to
+ be removed are owned by the effective user ID.
+
+ [EPERM] The named file or the directory containing it has its
+ immutable or append-only flag set (see chflags(2)).
+
+ [EBUSY] The entry to be unlinked is the mount point for a
+ mounted file system.
+
+ [EIO] An I/O error occurred while deleting the directory
+ entry or deallocating the inode.
+
+ [EROFS] The named file resides on a read-only file system.
+
+ [EFAULT] _\bp_\ba_\bt_\bh points outside the process's allocated address
+ space.
+
+ Additionally, u\bun\bnl\bli\bin\bnk\bka\bat\bt() will fail if:
+
+ [ENOTDIR] The AT_REMOVEDIR flag bit is set and _\bp_\ba_\bt_\bh does not
+ name a directory.
+
+ [ENOTEMPTY] The AT_REMOVEDIR flag bit is set and the named
+ directory contains files other than `.' and `..' in
+ it.
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_REMOVEDIR.
+
+ [EBADF] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bp_\ba_\bt_\bh argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bp_\ba_\bt_\bh argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ rm(1), chflags(2), close(2), link(2), rmdir(2), symlink(7)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\bun\bnl\bli\bin\bnk\bk() and u\bun\bnl\bli\bin\bnk\bka\bat\bt() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The u\bun\bnl\bli\bin\bnk\bk() system call first appeared in Version 1 AT&T UNIX. The
+ u\bun\bnl\bli\bin\bnk\bka\bat\bt() function appeared in OpenBSD 5.0.
+
+N\bNA\bAM\bME\bE
+ m\bmo\bou\bun\bnt\bt, u\bun\bnm\bmo\bou\bun\bnt\bt - mount or dismount a filesystem
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ m\bmo\bou\bun\bnt\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bt_\by_\bp_\be, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bv_\bo_\bi_\bd _\b*_\bd_\ba_\bt_\ba);
+
+ _\bi_\bn_\bt
+ u\bun\bnm\bmo\bou\bun\bnt\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The m\bmo\bou\bun\bnt\bt() function grafts a filesystem object onto the system file tree
+ at the point _\bd_\bi_\br. The argument _\bd_\ba_\bt_\ba describes the filesystem object to
+ be mounted. The argument _\bt_\by_\bp_\be tells the kernel how to interpret _\bd_\ba_\bt_\ba
+ (see _\bt_\by_\bp_\be below). The contents of the filesystem become available
+ through the new mount point _\bd_\bi_\br. Any files in _\bd_\bi_\br at the time of a
+ successful mount are swept under the carpet, so to speak, and are
+ unavailable until the filesystem is unmounted.
+
+ The following _\bf_\bl_\ba_\bg_\bs may be specified to suppress default semantics which
+ affect filesystem access.
+
+ MNT_RDONLY The filesystem should be treated as read-only: even the
+ superuser may not write to it.
+
+ MNT_NOATIME Do not update the access time on files in the filesystem
+ unless the modification or status change times are also
+ being updated.
+
+ MNT_NOEXEC Do not allow files to be executed from the filesystem.
+
+ MNT_NOSUID Do not honor setuid or setgid bits on files when
+ executing them.
+
+ MNT_NODEV Do not interpret special files on the filesystem.
+
+ MNT_SYNCHRONOUS All I/O to the filesystem should be done synchronously.
+
+ MNT_ASYNC All I/O to the filesystem should be done asynchronously.
+
+ MNT_SOFTDEP Use soft dependencies. Applies to FFS filesystems only
+ (see 'softdep' in mount(8)).
+
+ The flag MNT_UPDATE indicates that the mount command is being applied to
+ an already mounted filesystem. This allows the mount flags to be changed
+ without requiring that the filesystem be unmounted and remounted. Some
+ filesystems may not allow all flags to be changed. For example, most
+ filesystems will not allow a change from read-write to read-only.
+
+ The _\bt_\by_\bp_\be argument defines the type of the filesystem. The types of
+ filesystems known to the system are defined in <_\bs_\by_\bs_\b/_\bm_\bo_\bu_\bn_\bt_\b._\bh>. _\bd_\ba_\bt_\ba is a
+ pointer to a structure that contains the type specific arguments to
+ mount. The currently supported types of filesystems and their type
+ specific data are:
+
+ MOUNT_CD9660
+ struct iso_args {
+ char *fspec; /* block special device to mount */
+ struct export_args export_info;
+ /* network export info */
+ int flags; /* mounting flags, see below */
+ };
+ #define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
+ #define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
+ #define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
+ #define ISOFSMNT_NOJOLIET 0x00000008 /* disable Joliet Ext.*/
+ #define ISOFSMNT_SESS 0x00000010 /* use iso_args.sess */
+
+ MOUNT_FFS
+ struct ufs_args {
+ char *fspec; /* block special file to mount */
+ struct export_args export_info;
+ /* network export information */
+ };
+
+ MOUNT_MFS
+ struct mfs_args {
+ char *fspec; /* name to export for statfs */
+ struct export_args export_info;
+ /* if we can export an MFS */
+ caddr_t base; /* base of filesystem in mem */
+ u_long size; /* size of filesystem */
+ };
+
+ MOUNT_MSDOS
+ struct msdosfs_args {
+ char *fspec; /* blocks special holding fs to mount */
+ struct export_args export_info;
+ /* network export information */
+ uid_t uid; /* uid that owns msdosfs files */
+ gid_t gid; /* gid that owns msdosfs files */
+ mode_t mask; /* mask to be applied for msdosfs perms */
+ int flags; /* see below */
+ };
+
+ /*
+ * Msdosfs mount options:
+ */
+ #define MSDOSFSMNT_SHORTNAME 1 /* Force old DOS short names only */
+ #define MSDOSFSMNT_LONGNAME 2 /* Force Win'95 long names */
+ #define MSDOSFSMNT_NOWIN95 4 /* Completely ignore Win95 entries */
+
+ MOUNT_NFS
+ struct nfs_args {
+ int version; /* args structure version */
+ struct sockaddr *addr; /* file server address */
+ int addrlen; /* length of address */
+ int sotype; /* Socket type */
+ int proto; /* and Protocol */
+ u_char *fh; /* File handle to be mounted */
+ int fhsize; /* Size, in bytes, of fh */
+ int flags; /* flags */
+ int wsize; /* write size in bytes */
+ int rsize; /* read size in bytes */
+ int readdirsize; /* readdir size in bytes */
+ int timeo; /* initial timeout in .1 secs */
+ int retrans; /* times to retry send */
+ int maxgrouplist; /* Max. size of group list */
+ int readahead; /* # of blocks to readahead */
+ int leaseterm; /* Term (sec) of lease */
+ int deadthresh; /* Retrans threshold */
+ char *hostname; /* server's name */
+ int acregmin; /* Attr cache file recently modified */
+ int acregmax; /* ac file not recently modified */
+ int acdirmin; /* ac for dir recently modified */
+ int acdirmax; /* ac for dir not recently modified */
+ };
+
+ MOUNT_NTFS
+ struct ntfs_args {
+ char *fspec; /* block special device to mount */
+ struct export_args export_info;
+ /* network export information */
+ uid_t uid; /* uid that owns ntfs files */
+ gid_t gid; /* gid that owns ntfs files */
+ mode_t mode; /* mask to be applied for ntfs perms */
+ u_long flag; /* additional flags */
+ };
+
+ /*
+ * ntfs mount options:
+ */
+ #define NTFS_MFLAG_CASEINS 0x00000001
+ #define NTFS_MFLAG_ALLNAMES 0x00000002
+
+ MOUNT_UDF
+ struct udf_args {
+ char *fspec; /* block special device to mount */
+ };
+
+ The u\bun\bnm\bmo\bou\bun\bnt\bt() function call disassociates the filesystem from the
+ specified mount point _\bd_\bi_\br.
+
+ The _\bf_\bl_\ba_\bg_\bs argument may specify MNT_FORCE to specify that the filesystem
+ should be forcibly unmounted even if files are still active. Active
+ special devices continue to work, but any further accesses to any other
+ active files result in errors even if the filesystem is later remounted.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ m\bmo\bou\bun\bnt\bt() will fail when one of the following occurs:
+
+ [EPERM] The caller is not the superuser.
+
+ [ENAMETOOLONG] The path name exceeded {MNAMELEN} characters.
+
+ [ELOOP] Too many symbolic links were encountered in translating a
+ pathname.
+
+ [ENOENT] A component of _\bd_\bi_\br does not exist.
+
+ [ENOTDIR] A component of _\bn_\ba_\bm_\be is not a directory, or a path prefix
+ of _\bs_\bp_\be_\bc_\bi_\ba_\bl is not a directory.
+
+ [EINVAL] An argument given was invalid.
+
+ [EBUSY] Another process currently holds a reference to _\bd_\bi_\br.
+
+ [EFAULT] _\bd_\bi_\br points outside the process's allocated address space.
+
+ [EOPNOTSUPP] _\bt_\by_\bp_\be is not supported by the kernel.
+
+ The following errors can occur for a ``ufs'' filesystem mount:
+
+ [ENODEV] A component of ufs_args _\bf_\bs_\bp_\be_\bc does not exist.
+
+ [ENOTBLK] _\bf_\bs_\bp_\be_\bc is not a block device.
+
+ [ENXIO] The major device number of _\bf_\bs_\bp_\be_\bc is out of range (this
+ indicates no device driver exists for the associated
+ hardware).
+
+ [EBUSY] _\bf_\bs_\bp_\be_\bc is already mounted.
+
+ [EINVAL] The super block for the filesystem had a bad magic number, an
+ out of range block size, or an invalid combination of flags.
+
+ [ENOMEM] Not enough memory was available to read the cylinder group
+ information for the filesystem.
+
+ [EIO] An I/O error occurred while reading the super block or
+ cylinder group information.
+
+ [EFAULT] _\bf_\bs_\bp_\be_\bc points outside the process's allocated address space.
+
+ [EROFS] The filesystem was not unmounted cleanly and MNT_FORCE was not
+ specified.
+
+ [EROFS] An attempt was made to mount a 4.2BSD filesystem without the
+ MNT_RDONLY flag.
+
+ The following errors can occur for an _\bN_\bF_\bS filesystem mount:
+
+ [ETIMEDOUT] _\bN_\bF_\bS timed out trying to contact the server.
+
+ [EFAULT] Some part of the information described by nfs_args points
+ outside the process's allocated address space.
+
+ The following errors can occur for a _\bm_\bf_\bs filesystem mount:
+
+ [EMFILE] No space remains in the mount table.
+
+ [EINVAL] The super block for the filesystem had a bad magic number or an
+ out of range block size.
+
+ [ENOMEM] Not enough memory was available to read the cylinder group
+ information for the filesystem.
+
+ [EIO] A paging error occurred while reading the super block or
+ cylinder group information.
+
+ [EFAULT] _\bN_\ba_\bm_\be points outside the process's allocated address space.
+
+ u\bun\bnm\bmo\bou\bun\bnt\bt() may fail with one of the following errors:
+
+ [EPERM] The caller is not the superuser.
+
+ [ENOTDIR] A component of the path is not a directory.
+
+ [EINVAL] An argument given was invalid.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters,
+ or an entire pathname (including the terminating NUL)
+ exceeded PATH_MAX bytes.
+
+ [ELOOP] Too many symbolic links were encountered in translating
+ the pathname.
+
+ [EINVAL] The requested directory is not in the mount table.
+
+ [EBUSY] A process is holding a reference to a file located on the
+ filesystem.
+
+ [EIO] An I/O error occurred while writing cached filesystem
+ information.
+
+ [EFAULT] _\bd_\bi_\br points outside the process's allocated address space.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ statfs(2), mfs(8), mount(8), umount(8)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The m\bmo\bou\bun\bnt\bt() and u\bun\bnm\bmo\bou\bun\bnt\bt() system calls first appeared in Version 1 AT&T
+ UNIX. The _\bf_\bl_\ba_\bg_\bs argument is supported by m\bmo\bou\bun\bnt\bt() since Version 5 AT&T
+ UNIX and by u\bun\bnm\bmo\bou\bun\bnt\bt() since 4.3BSD-Reno. The current calling convention
+ involving _\bt_\by_\bp_\be and _\bd_\ba_\bt_\ba arguments was introduced by 4.3BSD-Reno as well.
+
+B\bBU\bUG\bGS\bS
+ Some of the error codes need translation to more obvious messages.
+
+N\bNA\bAM\bME\bE
+ u\but\bti\bim\bme\bes\bs, f\bfu\but\bti\bim\bme\bes\bs, u\but\bti\bim\bme\ben\bns\bsa\bat\bt, f\bfu\but\bti\bim\bme\ben\bns\bs - set file access and modification
+ times
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\bes\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\bes\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\ben\bns\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b],
+ _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\ben\bns\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The access and modification times of the file named by _\bp_\ba_\bt_\bh or referenced
+ by _\bf_\bd are changed as specified by the argument _\bt_\bi_\bm_\be_\bs.
+
+ If _\bt_\bi_\bm_\be_\bs is NULL, the access and modification times are set to the
+ current time. The caller must be the owner of the file, have permission
+ to write the file, or be the superuser.
+
+ If _\bt_\bi_\bm_\be_\bs is non-null, it is assumed to point to an array of two timeval
+ structures. The access time is set to the value of the first element,
+ and the modification time is set to the value of the second element. The
+ caller must be the owner of the file or be the superuser.
+
+ In either case, the inode-change-time of the file is set to the current
+ time.
+
+ The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() are equivalent to u\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\bes\bs(),
+ respectively, with the following differences.
+
+ Both u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() take two timespec values instead of two
+ timeval values. Further, either of the _\bt_\bv_\b__\bn_\bs_\be_\bc fields can be set to one
+ of the following special values defined in <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>:
+
+ UTIME_NOW Set the respective timestamp to the greatest value
+ supported that is not greater than the current time.
+ UTIME_OMIT Do not change the respective timestamp.
+
+ Additionally, if the _\bp_\ba_\bt_\bh argument to u\but\bti\bim\bme\ben\bns\bsa\bat\bt() specifies a relative
+ path, the file whose timestamps are changed is determined relative to the
+ directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If u\but\bti\bim\bme\ben\bns\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ timestamps of the symbolic link are changed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ u\but\bti\bim\bme\bes\bs() and u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix; or the _\bt_\bi_\bm_\be_\bs argument is NULL and the
+ effective user ID of the process does not match the
+ owner of the file, and is not the superuser, and write
+ access is denied.
+
+ [EFAULT] _\bf_\bi_\bl_\be or _\bt_\bi_\bm_\be_\bs points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+ Additionally, u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bf_\bi_\bl_\be argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfu\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\ben\bns\bs() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EACCES] The _\bt_\bi_\bm_\be_\bs argument is NULL and the effective user ID
+ of the process does not match the owner of the file,
+ and is not the superuser, and write access is denied.
+
+ [EFAULT] _\bt_\bi_\bm_\be_\bs points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), stat(2), utime(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\but\bti\bim\bme\bes\bs(), u\but\bti\bim\bme\ben\bns\bsa\bat\bt(), and f\bfu\but\bti\bim\bme\ben\bns\bs() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessors of u\but\bti\bim\bme\bes\bs() were s\bsm\bmd\bda\bat\bte\be() in Version 1 AT&T UNIX,
+ m\bmd\bda\bat\bte\be() in Version 3 AT&T UNIX, and u\but\bti\bim\bme\be() in Version 7 AT&T UNIX; the
+ latter first supported the concept of an access time in addition to the
+ modification time.
+
+ The u\but\bti\bim\bme\bes\bs() function call appeared in 4.2BSD. The f\bfu\but\bti\bim\bme\bes\bs() function
+ call appeared in NetBSD 1.2. The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() function
+ calls appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and
+ f\bfu\but\bti\bim\bme\ben\bns\bs() shall mark the last file status change timestamp (i.e.
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm) for update upon successful completion. However, currently some
+ filesystems (e.g. UFS) will not do so if UTIME_OMIT is specified for the
+ modification timestamp argument.
+
+N\bNA\bAM\bME\bE
+ u\but\bti\bim\bme\bes\bs, f\bfu\but\bti\bim\bme\bes\bs, u\but\bti\bim\bme\ben\bns\bsa\bat\bt, f\bfu\but\bti\bim\bme\ben\bns\bs - set file access and modification
+ times
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bti\bim\bme\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\bes\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\bes\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bv_\ba_\bl _\b*_\bt_\bi_\bm_\be_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bfc\bcn\bnt\btl\bl.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\bti\bim\bme\ben\bns\bsa\bat\bt(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b],
+ _\bi_\bn_\bt _\bf_\bl_\ba_\bg);
+
+ _\bi_\bn_\bt
+ f\bfu\but\bti\bim\bme\ben\bns\bs(_\bi_\bn_\bt _\bf_\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bt_\bi_\bm_\be_\bs_\bp_\be_\bc _\bt_\bi_\bm_\be_\bs_\b[_\b2_\b]);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The access and modification times of the file named by _\bp_\ba_\bt_\bh or referenced
+ by _\bf_\bd are changed as specified by the argument _\bt_\bi_\bm_\be_\bs.
+
+ If _\bt_\bi_\bm_\be_\bs is NULL, the access and modification times are set to the
+ current time. The caller must be the owner of the file, have permission
+ to write the file, or be the superuser.
+
+ If _\bt_\bi_\bm_\be_\bs is non-null, it is assumed to point to an array of two timeval
+ structures. The access time is set to the value of the first element,
+ and the modification time is set to the value of the second element. The
+ caller must be the owner of the file or be the superuser.
+
+ In either case, the inode-change-time of the file is set to the current
+ time.
+
+ The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() are equivalent to u\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\bes\bs(),
+ respectively, with the following differences.
+
+ Both u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() take two timespec values instead of two
+ timeval values. Further, either of the _\bt_\bv_\b__\bn_\bs_\be_\bc fields can be set to one
+ of the following special values defined in <_\bs_\by_\bs_\b/_\bs_\bt_\ba_\bt_\b._\bh>:
+
+ UTIME_NOW Set the respective timestamp to the greatest value
+ supported that is not greater than the current time.
+ UTIME_OMIT Do not change the respective timestamp.
+
+ Additionally, if the _\bp_\ba_\bt_\bh argument to u\but\bti\bim\bme\ben\bns\bsa\bat\bt() specifies a relative
+ path, the file whose timestamps are changed is determined relative to the
+ directory associated with file descriptor _\bf_\bd instead of the current
+ working directory.
+
+ If u\but\bti\bim\bme\ben\bns\bsa\bat\bt() is passed the special value AT_FDCWD (defined in
+ <_\bf_\bc_\bn_\bt_\bl_\b._\bh>) in the _\bf_\bd parameter, the current working directory is used.
+
+ The _\bf_\bl_\ba_\bg argument is the bitwise OR of zero or more of the following
+ values:
+
+ AT_SYMLINK_NOFOLLOW If _\bp_\ba_\bt_\bh names a symbolic link, then the
+ timestamps of the symbolic link are changed.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ u\but\bti\bim\bme\bes\bs() and u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EACCES] Search permission is denied for a component of the
+ path prefix; or the _\bt_\bi_\bm_\be_\bs argument is NULL and the
+ effective user ID of the process does not match the
+ owner of the file, and is not the superuser, and write
+ access is denied.
+
+ [EFAULT] _\bf_\bi_\bl_\be or _\bt_\bi_\bm_\be_\bs points outside the process's allocated
+ address space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [ELOOP] Too many symbolic links were encountered in
+ translating the pathname.
+
+ [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX
+ characters, or an entire pathname (including the
+ terminating NUL) exceeded PATH_MAX bytes.
+
+ [ENOENT] The named file does not exist.
+
+ [ENOTDIR] A component of the path prefix is not a directory.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+ Additionally, u\but\bti\bim\bme\ben\bns\bsa\bat\bt() will fail if:
+
+ [EINVAL] The value of the _\bf_\bl_\ba_\bg argument was neither zero nor
+ AT_SYMLINK_NOFOLLOW.
+
+ [EBADF] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is neither AT_FDCWD nor a valid file
+ descriptor.
+
+ [ENOTDIR] The _\bf_\bi_\bl_\be argument specifies a relative path and the _\bf_\bd
+ argument is a valid file descriptor but it does not
+ reference a directory.
+
+ [EACCES] The _\bf_\bi_\bl_\be argument specifies a relative path but search
+ permission is denied for the directory which the _\bf_\bd
+ file descriptor references.
+
+ f\bfu\but\bti\bim\bme\bes\bs() and f\bfu\but\bti\bim\bme\ben\bns\bs() will fail if:
+
+ [EBADF] _\bf_\bd does not refer to a valid descriptor.
+
+ [EACCES] The _\bt_\bi_\bm_\be_\bs argument is NULL and the effective user ID
+ of the process does not match the owner of the file,
+ and is not the superuser, and write access is denied.
+
+ [EFAULT] _\bt_\bi_\bm_\be_\bs points outside the process's allocated address
+ space.
+
+ [EIO] An I/O error occurred while reading or writing the
+ affected inode.
+
+ [EPERM] The _\bt_\bi_\bm_\be_\bs argument is not NULL and the calling
+ process's effective user ID does not match the owner
+ of the file and is not the superuser.
+
+ [EROFS] The file system containing the file is mounted read-
+ only.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ clock_gettime(2), stat(2), utime(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The u\but\bti\bim\bme\bes\bs(), u\but\bti\bim\bme\ben\bns\bsa\bat\bt(), and f\bfu\but\bti\bim\bme\ben\bns\bs() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The predecessors of u\but\bti\bim\bme\bes\bs() were s\bsm\bmd\bda\bat\bte\be() in Version 1 AT&T UNIX,
+ m\bmd\bda\bat\bte\be() in Version 3 AT&T UNIX, and u\but\bti\bim\bme\be() in Version 7 AT&T UNIX; the
+ latter first supported the concept of an access time in addition to the
+ modification time.
+
+ The u\but\bti\bim\bme\bes\bs() function call appeared in 4.2BSD. The f\bfu\but\bti\bim\bme\bes\bs() function
+ call appeared in NetBSD 1.2. The u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and f\bfu\but\bti\bim\bme\ben\bns\bs() function
+ calls appeared in OpenBSD 5.0.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ IEEE Std 1003.1-2008 (``POSIX.1'') specifies that u\but\bti\bim\bme\ben\bns\bsa\bat\bt() and
+ f\bfu\but\bti\bim\bme\ben\bns\bs() shall mark the last file status change timestamp (i.e.
+ _\bs_\bt_\b__\bc_\bt_\bi_\bm) for update upon successful completion. However, currently some
+ filesystems (e.g. UFS) will not do so if UTIME_OMIT is specified for the
+ modification timestamp argument.
+
+N\bNA\bAM\bME\bE
+ u\but\btr\bra\bac\bce\be - insert user record in ktrace log
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/k\bkt\btr\bra\bac\bce\be.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ u\but\btr\bra\bac\bce\be(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bl_\ba_\bb_\be_\bl, _\bv_\bo_\bi_\bd _\b*_\ba_\bd_\bd_\br, _\bs_\bi_\bz_\be_\b__\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ Adds a record to the process trace with information supplied by the user.
+ The record is identified by _\bl_\ba_\bb_\be_\bl and contains _\bl_\be_\bn bytes from memory
+ pointed to by _\ba_\bd_\bd_\br. This call only has an effect if the calling process
+ is being traced.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion, the value 0 is returned; otherwise the
+ value -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the
+ error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ [ENOSYS] The currently running kernel was compiled without
+ ktrace(2) support (option KTRACE).
+
+ [ENAMETOOLONG] The length of the _\bl_\ba_\bb_\be_\bl string was longer than
+ KTR_USER_MAXIDLEN-1.
+
+ [EINVAL] The specified data length _\bl_\be_\bn was bigger than
+ KTR_USER_MAXLEN.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ kdump(1), ktrace(1), ktrace(2), options(4)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The u\but\btr\bra\bac\bce\be() system call first appeared in FreeBSD 2.2. It was added to
+ OpenBSD in OpenBSD 5.4. The _\bl_\ba_\bb_\be_\bl argument is an extension.
+
+N\bNA\bAM\bME\bE
+ v\bvf\bfo\bor\brk\bk - spawn new process and block parent
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ v\bvf\bfo\bor\brk\bk(_\bv_\bo_\bi_\bd);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ v\bvf\bfo\bor\brk\bk() was originally used to create new processes without fully copying
+ the address space of the old process, which is horrendously inefficient
+ in a paged environment. It was useful when the purpose of fork(2) would
+ have been to create a new system context for an execve(2). Since fork(2)
+ is now efficient, even in the above case, the need for v\bvf\bfo\bor\brk\bk() has
+ diminished. v\bvf\bfo\bor\brk\bk() differs from fork(2) in that the parent is suspended
+ until the child makes a call to execve(2) or an exit (either by a call to
+ _exit(2) or abnormally). In addition, fork handlers established using
+ pthread_atfork(3) are not called when a multithreaded program calls
+ v\bvf\bfo\bor\brk\bk().
+
+ v\bvf\bfo\bor\brk\bk() returns 0 in the child's context and (later) the PID of the child
+ in the parent's context.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Same as for fork(2).
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ execve(2), fork(2), sigaction(2), wait(2)
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The v\bvf\bfo\bor\brk\bk() function call appeared in 2.9BSD with the additional
+ semantics that the child process ran in the memory of the parent until it
+ called execve(2) or exited. That sharing of memory was removed in
+ 4.4BSD, leaving just the semantics of blocking the parent until the child
+ calls execve(2) or exits. On many other systems the original behavior
+ has been restored, making this interface particularly unportable.
+
+B\bBU\bUG\bGS\bS
+ To avoid a possible deadlock situation, processes that are children in
+ the middle of a v\bvf\bfo\bor\brk\bk() are never sent SIGTTOU or SIGTTIN signals;
+ rather, output or ioctl(2) calls are allowed and input attempts result in
+ an end-of-file indication.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwa\bai\bit\bt, w\bwa\bai\bit\btp\bpi\bid\bd, w\bwa\bai\bit\bt4\b4, w\bwa\bai\bit\bt3\b3 - wait for process termination
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\btp\bpi\bid\bd(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/r\bre\bes\bso\bou\bur\brc\bce\be.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/w\bwa\bai\bit\bt.\b.h\bh>\b>
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt3\b3(_\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+ _\bp_\bi_\bd_\b__\bt
+ w\bwa\bai\bit\bt4\b4(_\bp_\bi_\bd_\b__\bt _\bw_\bp_\bi_\bd, _\bi_\bn_\bt _\b*_\bs_\bt_\ba_\bt_\bu_\bs, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs, _\bs_\bt_\br_\bu_\bc_\bt _\br_\bu_\bs_\ba_\bg_\be _\b*_\br_\bu_\bs_\ba_\bg_\be);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The w\bwa\bai\bit\bt() function suspends execution of its calling process until
+ _\bs_\bt_\ba_\bt_\bu_\bs information is available for a terminated child process, or a
+ signal is received. On return from a successful w\bwa\bai\bit\bt() call, the _\bs_\bt_\ba_\bt_\bu_\bs
+ area, if non-zero, is filled in with termination information about the
+ process that exited (see below).
+
+ The w\bwa\bai\bit\bt4\b4() call provides a more general interface for programs that need
+ to wait for certain child processes, that need resource utilization
+ statistics accumulated by child processes, or that require options. The
+ other wait functions are implemented using w\bwa\bai\bit\bt4\b4().
+
+ The _\bw_\bp_\bi_\bd parameter specifies the set of child processes for which to
+ wait. The following symbolic constants are currently defined in
+ <_\bs_\by_\bs_\b/_\bw_\ba_\bi_\bt_\b._\bh>:
+
+ #define WAIT_ANY (-1) /* any process */
+ #define WAIT_MYPGRP 0 /* any process in my process group */
+
+ If _\bw_\bp_\bi_\bd is set to WAIT_ANY, the call waits for any child process. If
+ _\bw_\bp_\bi_\bd is set to WAIT_MYPGRP, the call waits for any child process in the
+ process group of the caller. If _\bw_\bp_\bi_\bd is greater than zero, the call
+ waits for the process with process ID _\bw_\bp_\bi_\bd. If _\bw_\bp_\bi_\bd is less than -1, the
+ call waits for any process whose process group ID equals the absolute
+ value of _\bw_\bp_\bi_\bd.
+
+ The _\bs_\bt_\ba_\bt_\bu_\bs parameter is defined below. The _\bo_\bp_\bt_\bi_\bo_\bn_\bs argument is the
+ bitwise OR of zero or more of the following values:
+
+ WCONTINUED Causes status to be reported for stopped child processes that
+ have been continued by receipt of a SIGCONT signal.
+
+ WNOHANG Indicates that the call should not block if there are no
+ processes that wish to report status.
+
+ WUNTRACED If set, children of the current process that are stopped due
+ to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal also have
+ their status reported.
+
+ If _\br_\bu_\bs_\ba_\bg_\be is non-zero, a summary of the resources used by the terminated
+ process and all its children is returned (this information is currently
+ not available for stopped processes).
+
+ When the WNOHANG option is specified and no processes wish to report
+ status, w\bwa\bai\bit\bt4\b4() returns a process ID of 0.
+
+ The w\bwa\bai\bit\btp\bpi\bid\bd() call is identical to w\bwa\bai\bit\bt4\b4() with an _\br_\bu_\bs_\ba_\bg_\be value of zero.
+ The older w\bwa\bai\bit\bt3\b3() call is the same as w\bwa\bai\bit\bt4\b4() with a _\bw_\bp_\bi_\bd value of -1.
+
+ The following macros may be used to test the manner of exit of the
+ process. One of the first three macros will evaluate to a non-zero
+ (true) value:
+
+ W\bWI\bIF\bFC\bCO\bON\bNT\bTI\bIN\bNU\bUE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, and has continued after a
+ job control stop. This macro can be true only if the wait call
+ specified the WCONTINUED option.
+
+ W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated normally by a call to _exit(2) or
+ exit(3).
+
+ W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process terminated due to receipt of a signal.
+
+ W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs)
+ True if the process has not terminated, but has stopped and can
+ be restarted. This macro can be true only if the wait call
+ specified the WUNTRACED option or if the child process is being
+ traced (see ptrace(2)).
+
+ Depending on the values of those macros, the following macros produce the
+ remaining status information about the child process:
+
+ W\bWE\bEX\bXI\bIT\bTS\bST\bTA\bAT\bTU\bUS\bS(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFE\bEX\bXI\bIT\bTE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the low-order 8 bits
+ of the argument passed to _exit(2) or exit(3) by the child.
+
+ W\bWT\bTE\bER\bRM\bMS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the termination of the process.
+
+ W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bSI\bIG\bGN\bNA\bAL\bLE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates as true if the
+ termination of the process was accompanied by the creation of a
+ core file containing an image of the process when the signal was
+ received.
+
+ W\bWS\bST\bTO\bOP\bPS\bSI\bIG\bG(_\bs_\bt_\ba_\bt_\bu_\bs)
+ If W\bWI\bIF\bFS\bST\bTO\bOP\bPP\bPE\bED\bD(_\bs_\bt_\ba_\bt_\bu_\bs) is true, evaluates to the number of the
+ signal that caused the process to stop.
+
+N\bNO\bOT\bTE\bES\bS
+ See sigaction(2) for a list of termination signals. A status of 0
+ indicates normal termination.
+
+ If a parent process terminates without waiting for all of its child
+ processes to terminate, the remaining child processes are assigned the
+ parent process 1 ID (the init process ID).
+
+ If a signal is caught while any of the w\bwa\bai\bit\bt() calls is pending, the call
+ may be interrupted or restarted when the signal-catching routine returns,
+ depending on the options in effect for the signal; for further
+ information, see siginterrupt(3).
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ If w\bwa\bai\bit\bt() returns due to a stopped or terminated child process, the
+ process ID of the child is returned to the calling process. Otherwise, a
+ value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+ If w\bwa\bai\bit\bt4\b4(), w\bwa\bai\bit\bt3\b3() or w\bwa\bai\bit\btp\bpi\bid\bd() returns due to a stopped or terminated
+ child process, the process ID of the child is returned to the calling
+ process. If there are no children not previously awaited, -1 is returned
+ with _\be_\br_\br_\bn_\bo set to [ECHILD]. Otherwise, if WNOHANG is specified and there
+ are no stopped or exited children, 0 is returned. If an error is
+ detected or a caught signal aborts the call, a value of -1 is returned
+ and _\be_\br_\br_\bn_\bo is set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwa\bai\bit\bt() will fail and return immediately if:
+
+ [ECHILD] The calling process has no existing unwaited-for child
+ processes.
+
+ [EFAULT] The _\bs_\bt_\ba_\bt_\bu_\bs or _\br_\bu_\bs_\ba_\bg_\be arguments point to an illegal
+ address. (May not be detected before exit of a child
+ process.)
+
+ [EINTR] The call was interrupted by a caught signal, or the
+ signal did not have the SA_RESTART flag set.
+
+ [EINVAL] Invalid or undefined flags were passed in the _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+ argument.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ _exit(2), sigaction(2), exit(3)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwa\bai\bit\bt() and w\bwa\bai\bit\btp\bpi\bid\bd() functions conform to IEEE Std 1003.1-2008
+ (``POSIX.1'').
+
+ w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\bt3\b3() are not specified by POSIX. The W\bWC\bCO\bOR\bRE\bED\bDU\bUM\bMP\bP() macro
+ and the ability to restart a pending w\bwa\bai\bit\bt() call are extensions to that
+ specification.
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ A w\bwa\bai\bit\bt() system call first appeared in Version 1 AT&T UNIX. The _\bs_\bt_\ba_\bt_\bu_\bs
+ argument is accepted since Version 2 AT&T UNIX. A w\bwa\bai\bit\bt3\b3() system call
+ first appeared in 4BSD, but the final calling convention was only
+ established in 4.2BSD. The w\bwa\bai\bit\bt4\b4() and w\bwa\bai\bit\btp\bpi\bid\bd() function calls first
+ appeared in 4.3BSD-Reno.
+
+N\bNA\bAM\bME\bE
+ w\bwr\bri\bit\bte\be, w\bwr\bri\bit\bte\bev\bv, p\bpw\bwr\bri\bit\bte\be, p\bpw\bwr\bri\bit\bte\bev\bv - write output
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ w\bwr\bri\bit\bte\be() attempts to write _\bn_\bb_\by_\bt_\be_\bs of data to the object referenced by the
+ descriptor _\bd from the buffer pointed to by _\bb_\bu_\bf. w\bwr\bri\bit\bte\bev\bv() performs the
+ same action, but gathers the output data from the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() perform the same functions, but
+ write to the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the
+ file pointer.
+
+ For w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory from which data should be written. w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will
+ always write a complete area before proceeding to the next.
+
+ On objects capable of seeking, the w\bwr\bri\bit\bte\be() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from w\bwr\bri\bit\bte\be(),
+ the pointer is incremented by the number of bytes which were written. If
+ a file was opened with the O_APPEND flag (see open(2)), calls to w\bwr\bri\bit\bte\be()
+ or w\bwr\bri\bit\bte\bev\bv() will automatically set the pointer to the end of the file
+ before writing.
+
+ Objects that are not capable of seeking always write from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ If the real user is not the superuser, then w\bwr\bri\bit\bte\be() clears the set-user-
+ ID bit on a file. This prevents penetration of system security by a user
+ who ``captures'' a writable set-user-ID file owned by the superuser.
+
+ If w\bwr\bri\bit\bte\be() succeeds it will update the st_ctime and st_mtime fields of
+ the file's meta-data (see stat(2)).
+
+ When using non-blocking I/O on objects such as sockets that are subject
+ to flow control, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may write fewer bytes than
+ requested; the return value must be noted, and the remainder of the
+ operation should be retried when possible.
+
+ Note that w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion the number of bytes which were written is
+ returned. Otherwise, a -1 is returned and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwr\bri\bit\bte\be(), p\bpw\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\bev\bv() will fail and the file pointer
+ will remain unchanged if:
+
+ [EBADF] _\bd is not a valid descriptor open for writing.
+
+ [EFBIG] An attempt was made to write a file that exceeds the
+ process's file size limit or the maximum file size.
+
+ [ENOSPC] There is no free space remaining on the file system
+ containing the file.
+
+ [EDQUOT] The user's quota of disk blocks on the file system
+ containing the file has been exhausted.
+
+ [EINTR] A write to a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data could be
+ written.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ In addition, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may return the following errors:
+
+ [EPIPE] An attempt is made to write to a pipe that is not open
+ for reading by any process.
+
+ [EPIPE] An attempt is made to write to a socket of type
+ SOCK_STREAM that is not connected to a peer socket.
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ could be written immediately.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [EDESTADDRREQ] The destination is no longer available when writing to
+ a UNIX-domain datagram socket on which connect(2) had
+ been used to set a destination address.
+
+ [EIO] The process is a member of a background process
+ attempting to write to its controlling terminal,
+ TOSTOP is set on the terminal, the process isn't
+ ignoring the SIGTTOUT signal and the thread isn't
+ blocking the SIGTTOUT signal, and either the process
+ was created with vfork(2) and hasn't successfully
+ executed one of the exec functions or the process
+ group is orphaned.
+
+ w\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\be() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() may return the following error:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+ [ENOBUFS] The system lacked sufficient buffer space or a queue
+ was full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), lseek(2), open(2), pipe(2), poll(2), select(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\be() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpw\bwr\bri\bit\bte\bev\bv() function call appeared in OpenBSD 2.7. The p\bpw\bwr\bri\bit\bte\be()
+ function call appeared in AT&T System V Release 4 UNIX. The w\bwr\bri\bit\bte\bev\bv()
+ function call appeared in 4.2BSD. The w\bwr\bri\bit\bte\be() function call appeared in
+ Version 2 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = write(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free w\bwr\bri\bit\bte\be() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = write(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ w\bwr\bri\bit\bte\be, w\bwr\bri\bit\bte\bev\bv, p\bpw\bwr\bri\bit\bte\be, p\bpw\bwr\bri\bit\bte\bev\bv - write output
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs);
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\be(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bv_\bo_\bi_\bd _\b*_\bb_\bu_\bf, _\bs_\bi_\bz_\be_\b__\bt _\bn_\bb_\by_\bt_\be_\bs, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ w\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt);
+
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/u\bui\bio\bo.\b.h\bh>\b>
+
+ _\bs_\bs_\bi_\bz_\be_\b__\bt
+ p\bpw\bwr\bri\bit\bte\bev\bv(_\bi_\bn_\bt _\bd, _\bc_\bo_\bn_\bs_\bt _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bo_\bv_\be_\bc _\b*_\bi_\bo_\bv, _\bi_\bn_\bt _\bi_\bo_\bv_\bc_\bn_\bt, _\bo_\bf_\bf_\b__\bt _\bo_\bf_\bf_\bs_\be_\bt);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ w\bwr\bri\bit\bte\be() attempts to write _\bn_\bb_\by_\bt_\be_\bs of data to the object referenced by the
+ descriptor _\bd from the buffer pointed to by _\bb_\bu_\bf. w\bwr\bri\bit\bte\bev\bv() performs the
+ same action, but gathers the output data from the _\bi_\bo_\bv_\bc_\bn_\bt buffers
+ specified by the members of the _\bi_\bo_\bv array: iov[0], iov[1], ...,
+ iov[iovcnt-1]. p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() perform the same functions, but
+ write to the specified position _\bo_\bf_\bf_\bs_\be_\bt in the file without modifying the
+ file pointer.
+
+ For w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv(), the _\bi_\bo_\bv_\be_\bc structure is defined as:
+
+ struct iovec {
+ void *iov_base;
+ size_t iov_len;
+ };
+
+ Each _\bi_\bo_\bv_\be_\bc entry specifies the base address and length of an area in
+ memory from which data should be written. w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will
+ always write a complete area before proceeding to the next.
+
+ On objects capable of seeking, the w\bwr\bri\bit\bte\be() starts at a position given by
+ the pointer associated with _\bd (see lseek(2)). Upon return from w\bwr\bri\bit\bte\be(),
+ the pointer is incremented by the number of bytes which were written. If
+ a file was opened with the O_APPEND flag (see open(2)), calls to w\bwr\bri\bit\bte\be()
+ or w\bwr\bri\bit\bte\bev\bv() will automatically set the pointer to the end of the file
+ before writing.
+
+ Objects that are not capable of seeking always write from the current
+ position. The value of the pointer associated with such an object is
+ undefined.
+
+ If the real user is not the superuser, then w\bwr\bri\bit\bte\be() clears the set-user-
+ ID bit on a file. This prevents penetration of system security by a user
+ who ``captures'' a writable set-user-ID file owned by the superuser.
+
+ If w\bwr\bri\bit\bte\be() succeeds it will update the st_ctime and st_mtime fields of
+ the file's meta-data (see stat(2)).
+
+ When using non-blocking I/O on objects such as sockets that are subject
+ to flow control, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may write fewer bytes than
+ requested; the return value must be noted, and the remainder of the
+ operation should be retried when possible.
+
+ Note that w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() will fail if the value of _\bi_\bo_\bv_\bc_\bn_\bt exceeds
+ the constant IOV_MAX.
+
+R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
+ Upon successful completion the number of bytes which were written is
+ returned. Otherwise, a -1 is returned and the global variable _\be_\br_\br_\bn_\bo is
+ set to indicate the error.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ w\bwr\bri\bit\bte\be(), p\bpw\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\bev\bv() will fail and the file pointer
+ will remain unchanged if:
+
+ [EBADF] _\bd is not a valid descriptor open for writing.
+
+ [EFBIG] An attempt was made to write a file that exceeds the
+ process's file size limit or the maximum file size.
+
+ [ENOSPC] There is no free space remaining on the file system
+ containing the file.
+
+ [EDQUOT] The user's quota of disk blocks on the file system
+ containing the file has been exhausted.
+
+ [EINTR] A write to a slow device (i.e. one that might block
+ for an arbitrary amount of time) was interrupted by
+ the delivery of a signal before any data could be
+ written.
+
+ [EIO] An I/O error occurred while reading from or writing to
+ the file system.
+
+ [EFAULT] Part of _\bb_\bu_\bf points outside the process's allocated
+ address space.
+
+ In addition, w\bwr\bri\bit\bte\be() and w\bwr\bri\bit\bte\bev\bv() may return the following errors:
+
+ [EPIPE] An attempt is made to write to a pipe that is not open
+ for reading by any process.
+
+ [EPIPE] An attempt is made to write to a socket of type
+ SOCK_STREAM that is not connected to a peer socket.
+
+ [EAGAIN] The file was marked for non-blocking I/O, and no data
+ could be written immediately.
+
+ [ENETDOWN] The destination address specified a network that is
+ down.
+
+ [EDESTADDRREQ] The destination is no longer available when writing to
+ a UNIX-domain datagram socket on which connect(2) had
+ been used to set a destination address.
+
+ [EIO] The process is a member of a background process
+ attempting to write to its controlling terminal,
+ TOSTOP is set on the terminal, the process isn't
+ ignoring the SIGTTOUT signal and the thread isn't
+ blocking the SIGTTOUT signal, and either the process
+ was created with vfork(2) and hasn't successfully
+ executed one of the exec functions or the process
+ group is orphaned.
+
+ w\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\be() may return the following error:
+
+ [EINVAL] _\bn_\bb_\by_\bt_\be_\bs was larger than SSIZE_MAX.
+
+ p\bpw\bwr\bri\bit\bte\be() and p\bpw\bwr\bri\bit\bte\bev\bv() may return the following error:
+
+ [EINVAL] _\bo_\bf_\bf_\bs_\be_\bt was negative.
+
+ [ESPIPE] _\bd is associated with a pipe, socket, FIFO, or tty.
+
+ w\bwr\bri\bit\bte\bev\bv() and p\bpw\bwr\bri\bit\bte\bev\bv() may return one of the following errors:
+
+ [EINVAL] _\bi_\bo_\bv_\bc_\bn_\bt was less than or equal to 0, or greater than
+ IOV_MAX.
+
+ [EINVAL] The sum of the _\bi_\bo_\bv_\b__\bl_\be_\bn values in the _\bi_\bo_\bv array
+ overflowed an _\bs_\bs_\bi_\bz_\be_\b__\bt.
+
+ [EFAULT] Part of _\bi_\bo_\bv points outside the process's allocated
+ address space.
+
+ [ENOBUFS] The system lacked sufficient buffer space or a queue
+ was full.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ fcntl(2), lseek(2), open(2), pipe(2), poll(2), select(2), termios(4)
+
+S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
+ The w\bwr\bri\bit\bte\be(), w\bwr\bri\bit\bte\bev\bv(), and p\bpw\bwr\bri\bit\bte\be() functions conform to IEEE Std
+ 1003.1-2008 (``POSIX.1'').
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ The p\bpw\bwr\bri\bit\bte\bev\bv() function call appeared in OpenBSD 2.7. The p\bpw\bwr\bri\bit\bte\be()
+ function call appeared in AT&T System V Release 4 UNIX. The w\bwr\bri\bit\bte\bev\bv()
+ function call appeared in 4.2BSD. The w\bwr\bri\bit\bte\be() function call appeared in
+ Version 2 AT&T UNIX.
+
+C\bCA\bAV\bVE\bEA\bAT\bTS\bS
+ Error checks should explicitly test for -1. Code such as
+
+ while ((nr = write(fd, buf, sizeof(buf))) > 0)
+
+ is not maximally portable, as some platforms allow for _\bn_\bb_\by_\bt_\be_\bs to range
+ between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
+ error-free w\bwr\bri\bit\bte\be() may appear as a negative number distinct from -1.
+ Proper loops should use
+
+ while ((nr = write(fd, buf, sizeof(buf))) != -1 && nr != 0)
+
+N\bNA\bAM\bME\bE
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf - drains the CPU write buffer
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf();
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf() will make sure that all the entries in the processor
+ write buffer are written out to memory.
+
+ Not all processors support this operation (currently only the SA110
+ does). Those processes that do not, treat this function as a null-op.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bar\brm\bm_\b_d\bdr\bra\bai\bin\bn_\b_w\bwr\bri\bit\bte\beb\bbu\buf\bf() will never fail so will always return 0.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ StrongARM Data Sheet
+
+N\bNA\bAM\bME\bE
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be - clean the CPU data cache and flush the CPU instruction
+ cache
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bac\bch\bhi\bin\bne\be/\b/s\bsy\bys\bsa\bar\brc\bch\bh.\b.h\bh>\b>
+
+ _\bi_\bn_\bt
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be(_\bu_\b__\bi_\bn_\bt _\ba_\bd_\bd_\br, _\bi_\bn_\bt _\bl_\be_\bn);
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will make sure that all the entries in the processor
+ instruction cache are synchronized with main memory and that any data in
+ a write back cache has been cleaned. Some ARM processors (e.g. SA110)
+ have separate instruction and data caches, thus any dynamically generated
+ or modified code needs to be written back from any data caches to main
+ memory and the instruction cache needs to be synchronized with main
+ memory.
+
+ On such processors, a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will clean the data cache and
+ invalidate the processor instruction cache to force reloading from main
+ memory. On processors that have a shared instruction and data cache and
+ have a write through cache (e.g. ARM6), no action needs to be taken.
+
+ The routine takes a start address _\ba_\bd_\bd_\br and a length _\bl_\be_\bn to describe the
+ area of memory that needs to be cleaned and synchronized.
+
+E\bER\bRR\bRO\bOR\bRS\bS
+ a\bar\brm\bm_\b_s\bsy\byn\bnc\bc_\b_i\bic\bca\bac\bch\bhe\be() will never fail so will always return 0.
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bES\bS
+ StrongARM Data Sheet
+
+OpenBSD 5.7 August 14, 2013 OpenBSD 5.7