fcntl

Name

fcntl -- file control

Description

fcntl() is as specified in POSIX 1003.1-2008 (ISO/IEC 9945-2009), but with differences as listed below.

Implementation may set O_LARGEFILE

According to POSIX 1003.1-2008 (ISO/IEC 9945-2009), only an application sets fcntl() flags, for example O_LARGEFILE. However, this specification also allows an implementation to set the O_LARGEFILE flag in the case where the programming environment is one of _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF64, _POSIX_V6_LPBIG_OFFBIG. See getconf and c99 in POSIX 1003.1-2008 (ISO/IEC 9945-2009) for a description of these environments. Thus, calling fcntl() with the F_GETFL command may return O_LARGEFILE as well as flags explicitly set by the application in the case that both the implementation and the application support an off_t of at least 64 bits.

Additional flags

In addition to the available values for cmd, as documented in POSIX 1003.1-2008 (ISO/IEC 9945-2009), this specification permits the following constants.

F_GETSIG shall get the number of the signal to be sent when input or output can occur. If the value is 0, then SIGIO shall be sent. Otherwise, the value retrieved shall be the signal sent, and the signal handler can discover more information when installed with the SA_SIGINFO flag.

F_SETSIG shall set the number of the signal to be sent when input or output can occur. If the value is 0, then SIGIO shall be sent. Otherwise, the value set shall be the signal to be sent, and the signal handler can discover more information when installed with the SA_SIGINFO flag.

F_GETLK64 is analogous to the F_GETLK constant in POSIX 1003.1-2008 (ISO/IEC 9945-2009), but shall provide a 64-bit interface on non-64-bit architectures. It is identical to F_GETLK on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.

F_SETLK64 is analogous to the F_SETLK constant in POSIX 1003.1-2008 (ISO/IEC 9945-2009), but shall provide a 64-bit interface on non-64-bit architectures. It is identical to F_SETLK on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.

F_SETLKW64 is analogous to the F_SETLKW constant in POSIX 1003.1-2008 (ISO/IEC 9945-2009), but provides a 64-bit interface on non-64-bit architectures. It is identical to F_SETLKW on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.