This section describes how you can perform various other operations on file descriptors, such as inquiring about or setting flags describing the status of the file descriptor, manipulating record locks, and the like. All of these operations are performed by the function fcntl
.
The second argument to the fcntl
function is a command that specifies which operation to perform. The function and macros that name various flags that are used with it are declared in the header file `fcntl.h'. (Many of these flags are also used by the open
function; see Opening and Closing Files.)
fcntl
function performs the operation specified by command on the file descriptor filedes. Some commands require additional arguments to be supplied. These additional arguments and the return value and error conditions are given in the detailed descriptions of the individual commands. Briefly, here is a list of what the various commands are.
F_DUPFD
F_GETFD
F_SETFD
F_GETFL
F_SETFL
F_GETLK
F_SETLK
F_SETLKW
F_SETLK
, but wait for completion. See File Locks.
F_GETOWN
SIGIO
signals. See Interrupt Input.
F_SETOWN
SIGIO
signals. See Interrupt Input.