NAME [Toc] [Back]
fcntl - file control options
SYNOPSIS [Toc] [Back]
DESCRIPTION [Toc] [Back]
The fcntl() function provides for control over open files. The
<fcntl.h> include file describes requests and arguments to fcntl() and
open(). See fcntl(2) and open(2).
The access modes set by open() and accessed by fcntl() are:
O_RDONLY [Toc] [Back]
The mask for file access modes is:
O_ACCMODE [Toc] [Back]
The file status flags set by open() or fcntl() and accessed by fcntl()
O_NDELAY Nonblocking I/O.
O_NONBLOCK POSIX-style nonblocking I/O.
O_APPEND Append (writes guaranteed at the end).
O_DSYNC Write through cache for data.
O_SYNC Write through cache for data and
O_RSYNC|O_DSYNC Write through cache for data on reads
O_RSYNC|O_SYNC Write through cache for data and
attributes on reads and writes.
O_LARGEFILE When the filesystem is mounted as large
files enabled, the O_LARGEFILE option
allows the file to grow over 2 GB.
The flag O_SYNCIO is a synonym for O_SYNC and is defined for backward
compatibility in <fcntl.h>.
The flag values accessible only to open() are:
O_CREAT Open with file create (uses third open
O_TRUNC Open with truncation.
O_EXCL Exclusive open.
O_NOCTTY Do not assign a controlling terminal.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
The requests for fcntl() are:
F_DUPFD Duplicate file descriptor.
F_GETFD Get file descriptor flags.
F_SETFD Set file descriptor flags.
F_GETFL Get file flags.
F_SETFL Set file flags.
F_GETLK Get blocking file lock.
F_SETLK Set or clear file locks and fail on
F_SETLKW Set or clear file locks and wait on
The file descriptor flag for F_GETFD, F_SETFD is:
FD_CLOEXEC [Toc] [Back]
The file segment locking control structure struct flock, includes the
short l_type; /* F_RDLCK, F_WRLCK or F_UNLCK */
short l_whence; /* Flag - see lseek(2) */
off_t l_start; /* Relative offset in bytes */
off_t l_len; /* Size; if 0 then until EOF */
pid_t l_pid; /* By F_GETLK - process holding lock */
The file segment locking types are:
F_RDLCK Read lock.
F_WRLCK Write lock.
F_UNLCK Remove locks.
SEE ALSO [Toc] [Back]
STANDARDS CONFORMANCE [Toc] [Back]
<fcntl.h>: AES, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ]