FCNTL.H(7) Miscellaneous Information Manual FCNTL.H(7)

fcntl.hfile control options

#include <fcntl.h>

The <fcntl.h> header defines the following requests and arguments for use by the functions fcntl(3) and open(3) .

Values for used by (the following values are unique):

Duplicate file descriptor.
Get file descriptor flags.
Set file descriptor flags.
Get file status flags and file access modes.
Set file status flags.
Get record locking information.
Set record locking information.
Set record locking information; wait if blocked.

File descriptor flags used for fcntl ():

Close the file descriptor upon execution of an exec family function.

Values for used for record locking with fcntl () (the following values are unique):

Shared or read lock.
Unlock.
Exclusive or write lock.

The values used for , SEEK_SET, SEEK_CUR and SEEK_END are defined as described in <unistd.h>.

The following four sets of values for used by open () are bitwise distinct:

Create file if it does not exist.
Exclusive use flag.
Do not assign controlling terminal.
Truncate flag.

File status flags used for open () and fcntl ():

Set append mode.
Write according to synchronised I/O data integrity completion.
Non-blocking mode.
Synchronised read I/O operations.
Write according to synchronised I/O file integrity completion.

Mask for use with file access modes:

Mask for file access modes.

File access modes used for open () and fcntl ():

Open for reading only.
Open for reading and writing.
Open for writing only.

The symbolic names for file modes for use as values of are defined as described in <sys/stat.h>.

The structure describes a file lock. It includes the following members: short l_type type of lock; F_RDLCK, F_WRLCK, F_UNLCK short l_whence flag for starting offset off_t l_start relative offset in bytes off_t l_len size; if 0 then until EOF pid_t l_pid process ID of the process holding the lock; returned with F_GETLK

The and types are defined as described in <sys/types.h>.

The following are declared as functions and may also be defined as macros. Function prototypes must be provided for use with an ISO C compiler. int creat(const char *, mode_t); int fcntl(int, int, ...); int open(const char *, int, ...);

Inclusion of the <fcntl.h> header may also make visible all symbols from <sys/stat.h> and <unistd.h>.

None.

None.

creat(3) , exec(3) , fcntl(3) , open(3) , <sys/stat.h> , <sys/types.h> , <unistd.h> .

February 1997 posix.fail