fcntl(5) 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
FCHKFL Unused
FALLOCSP Reserved
FFREESP Free file space
FISSTREAM Is the file desc. a stream
FBLOCKS Get number of BLKSIZE
blocks allocated
FBLKSIZE Get optimal I/O block size
FRSETLK Remote SETLK for NFS
FRGETLK Remote GETLK for NFS
FRSETLKW Remote SETLKW for NFS
FGETOWN Get owner (socket emulation)
FSETOWN Set owner (socket emulation)
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
8/91 Page 1
fcntl(5) fcntl(5)
File status flags used for open and fcntl:
OAPPEND Set append mode
ONDELAY Non-blocking mode
ONONBLOCK Non-blocking mode (POSIX)
OSYNC Synchronous writes
OPRIV Private access to file
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 */
offt llen; /* Size; if 0 then until EOF */
pidt lpid; /* Returned with FGETLK */
short lsysid; /* Returned with FGETLK */
SEE ALSO
creat(2), exec(2), fcntl(2), open(2).
Page 2 8/91