7.6 fcntl Function

Performs the operation specified by command on the file descriptor filedes.

Attention: This interface function is implemented only by MPLAB XC32 C compilers.

Include

<fcntl.h>

Prototype

int fcntl(int filedes, int command, …)

Arguments

filedes
file descriptor on which the command is performed
command
command performed on file descriptor. Some commands require additional arguments to be supplied
...
the data associated with the command to be executed

Return Value

The return value and error conditions are dependent on the individual commands.

Remarks

This function is implemented as a stub that must be completed to suit the application.

The following table shows the available commands.

F_DUPFDDuplicate the file descriptor (return another file descriptor pointing to the same open file).
F_GETFDGet flags associated with the file descriptor.
F_SETFDSet flags associated with the file descriptor.
F_GETFLGet flags associated with the open file.
F_SETFLSet flags associated with the open file.
F_GETLKTest a file lock.
F_SETLKSet or clear a file lock.
F_SETLKWLike F_SETLK, but wait for completion.
F_OFD_GETLKTest an open file description lock.
F_OFD_SETLKSet or clear an open file description lock
F_OFD_SETLKWLike F_OFD_SETLK, but block until lock is acquired.
F_GETOWNGet process or process group ID to receive SIGIO signals.
F_SETOWNSet process or process group ID to receive SIGIO signals.

Source File

fcntl.c