]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/futex.h
1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/sched.h>
6 #include <linux/ktime.h>
8 #include <uapi/linux/futex.h>
14 long do_futex(u32 __user
*uaddr
, int op
, u32 val
, ktime_t
*timeout
,
15 u32 __user
*uaddr2
, u32 val2
, u32 val3
);
18 * Futexes are matched on equal values of this key.
19 * The key type depends on whether it's a shared or private mapping.
20 * Don't rearrange members without looking at hash_futex().
22 * offset is aligned to a multiple of sizeof(u32) (== 4) by definition.
23 * We use the two low order bits of offset to tell what is the kind of key :
24 * 00 : Private process futex (PTHREAD_PROCESS_PRIVATE)
25 * (no reference on an inode or mm)
26 * 01 : Shared futex (PTHREAD_PROCESS_SHARED)
27 * mapped on a file (reference on the underlying inode)
28 * 10 : Shared futex (PTHREAD_PROCESS_SHARED)
29 * (but private mapping on an mm, and reference taken on it)
32 #define FUT_OFF_INODE 1 /* We set bit 0 if key has a reference on inode */
33 #define FUT_OFF_MMSHARED 2 /* We set bit 1 if key has a reference on mm */
42 unsigned long address
;
53 #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
62 static inline void futex_init_task(struct task_struct
*tsk
)
64 tsk
->robust_list
= NULL
;
66 tsk
->compat_robust_list
= NULL
;
68 INIT_LIST_HEAD(&tsk
->pi_state_list
);
69 tsk
->pi_state_cache
= NULL
;
70 tsk
->futex_state
= FUTEX_STATE_OK
;
71 mutex_init(&tsk
->futex_exit_mutex
);
74 void futex_exit_recursive(struct task_struct
*tsk
);
75 void futex_exit_release(struct task_struct
*tsk
);
76 void futex_exec_release(struct task_struct
*tsk
);
78 long do_futex(u32 __user
*uaddr
, int op
, u32 val
, ktime_t
*timeout
,
79 u32 __user
*uaddr2
, u32 val2
, u32 val3
);
81 static inline void futex_init_task(struct task_struct
*tsk
) { }
82 static inline void futex_exit_recursive(struct task_struct
*tsk
) { }
83 static inline void futex_exit_release(struct task_struct
*tsk
) { }
84 static inline void futex_exec_release(struct task_struct
*tsk
) { }