Linux v2.6.15-rc7
[pohmelfs.git] / include / linux / futex.h
blob10f96c31971ea30daf38c9226d656c0e993af3c0
1 #ifndef _LINUX_FUTEX_H
2 #define _LINUX_FUTEX_H
4 /* Second argument to futex syscall */
7 #define FUTEX_WAIT 0
8 #define FUTEX_WAKE 1
9 #define FUTEX_FD 2
10 #define FUTEX_REQUEUE 3
11 #define FUTEX_CMP_REQUEUE 4
12 #define FUTEX_WAKE_OP 5
14 long do_futex(unsigned long uaddr, int op, int val,
15 unsigned long timeout, unsigned long uaddr2, int val2,
16 int val3);
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; */
24 #define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
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 */
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; */
39 #define FUTEX_OP(op, oparg, cmp, cmparg) \
40 (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
41 | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
43 #endif