fcntl
Controls file handles
#include <fcntl.h>
int fcntl (
int handle,
int cmd,
int arg);
Upon successful completion of the F_GETFL command, fcntl returns the current value of the requested flag. Otherwise, a value of -1 is returned and errno indicates the error.
The fcntl function provides for file control over file handles. The handle parameter is a file handle to be operated on by cmd. The cmd parameter includes either the F_GETFL or the F_SETFL commands described below:
Flags are passed in the arg parameter. The FNDELAY flag is defined for the F_GETFL and F_SETFL commands. It establishes a nonblocking I/O mode; if no data is available to a read call or if a write operation is in a blocking mode, the call returns a value of -1 with the error EWOULDBLOCK.