File control.
#include <fcntl.h>
int
fcntl(int fd, int cmd, ...);
Description
The fcntl() system call provides for control over descriptors. The argument fd is a descriptor to be operated on by cmd as described below. Depending on the value of cmd, fcntl() can take an additional third argument int arg.
F_GETFL |
Get descriptor status flags, as described below (arg is ignored). |
F_SETFL |
Set descriptor status flags to arg. |
The flags for the F_GETFL and F_SETFL flags are as follows:
O_NONBLOCK |
Non-blocking I/O; if no data is available to a read() system call, or if a write() operation would block, the read or write call returns -1 with the error EAGAIN. |
Return Values
Upon successful completion, the value returned depends on
cmd as follows:
F_GETFL |
Value of flags. |
Other |
Value other than -1. |
The fcntl() system call will fail if:
EBADF |
The fd argument is not a valid open file descriptor. |
EINVAL |
The specified cmd is invalid. |
Requirements
Versions |
Link to |
INtime 4.0 |
netlib.lib |
See Also