12 #include <sys/syscall.h> 13 #include <sys/types.h> 14 #include <linux/futex.h> 36 #define futex(uaddr, op, val, timeout, uaddr2, val3, opflags) \ 37 syscall(SYS_futex, uaddr, op | opflags, val, timeout, uaddr2, val3) 44 futex_wait(u_int32_t *uaddr, u_int32_t val,
struct timespec *timeout,
int opflags)
65 return futex(uaddr, FUTEX_LOCK_PI, 0, timeout, NULL, 0, opflags);
74 return futex(uaddr, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0, opflags);
84 int nr_requeue,
int opflags)
86 return futex(uaddr, FUTEX_CMP_REQUEUE, nr_wake, nr_requeue, uaddr2,
90 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP 92 #include <linux/compiler.h> 94 size_t cpusetsize __maybe_unused,
95 cpu_set_t *cpuset __maybe_unused)
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)
#define futex(uaddr, op, val, timeout, uaddr2, val3, opflags)
static int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused, size_t cpusetsize __maybe_unused, cpu_set_t *cpuset __maybe_unused)
static int futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int opflags)
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_unlock_pi(u_int32_t *uaddr, int opflags)