FCNTL(5-SVR4) RISC/os Reference Manual FCNTL(5-SVR4)
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):
F_DUPFD Duplicate file descriptor
F_GETFD Get file descriptor flags
F_SETFD Set file descriptor flags
F_GETFL Get file status flags
F_SETFL Set file status flags
F_GETLK Get record locking information
F_SETLK Set record locking information
F_SETLKW Set record locking information;
wait if blocked
File descriptor flags used for fcntl:
FD_CLOEXEC Close the file descriptor upon
execution of an exec function [see exec(2)]
Values for l_type used for record locking with fcntl
(the following values are unique):
F_RDLCK Shared or read lock
F_UNLCK Unlock
F_WRLCK Exclusive or write lock
The following three sets of values are bitwise distinct:
Values for oflag used by open:
O_CREAT Create file if it does not exist
O_EXCL Exclusive use flag
O_NOCTTY Do not assign controlling tty
O_TRUNC Truncate flag
File status flags used for open and fcntl:
O_APPEND Set append mode
O_NDELAY Non-blocking mode
O_NONBLOCK Non-blocking mode (POSIX)
O_SYNC Synchronous writes
Mask for use with file access modes:
O_ACCMODE Mask for file access modes
Printed 11/19/92 Page 1
FCNTL(5-SVR4) RISC/os Reference Manual FCNTL(5-SVR4)
File access modes used for open and fcntl:
O_RDONLY Open for reading only
O_RDWR Open for reading and writing
O_WRONLY Open for writing only
The structure flock describes a file lock. It includes the
following members:
short l_type;/* Type of lock */
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 */
long l_sysid; /* Returned with F_GETLK */
pid_t l_pid;/* Returned with F_GETLK */
SEE ALSO
creat(2), exec(2), fcntl(2), open(2).
Page 2 Printed 11/19/92