nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / futex.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_FUTEX_H
2#define _LINUX_FUTEX_H
3
607ca46e 4#include <uapi/linux/futex.h>
0771dfef 5
9064a678
MF
6struct inode;
7struct mm_struct;
8struct task_struct;
9union ktime;
10
c19384b5 11long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
e2970f2f 12 u32 __user *uaddr2, u32 val2, u32 val3);
1da177e4 13
e3f2ddea
IM
14extern int
15handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
0771dfef 16
9adef58b
RR
17/*
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().
21 *
22 * offset is aligned to a multiple of sizeof(u32) (== 4) by definition.
34f01cc1
ED
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)
30*/
31
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 */
34
9adef58b
RR
35union futex_key {
36 struct {
37 unsigned long pgoff;
38 struct inode *inode;
39 int offset;
40 } shared;
41 struct {
42 unsigned long address;
43 struct mm_struct *mm;
44 int offset;
45 } private;
46 struct {
47 unsigned long word;
48 void *ptr;
49 int offset;
50 } both;
51};
9adef58b 52
38d47c1b
PZ
53#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
54
0771dfef
IM
55#ifdef CONFIG_FUTEX
56extern void exit_robust_list(struct task_struct *curr);
c87e2837 57extern void exit_pi_state_list(struct task_struct *curr);
f26c70a4
HC
58#ifdef CONFIG_HAVE_FUTEX_CMPXCHG
59#define futex_cmpxchg_enabled 1
60#else
a0c1e907 61extern int futex_cmpxchg_enabled;
f26c70a4 62#endif
0771dfef
IM
63#else
64static inline void exit_robust_list(struct task_struct *curr)
65{
66}
c87e2837
IM
67static inline void exit_pi_state_list(struct task_struct *curr)
68{
69}
0771dfef 70#endif
1da177e4 71#endif