fcntl(M)


fcntl -- file control options

Syntax

#include <fcntl.h>

Description

The fcntl(S) function provides for control over open files. This include file describes requests and arguments to fcntl and open(S).
/* Flag values accessible to open(S) and fcntl(S) */
/*  (The first three can only be set by open) */
#define  O_RDONLY   0
#define  O_WRONLY   1
#define  O_RDWR     2
#define  O_NDELAY   04       /* Non-blocking I/O */
#define  O_APPEND   010      /* append (writes guaranteed at the end) */
#define  O_SYNC     020      /* synchronous write option */

/* Flag values accessible only to open(S) */ #define O_CREAT 00400 /* open with file create (uses third open arg)*/ #define O_TRUNC 01000 /* open with truncation */ #define O_EXCL 02000 /* exclusive open */

/* fcntl(S) requests */ #define F_DUPFD 0 /* Duplicate fildes */ #define F_GETFD 1 /* Get fildes flags */ #define F_SETFD 2 /* Set fildes flags */ #define F_GETFL 3 /* Get file flags */ #define F_SETFL 4 /* Set file flags */ #define F_GETLK 5 /* Get file lock */ #define F_SETLK 6 /* Set file lock */ #define F_SETLKW 7 /* Set file lock and wait */ #define F_CHKFL 8 /* Check legality of file flag changes */

/* file segment locking control structure */ struct flock { short l_type; short l_whence; long l_start; long l_len; /* if 0 then until EOF */ short l_sysid; /* returned with F_GETLK*/ short l_pid; /* returned with F_GETLK*/ }

]/* file segment locking types */ #define F_RDLCK 01 /* Read lock */ #define F_WRLCK 02 /* Write lock */ #define F_UNLCK 03 /* Remove locks */

See also

fcntl(S), open(S)

Standards conformance

fcntl is conformant with:

ISO/IEC 9945-1:1990, Information technology - Portable Operating System Interface (POSIX) - Part 1: System Application Program Interface (API) [C Language] (IEEE Std 1003.1-1990);
AT&T SVID Issue 2;
X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005