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