fcntl(5) fcntl(5)
NAME
fcntl - file control options
SYNOPSIS
#include <fcntl.h>
DESCRIPTION
The <fcntl.h> header file defines the following requests and arguments
for use by the functions fcntl.
Unique values for commands used by fcntl():
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
FGETOWN Get process or process group ID to receive SIGURG sig-
nals
FSETOWN Set process or process group ID to receive SIGURG sig-
nals
File descriptor flags used for fcntl():
FDCLOEXEC Close the file descriptor upon execution of an exec
function [see exec(2)]
Unique values for ltype used for record locking with fcntl():
FRDLCK Shared or read lock
FUNLCK Unlock
FWRLCK Exclusive or write lock
The values used for lwhence, SEEKSET, SEEKCUR and SEEKEND are
defined as described in <unistd.h>.
Page 1 Reliant UNIX 5.44 Printed 11/98
fcntl(5) fcntl(5)
Sets of values for oflag used by open() (bitwise distinct):
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 symbolic names for file modes for use as values of modet are
defined as described in <sys/types.h>.
Asynchronous I/O-specific file marker:
FRAIOSIG Produces a signal when the job has ended (defined in
<file.h>).
This marker defines a specific mode which is of impor-
tance in conjunction with asynchronous I/O. The marker
is file-specific.
If the marker is set for a file, then the signal SIGEMT
is sent to the issuing process for all asynchronous
read and write jobs, when the asynchronous I/O job has
ended.
This mode is generally not set [see also aio(7)].
Page 2 Reliant UNIX 5.44 Printed 11/98
fcntl(5) fcntl(5)
The flock structure 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 */
long lsysid; /* Returned with FGETLK */
pidt lpid; /* Returned with FGETLK */
The modet, offt and pidt types are defined as described in
<sys/types.h>.
The following are declared as functions and may also be defined as
macros:
int creat(const char *path, modet mode);
int fcntl(int fildes, int cmd, ...);
int open(const char *path, int oflag, ...);
Inclusion of the <fcntl.h> header may also make visible all symbols
from <sys/stat.h> and <unistd.h>.
The flock64 structure is defined in the same way as the flock struc-
ture with the exception of the following members:
off64t lstart Relative offset in bytes.
off64t llen Size.
Additional values for cmd used by fcntl():
FGETLK64 Get record locking information using struct flock64.
FSETLK64 Establish a record lock using struct flock64.
FSETLKW64 Establish a record lock, blocking, using struct
flock64.
An additional file status flag, used by open() and fcntl(), is
defined:
OLARGEFILE The offset maximum in the open file description is the
largest value that can be represented correctly in an
object of type off64t.
The following are declared as functions and may also be defined as
macros:
int creat64(const char *path, modet mode);
int open64(const char *path, int oflag, ...);
Page 3 Reliant UNIX 5.44 Printed 11/98
fcntl(5) fcntl(5)
SEE ALSO
creat(2), exec(2), fcntl(2), open(2), unistd(4), lfs(5), stat(5),
types(5), aio(7).
Page 4 Reliant UNIX 5.44 Printed 11/98