Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fcntl(5) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

open(2)

fcntl(5)

NAME

fcntl − file control options

SYNOPSIS

#include <sys/fcntl.h>

DESCRIPTION

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

Flag values accessible to open(2) and fcntl(2) (The first three can only
be set by open):

O_RDONLY Open for reading only
O_WRONLY Open for writing only
O_RDWR Open for reading and writing
O_NDELAY No delay
O_APPEND append (writes guaranteed at the end)
O_SYNC synchronous write option
O_NONBLOCK Non-blocking I/O

Flag values accessible only to open(2):

O_CREAT open with file create (uses 3rd open arg)
O_TRUNC open with truncation
O_EXCL exclusive open
O_DIRECT direct I/O (regular disk files)
O_OCTTY Don’t assign a controlling terminal

fcntl(2) requests:

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_CHKFL Check validity of file status flag argument
F_GETLK Get record locking information
F_SETLK Set or clear file locks and fail on busy
F_SETLKW Set or clear file locks and wait on busy
F_FREESP Free storage in file
F_GETOWN Get owner
F_SETOWN Set owner
F_GETASYNC Get ability to perform asynchronous I/O
F_EXTSIZE Allocate contiguous space to disk file

flock structure fields:

short l_type
short l_whence
off_t l_start
off_t l_len
pid_t l_pid

File segment locking types:

F_RDLCK Read lock
F_WRLCK Write lock
F_UNLCK Remove locks

SEE ALSO

fcntl(2), open(2). 

CX/UX Programmer’s Reference Manual

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