diff options
Diffstat (limited to 'include/linux/futex.h')
-rw-r--r-- | include/linux/futex.h | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/include/linux/futex.h b/include/linux/futex.h index 820125c628c1..899fc7f20edd 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | 5 | ||
6 | union ktime; | ||
7 | |||
6 | /* Second argument to futex syscall */ | 8 | /* Second argument to futex syscall */ |
7 | 9 | ||
8 | 10 | ||
@@ -15,6 +17,19 @@ | |||
15 | #define FUTEX_LOCK_PI 6 | 17 | #define FUTEX_LOCK_PI 6 |
16 | #define FUTEX_UNLOCK_PI 7 | 18 | #define FUTEX_UNLOCK_PI 7 |
17 | #define FUTEX_TRYLOCK_PI 8 | 19 | #define FUTEX_TRYLOCK_PI 8 |
20 | #define FUTEX_CMP_REQUEUE_PI 9 | ||
21 | |||
22 | #define FUTEX_PRIVATE_FLAG 128 | ||
23 | #define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG | ||
24 | |||
25 | #define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) | ||
26 | #define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) | ||
27 | #define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) | ||
28 | #define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG) | ||
29 | #define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG) | ||
30 | #define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) | ||
31 | #define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) | ||
32 | #define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) | ||
18 | 33 | ||
19 | /* | 34 | /* |
20 | * Support for robust futexes: the kernel cleans up held futexes at | 35 | * Support for robust futexes: the kernel cleans up held futexes at |
@@ -83,9 +98,14 @@ struct robust_list_head { | |||
83 | #define FUTEX_OWNER_DIED 0x40000000 | 98 | #define FUTEX_OWNER_DIED 0x40000000 |
84 | 99 | ||
85 | /* | 100 | /* |
101 | * Some processes have been requeued on this PI-futex | ||
102 | */ | ||
103 | #define FUTEX_WAITER_REQUEUED 0x20000000 | ||
104 | |||
105 | /* | ||
86 | * The rest of the robust-futex field is for the TID: | 106 | * The rest of the robust-futex field is for the TID: |
87 | */ | 107 | */ |
88 | #define FUTEX_TID_MASK 0x3fffffff | 108 | #define FUTEX_TID_MASK 0x0fffffff |
89 | 109 | ||
90 | /* | 110 | /* |
91 | * This limit protects against a deliberately circular list. | 111 | * This limit protects against a deliberately circular list. |
@@ -94,7 +114,7 @@ struct robust_list_head { | |||
94 | #define ROBUST_LIST_LIMIT 2048 | 114 | #define ROBUST_LIST_LIMIT 2048 |
95 | 115 | ||
96 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
97 | long do_futex(u32 __user *uaddr, int op, u32 val, unsigned long timeout, | 117 | long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, |
98 | u32 __user *uaddr2, u32 val2, u32 val3); | 118 | u32 __user *uaddr2, u32 val2, u32 val3); |
99 | 119 | ||
100 | extern int | 120 | extern int |
@@ -106,9 +126,20 @@ handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi); | |||
106 | * Don't rearrange members without looking at hash_futex(). | 126 | * Don't rearrange members without looking at hash_futex(). |
107 | * | 127 | * |
108 | * offset is aligned to a multiple of sizeof(u32) (== 4) by definition. | 128 | * offset is aligned to a multiple of sizeof(u32) (== 4) by definition. |
109 | * We set bit 0 to indicate if it's an inode-based key. | 129 | * We use the two low order bits of offset to tell what is the kind of key : |
110 | */ | 130 | * 00 : Private process futex (PTHREAD_PROCESS_PRIVATE) |
131 | * (no reference on an inode or mm) | ||
132 | * 01 : Shared futex (PTHREAD_PROCESS_SHARED) | ||
133 | * mapped on a file (reference on the underlying inode) | ||
134 | * 10 : Shared futex (PTHREAD_PROCESS_SHARED) | ||
135 | * (but private mapping on an mm, and reference taken on it) | ||
136 | */ | ||
137 | |||
138 | #define FUT_OFF_INODE 1 /* We set bit 0 if key has a reference on inode */ | ||
139 | #define FUT_OFF_MMSHARED 2 /* We set bit 1 if key has a reference on mm */ | ||
140 | |||
111 | union futex_key { | 141 | union futex_key { |
142 | u32 __user *uaddr; | ||
112 | struct { | 143 | struct { |
113 | unsigned long pgoff; | 144 | unsigned long pgoff; |
114 | struct inode *inode; | 145 | struct inode *inode; |
@@ -125,7 +156,8 @@ union futex_key { | |||
125 | int offset; | 156 | int offset; |
126 | } both; | 157 | } both; |
127 | }; | 158 | }; |
128 | int get_futex_key(u32 __user *uaddr, union futex_key *key); | 159 | int get_futex_key(u32 __user *uaddr, struct rw_semaphore *shared, |
160 | union futex_key *key); | ||
129 | void get_futex_key_refs(union futex_key *key); | 161 | void get_futex_key_refs(union futex_key *key); |
130 | void drop_futex_key_refs(union futex_key *key); | 162 | void drop_futex_key_refs(union futex_key *key); |
131 | 163 | ||