Linux Perf
futex.h File Reference
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <linux/futex.h>
#include <pthread.h>
#include <linux/compiler.h>
Include dependency graph for futex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define futex(uaddr, op, val, timeout, uaddr2, val3, opflags)   syscall(SYS_futex, uaddr, op | opflags, val, timeout, uaddr2, val3)
 

Functions

static int futex_wait (u_int32_t *uaddr, u_int32_t val, struct timespec *timeout, int opflags)
 
static int futex_wake (u_int32_t *uaddr, int nr_wake, int opflags)
 
static int futex_lock_pi (u_int32_t *uaddr, struct timespec *timeout, int opflags)
 
static int futex_unlock_pi (u_int32_t *uaddr, int opflags)
 
static int futex_cmp_requeue (u_int32_t *uaddr, u_int32_t val, u_int32_t *uaddr2, int nr_wake, int nr_requeue, int opflags)
 
static int pthread_attr_setaffinity_np (pthread_attr_t *attr __maybe_unused, size_t cpusetsize __maybe_unused, cpu_set_t *cpuset __maybe_unused)
 

Macro Definition Documentation

◆ futex

#define futex (   uaddr,
  op,
  val,
  timeout,
  uaddr2,
  val3,
  opflags 
)    syscall(SYS_futex, uaddr, op | opflags, val, timeout, uaddr2, val3)

futex() - SYS_futex syscall wrapper : address of first futex : futex op code : typically expected value of uaddr, but varies by op : typically an absolute struct timespec (except where noted otherwise). Overloaded by some ops : address of second futex for some ops\ : varies by op : flags to be bitwise OR'd with op, such as FUTEX_PRIVATE_FLAG

futex() is used by all the following futex op wrappers. It can also be used for misuse and abuse testing. Generally, the specific op wrappers should be used instead. It is a macro instead of an static inline function as some of the types over overloaded (timeout is used for nr_requeue for example).

These argument descriptions are the defaults for all like-named arguments in the following wrappers except where noted below.

Definition at line 36 of file futex.h.

Function Documentation

◆ futex_cmp_requeue()

static int futex_cmp_requeue ( u_int32_t *  uaddr,
u_int32_t  val,
u_int32_t *  uaddr2,
int  nr_wake,
int  nr_requeue,
int  opflags 
)
inlinestatic

futex_cmp_requeue() - requeue tasks from uaddr to uaddr2 : wake up to this many tasks : requeue up to this many tasks

Definition at line 83 of file futex.h.

◆ futex_lock_pi()

static int futex_lock_pi ( u_int32_t *  uaddr,
struct timespec *  timeout,
int  opflags 
)
inlinestatic

futex_lock_pi() - block on uaddr as a PI mutex

Definition at line 63 of file futex.h.

◆ futex_unlock_pi()

static int futex_unlock_pi ( u_int32_t *  uaddr,
int  opflags 
)
inlinestatic

futex_unlock_pi() - release uaddr as a PI mutex, waking the top waiter

Definition at line 72 of file futex.h.

◆ futex_wait()

static int futex_wait ( u_int32_t *  uaddr,
u_int32_t  val,
struct timespec *  timeout,
int  opflags 
)
inlinestatic

futex_wait() - block on uaddr with optional timeout : relative timeout

Definition at line 44 of file futex.h.

◆ futex_wake()

static int futex_wake ( u_int32_t *  uaddr,
int  nr_wake,
int  opflags 
)
inlinestatic

futex_wake() - wake one or more tasks blocked on uaddr : wake up to this many tasks

Definition at line 54 of file futex.h.

◆ pthread_attr_setaffinity_np()

static int pthread_attr_setaffinity_np ( pthread_attr_t *attr  __maybe_unused,
size_t cpusetsize  __maybe_unused,
cpu_set_t *cpuset  __maybe_unused 
)
inlinestatic

Definition at line 93 of file futex.h.