.. | .. |
---|
4 | 4 | |
---|
5 | 5 | #include <linux/rculist.h> |
---|
6 | 6 | #include <linux/wait.h> |
---|
7 | | -#include <linux/atomic.h> |
---|
| 7 | +#include <linux/refcount.h> |
---|
8 | 8 | |
---|
9 | 9 | enum pid_type |
---|
10 | 10 | { |
---|
.. | .. |
---|
58 | 58 | |
---|
59 | 59 | struct pid |
---|
60 | 60 | { |
---|
61 | | - atomic_t count; |
---|
| 61 | + refcount_t count; |
---|
62 | 62 | unsigned int level; |
---|
| 63 | + spinlock_t lock; |
---|
63 | 64 | /* lists of tasks that use this pid */ |
---|
64 | 65 | struct hlist_head tasks[PIDTYPE_MAX]; |
---|
| 66 | + struct hlist_head inodes; |
---|
65 | 67 | /* wait queue for pidfd notifications */ |
---|
66 | 68 | wait_queue_head_t wait_pidfd; |
---|
67 | 69 | struct rcu_head rcu; |
---|
.. | .. |
---|
72 | 74 | |
---|
73 | 75 | extern const struct file_operations pidfd_fops; |
---|
74 | 76 | |
---|
| 77 | +struct file; |
---|
| 78 | + |
---|
| 79 | +extern struct pid *pidfd_pid(const struct file *file); |
---|
| 80 | +struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags); |
---|
| 81 | + |
---|
75 | 82 | static inline struct pid *get_pid(struct pid *pid) |
---|
76 | 83 | { |
---|
77 | 84 | if (pid) |
---|
78 | | - atomic_inc(&pid->count); |
---|
| 85 | + refcount_inc(&pid->count); |
---|
79 | 86 | return pid; |
---|
80 | 87 | } |
---|
81 | 88 | |
---|
82 | 89 | extern void put_pid(struct pid *pid); |
---|
83 | 90 | extern struct task_struct *pid_task(struct pid *pid, enum pid_type); |
---|
| 91 | +static inline bool pid_has_task(struct pid *pid, enum pid_type type) |
---|
| 92 | +{ |
---|
| 93 | + return !hlist_empty(&pid->tasks[type]); |
---|
| 94 | +} |
---|
84 | 95 | extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type); |
---|
85 | 96 | |
---|
86 | 97 | extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); |
---|
.. | .. |
---|
92 | 103 | extern void detach_pid(struct task_struct *task, enum pid_type); |
---|
93 | 104 | extern void change_pid(struct task_struct *task, enum pid_type, |
---|
94 | 105 | struct pid *pid); |
---|
| 106 | +extern void exchange_tids(struct task_struct *task, struct task_struct *old); |
---|
95 | 107 | extern void transfer_pid(struct task_struct *old, struct task_struct *new, |
---|
96 | 108 | enum pid_type); |
---|
97 | 109 | |
---|
98 | 110 | struct pid_namespace; |
---|
99 | 111 | extern struct pid_namespace init_pid_ns; |
---|
| 112 | + |
---|
| 113 | +extern int pid_max; |
---|
| 114 | +extern int pid_max_min, pid_max_max; |
---|
100 | 115 | |
---|
101 | 116 | /* |
---|
102 | 117 | * look up a PID in the hash table. Must be called with the tasklist_lock |
---|
.. | .. |
---|
115 | 130 | */ |
---|
116 | 131 | extern struct pid *find_get_pid(int nr); |
---|
117 | 132 | extern struct pid *find_ge_pid(int nr, struct pid_namespace *); |
---|
118 | | -int next_pidmap(struct pid_namespace *pid_ns, unsigned int last); |
---|
119 | 133 | |
---|
120 | | -extern struct pid *alloc_pid(struct pid_namespace *ns); |
---|
| 134 | +extern struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid, |
---|
| 135 | + size_t set_tid_size); |
---|
121 | 136 | extern void free_pid(struct pid *pid); |
---|
122 | 137 | extern void disable_pid_allocation(struct pid_namespace *ns); |
---|
123 | 138 | |
---|