1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/ktime.h>
6 #include <uapi/linux/futex.h>
13 handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
16 * Futexes are matched on equal values of this key.
17 * The key type depends on whether it's a shared or private mapping.
18 * Don't rearrange members without looking at hash_futex().
20 * offset is aligned to a multiple of sizeof(u32) (== 4) by definition.
21 * We use the two low order bits of offset to tell what is the kind of key :
22 * 00 : Private process futex (PTHREAD_PROCESS_PRIVATE)
23 * (no reference on an inode or mm)
24 * 01 : Shared futex (PTHREAD_PROCESS_SHARED)
25 * mapped on a file (reference on the underlying inode)
26 * 10 : Shared futex (PTHREAD_PROCESS_SHARED)
27 * (but private mapping on an mm, and reference taken on it)
30 #define FUT_OFF_INODE 1 /* We set bit 0 if key has a reference on inode */
31 #define FUT_OFF_MMSHARED 2 /* We set bit 1 if key has a reference on mm */
40 unsigned long address;
51 #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
54 extern void exit_robust_list(struct task_struct *curr);
56 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
57 u32 __user *uaddr2, u32 val2, u32 val3);
58 #ifdef CONFIG_HAVE_FUTEX_CMPXCHG
59 #define futex_cmpxchg_enabled 1
61 extern int futex_cmpxchg_enabled;
64 static inline void exit_robust_list(struct task_struct *curr)
68 static inline long do_futex(u32 __user *uaddr, int op, u32 val,
69 ktime_t *timeout, u32 __user *uaddr2,
76 #ifdef CONFIG_FUTEX_PI
77 extern void exit_pi_state_list(struct task_struct *curr);
79 static inline void exit_pi_state_list(struct task_struct *curr)