Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

open(2)

fcntl(5)

NAME

fcntl − file control options

SYNOPSIS

#include <sys/types.h>
#include <fcntl.h>

DESCRIPTION

The fcntl(2) function provides for control over open files. This include file describes requests and arguments to fcntl and open(2).

Access modes set by open(2) and accessed by fcntl(2):

O_RDONLY
O_WRONLY
O_RDWR

Mask for file access modes:

O_ACCMODE

File status flags set by open(2) or fcntl(2) and accessed by fcntl(2):

O_NDELAY Non-blocking I/O
O_NONBLOCK POSIX-style non-blocking I/O
O_APPEND Append (writes guaranteed at the end)
O_SYNCIO Do write through caching

Flag values accessible only to open(2):

O_CREAT Open with file create (uses third open arg)
O_TRUNC Open with truncation
O_EXCL Exclusive open
O_NOCTTY Do not assign a controlling terminal

Requests for fcntl(2):

F_DUPFD Duplicate fildes
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 busy
F_SETLKW Set or clear file locks and wait on busy

File descriptor flags for F_GETFD, F_SETFD:

FD_CLOEXEC

File segment locking control structure, struct flock, including the following members:

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 ∗/

File segment locking types:

F_RDLCK Read lock
F_WRLCK Write lock
F_UNLCK Remove locks

SEE ALSO

fcntl(2), open(2). 

STANDARDS CONFORMANCE

<fcntl.h>: AES, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

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