Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fcntl(5) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

exec(2)

fcntl(2)

open(2)

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(2) and 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



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:

shortl_type;/∗ Type of lock ∗/
shortl_whence;/∗ Flag for starting offset ∗/
off_tl_start;/∗ Relative offset in bytes ∗/
off_tl_len;/∗ Size; if 0 then until EOF ∗/
longl_sysid;/∗ Returned with F_GETLK ∗/
pid_tl_pid;/∗ Returned with F_GETLK ∗/

SEE ALSO

creat(2), exec(2), fcntl(2), open(2)

SunOS 5.2  —  Last change: 3 Jul 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026