diff options
Diffstat (limited to 'include/linux/futex.h')
-rw-r--r-- | include/linux/futex.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/include/linux/futex.h b/include/linux/futex.h index 1bd8dfcb037b..899fc7f20edd 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h | |||
@@ -19,6 +19,18 @@ union ktime; | |||
19 | #define FUTEX_TRYLOCK_PI 8 | 19 | #define FUTEX_TRYLOCK_PI 8 |
20 | #define FUTEX_CMP_REQUEUE_PI 9 | 20 | #define FUTEX_CMP_REQUEUE_PI 9 |
21 | 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) | ||
33 | |||
22 | /* | 34 | /* |
23 | * Support for robust futexes: the kernel cleans up held futexes at | 35 | * Support for robust futexes: the kernel cleans up held futexes at |
24 | * thread exit time. | 36 | * thread exit time. |
@@ -114,8 +126,18 @@ handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi); | |||
114 | * Don't rearrange members without looking at hash_futex(). | 126 | * Don't rearrange members without looking at hash_futex(). |
115 | * | 127 | * |
116 | * 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. |
117 | * 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 : |
118 | */ | 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 | |||
119 | union futex_key { | 141 | union futex_key { |
120 | u32 __user *uaddr; | 142 | u32 __user *uaddr; |
121 | struct { | 143 | struct { |
@@ -134,7 +156,8 @@ union futex_key { | |||
134 | int offset; | 156 | int offset; |
135 | } both; | 157 | } both; |
136 | }; | 158 | }; |
137 | 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); | ||
138 | void get_futex_key_refs(union futex_key *key); | 161 | void get_futex_key_refs(union futex_key *key); |
139 | void drop_futex_key_refs(union futex_key *key); | 162 | void drop_futex_key_refs(union futex_key *key); |
140 | 163 | ||