fcntl(5) UNIX System V fcntl(5)
NAME
fcntl - file control options
SYNOPSIS
#include <fcntl.h>
DESCRIPTION
The fcntl.h header defines the following requests and arguments for use
by the functions fcntl [see fcntl(2)] and open [see open(2)].
Values for cmd used by fcntl (the following values are unique):
FDUPFD Duplicate file descriptor
FGETFD Get file descriptor flags
FSETFD Set file descriptor flags
FGETFL Get file status flags
FSETFL Set file status flags
FGETLK Get record locking information
FSETLK Set record locking information
FSETLKW Set record locking information;
wait if blocked
File descriptor flags used for fcntl:
FDCLOEXEC Close the file descriptor upon
execution of an exec function [see exec(2)]
Values for ltype used for record locking with fcntl
(the following values are unique):
FRDLCK Shared or read lock
FUNLCK Unlock
FWRLCK Exclusive or write lock
The following three sets of values are bitwise distinct:
Values for oflag used by open:
OCREAT Create file if it does not exist
OEXCL Exclusive use flag
ONOCTTY Do not assign controlling tty
OTRUNC Truncate flag
File status flags used for open and fcntl:
OAPPEND Set append mode
ONDELAY Non-blocking mode
ONONBLOCK Non-blocking mode (POSIX)
OSYNC Synchronous writes
Mask for use with file access modes:
OACCMODE Mask for file access modes
File access modes used for open and fcntl:
ORDONLY Open for reading only
ORDWR Open for reading and writing
OWRONLY Open for writing only
The structure flock describes a file lock. It includes the following
members:
short ltype; /* Type of lock */
short lwhence; /* Flag for starting offset */
offt lstart; /* Relative offset in bytes */
10/89 Page 1
fcntl(5) UNIX System V fcntl(5)
offt llen; /* Size; if 0 then until EOF */
long lsysid; /* Returned with FGETLK */
pidt lpid; /* Returned with FGETLK */
SEE ALSO
creat(2), exec(2), fcntl(2), open(2)
Page 2 10/89