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_DUPFD | Duplicate the file descriptor (return another file descriptor pointing to the same open file). |
F_GETFD | Get flags associated with the file descriptor. |
F_SETFD | Set flags associated with the file descriptor. |
F_GETFL | Get flags associated with the open file. |
F_SETFL | Set flags associated with the open file. |
F_GETLK | Test a file lock. |
F_SETLK | Set or clear a file lock. |
F_SETLKW | Like F_SETLK , but wait for completion. |
F_OFD_GETLK | Test an open file description lock. |
F_OFD_SETLK | Set or clear an open file description lock |
F_OFD_SETLKW | Like F_OFD_SETLK , but block until lock is acquired. |
F_GETOWN | Get process or process group ID to receive SIGIO signals. |
F_SETOWN | Set process or process group ID to receive SIGIO signals. |
Source File
fcntl.c