FUTEX_FD(2const)

FUTEX_FD2const

Create a file descriptor associated with a futex

Usage

#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);

Library

Standard C library (libc, -lc)

Overview

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.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.