fcntl(2) | System Calls Manual | fcntl(2) |
fcntl - 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-2008.
SVr4, 4.3BSD, POSIX.1-2001.
dup2(2), flock(2), open(2), socket(2), lockf(3), capabilities(7), feature_test_macros(7), lslocks(8)
2025-07-20 | Linux man-pages 6.15 |