манипулировать файловым дескриптором (manipulate file descriptor)
Ошибки (Error)
EACCES or EAGAIN
Operation is prohibited by locks held by other processes.
EAGAIN The operation is prohibited because the file has been
memory-mapped by another process.
EBADF fd is not an open file descriptor
EBADF cmd is F_SETLK or F_SETLKW and the file descriptor open
mode doesn't match with the type of lock requested.
EBUSY cmd is F_SETPIPE_SZ and the new pipe capacity specified in
arg is smaller than the amount of buffer space currently
used to store data in the pipe.
EBUSY cmd is F_ADD_SEALS, arg includes F_SEAL_WRITE, and there
exists a writable, shared mapping on the file referred to
by fd.
EDEADLK
It was detected that the specified F_SETLKW command would
cause a deadlock.
EFAULT lock is outside your accessible address space.
EINTR cmd is F_SETLKW or F_OFD_SETLKW and the operation was
interrupted by a signal; see signal(7).
EINTR cmd is F_GETLK, F_SETLK, F_OFD_GETLK, or F_OFD_SETLK, and
the operation was interrupted by a signal before the lock
was checked or acquired. Most likely when locking a
remote file (e.g., locking over NFS), but can sometimes
happen locally.
EINVAL The value specified in cmd is not recognized by this
kernel.
EINVAL cmd is F_ADD_SEALS and arg includes an unrecognized
sealing bit.
EINVAL cmd is F_ADD_SEALS or F_GET_SEALS and the filesystem
containing the inode referred to by fd does not support
sealing.
EINVAL cmd is F_DUPFD and arg is negative or is greater than the
maximum allowable value (see the discussion of
RLIMIT_NOFILE in getrlimit(2)).
EINVAL cmd is F_SETSIG and arg is not an allowable signal number.
EINVAL cmd is F_OFD_SETLK, F_OFD_SETLKW, or F_OFD_GETLK, and
l_pid was not specified as zero.
EMFILE cmd is F_DUPFD and the per-process limit on the number of
open file descriptors has been reached.
ENOLCK Too many segment locks open, lock table is full, or a
remote locking protocol failed (e.g., locking over NFS).
ENOTDIR
F_NOTIFY was specified in cmd, but fd does not refer to a
directory.
EPERM cmd is F_SETPIPE_SZ and the soft or hard user pipe limit
has been reached; see pipe(7).
EPERM Attempted to clear the O_APPEND flag on a file that has
the append-only attribute set.
EPERM cmd was F_ADD_SEALS, but fd was not open for writing or
the current set of seals on the file already includes
F_SEAL_SEAL.