fcntl
manipulate file descriptor
- Provided by: manpages-dev (Version: 6.17-1)
- Source: manpages
- Report a bug
manipulate file descriptor
Standard C library (libc, -lc)
#include <fcntl.h>
int fcntl(int fd, int op, ...);
fcntl() performs one of the operations described below on the open file descriptor fd. The operation is determined by op.
Certain of the operations below are supported only since a particular Linux kernel version. The preferred method of checking whether the host kernel supports a particular operation is to invoke fcntl() with the desired op value and then test whether the call failed with EINVAL, indicating that the kernel does not recognize this value.
For a successful call, the return value depends on the operation.
On error, -1 is returned, and errno is set to indicate the error.
POSIX.1-2024 specifies FD_CLOFORK and F_DUPFD_CLOFORK, but Linux doesn't support them.
POSIX.1-2024.
4.3BSD, SVr4, POSIX.1-1988.
dup2(2), flock(2), open(2), socket(2), lockf(3), capabilities(7), feature_test_macros(7), lslocks(8)