FUTEX_FD − create a file descriptor associated with a futex
Standard C library (libc, −lc)
#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);
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.
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.
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. |
Linux.
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.
futex(2)