aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/futex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/futex.h')
-rw-r--r--include/linux/futex.h36
1 files changed, 31 insertions, 5 deletions
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 65d6cfdb6d39..10f96c31971e 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,14 +4,40 @@
4/* Second argument to futex syscall */ 4/* Second argument to futex syscall */
5 5
6 6
7#define FUTEX_WAIT (0) 7#define FUTEX_WAIT 0
8#define FUTEX_WAKE (1) 8#define FUTEX_WAKE 1
9#define FUTEX_FD (2) 9#define FUTEX_FD 2
10#define FUTEX_REQUEUE (3) 10#define FUTEX_REQUEUE 3
11#define FUTEX_CMP_REQUEUE (4) 11#define FUTEX_CMP_REQUEUE 4
12#define FUTEX_WAKE_OP 5
12 13
13long do_futex(unsigned long uaddr, int op, int val, 14long do_futex(unsigned long uaddr, int op, int val,
14 unsigned long timeout, unsigned long uaddr2, int val2, 15 unsigned long timeout, unsigned long uaddr2, int val2,
15 int val3); 16 int val3);
16 17
18#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
19#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
20#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
21#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
22#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
23
24#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
25
26#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
27#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
28#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
29#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
30#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
31#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
32
33/* FUTEX_WAKE_OP will perform atomically
34 int oldval = *(int *)UADDR2;
35 *(int *)UADDR2 = oldval OP OPARG;
36 if (oldval CMP CMPARG)
37 wake UADDR2; */
38
39#define FUTEX_OP(op, oparg, cmp, cmparg) \
40 (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
41 | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
42
17#endif 43#endif