FUTEX_FD(2const)

NAME
FUTEX_FD - create a file descriptor associated with a futex

LIBRARY
Standard C library (libc, -lc)

SYNOPSIS
#include <linux/futex.h>  /* Definition of FUTEX_* constants */
#include <sys/syscall.h>  /* Definition of SYS_* constants */
#include <unistd.h>

[[deprecated]]
long syscall(SYS_futex, uint32_t *uaddr, FUTEX_FD, uint32_t val);

DESCRIPTION
This operation creates a file descriptor that is associated with the futex at uaddr. The caller must close the returned file descriptor after use.

When another process or thread performs a FUTEX_WAKE(2const) on the futex word, the file descriptor indicates as being readable with select(2), poll(2), and epoll(7)

The file descriptor can be used to obtain asynchronous notifications: if val is nonzero, then, when another process or thread executes a FUTEX_WAKE(2const), the caller will receive the signal number that was passed in val.

RETURN VALUE
On error, -1 is returned, and errno is set to indicate the error.

On success, FUTEX_FD Returns the new file descriptor associated with the futex.

ERRORS
See futex(2).

EINVAL
    The signal number supplied in val is invalid.

ENFILE
    The system-wide limit on the total number of open files has been reached.

STANDARDS
Linux.

HISTORY
From Linux 2.6.0 up to and including Linux 2.6.25.

Because it was inherently racy, FUTEX_FD has been removed from Linux 2.6.26 onward.

SEE ALSO
futex(2)