|<fcntl.h>(0P)||POSIX Programmer's Manual||<fcntl.h>(0P)|
NAMEfcntl.h - file control options
DESCRIPTIONThe <fcntl.h> header shall define the following requests and arguments for use by the functions fcntl() and open().
Values for cmd used by fcntl() (the following values are unique) are as follows:
- Duplicate file descriptor.
- Get file descriptor flags.
- Set file descriptor flags.
- Get file status flags and file access modes.
- Set file status flags.
- Get record locking information.
- Set record locking information.
- Set record locking information; wait if blocked.
- Get process or process group ID to receive SIGURG signals.
Set process or process group ID to receive SIGURG signals.
File descriptor flags used for fcntl() are as follows:
Close the file descriptor upon execution of an
exec family function.
Values for l_type used for record locking with fcntl() (the following values are unique) are as follows:
- Shared or read lock.
Exclusive or write lock.
The values used for l_whence, SEEK_SET, SEEK_CUR, and SEEK_END shall be defined as described in <unistd.h> .
The following values are file creation flags and are used in the oflag value to open(). They shall be bitwise-distinct.
- Create file if it does not exist.
- Exclusive use flag.
- Do not assign controlling terminal.
File status flags used for open() and fcntl() are as follows:
- Set append mode.
- Write according to synchronized I/O data integrity completion.
- Non-blocking mode.
- Synchronized read I/O operations.
Write according to synchronized I/O file integrity completion.
Mask for use with file access modes is as follows:
Mask for file access modes.
File access modes used for open() and fcntl() are as follows:
- Open for reading only.
- Open for reading and writing.
Open for writing only.
The symbolic names for file modes for use as values of mode_t shall be defined as described in <sys/stat.h> .
Values for advice used by posix_fadvise() are as follows:
The structure flock describes a file lock. It shall include the following members:
short l_type Type of lock; F_RDLCK, F_WRLCK, F_UNLCK.
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.
pid_t l_pid Process ID of the process holding the lock; returned with F_GETLK.
The mode_t, off_t, and pid_t types shall be defined as described in <sys/types.h> .
The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.
int creat(const char *, mode_t);
int fcntl(int, int, ...);
int open(const char *, int, ...);
int posix_fadvise(int, off_t, size_t, int);
int posix_fallocate(int, off_t, size_t);
Inclusion of the <fcntl.h> header may also make visible all symbols from <sys/stat.h> and <unistd.h>.
The following sections are informative.
SEE ALSO<sys/stat.h>, <sys/types.h>, <unistd.h>, the System Interfaces volume of IEEE Std 1003.1-2001, creat(), exec, fcntl(), open(), posix_fadvise(), posix_fallocate(), posix_madvise()
COPYRIGHTPortions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
|2003||IEEE/The Open Group|