• Home
  • Raw
  • Download

Lines Matching refs:pid

44 struct pid init_struct_pid = INIT_STRUCT_PID;
87 struct pid *pid; in is_container_init() local
90 pid = task_pid(tsk); in is_container_init()
91 if (pid != NULL && pid->numbers[pid->level].nr == 1) in is_container_init()
127 int i, offset, max_scan, pid, last = pid_ns->last_pid; in alloc_pidmap() local
130 pid = last + 1; in alloc_pidmap()
131 if (pid >= pid_max) in alloc_pidmap()
132 pid = RESERVED_PIDS; in alloc_pidmap()
133 offset = pid & BITS_PER_PAGE_MASK; in alloc_pidmap()
134 map = &pid_ns->pidmap[pid/BITS_PER_PAGE]; in alloc_pidmap()
156 pid_ns->last_pid = pid; in alloc_pidmap()
157 return pid; in alloc_pidmap()
160 pid = mk_pid(pid_ns, map, offset); in alloc_pidmap()
167 } while (offset < BITS_PER_PAGE && pid < pid_max && in alloc_pidmap()
168 (i != max_scan || pid < last || in alloc_pidmap()
180 pid = mk_pid(pid_ns, map, offset); in alloc_pidmap()
203 void put_pid(struct pid *pid) in put_pid() argument
207 if (!pid) in put_pid()
210 ns = pid->numbers[pid->level].ns; in put_pid()
211 if ((atomic_read(&pid->count) == 1) || in put_pid()
212 atomic_dec_and_test(&pid->count)) { in put_pid()
213 kmem_cache_free(ns->pid_cachep, pid); in put_pid()
221 struct pid *pid = container_of(rhp, struct pid, rcu); in delayed_put_pid() local
222 put_pid(pid); in delayed_put_pid()
225 void free_pid(struct pid *pid) in free_pid() argument
232 for (i = 0; i <= pid->level; i++) in free_pid()
233 hlist_del_rcu(&pid->numbers[i].pid_chain); in free_pid()
236 for (i = 0; i <= pid->level; i++) in free_pid()
237 free_pidmap(pid->numbers + i); in free_pid()
239 call_rcu(&pid->rcu, delayed_put_pid); in free_pid()
242 struct pid *alloc_pid(struct pid_namespace *ns) in alloc_pid()
244 struct pid *pid; in alloc_pid() local
250 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); in alloc_pid()
251 if (!pid) in alloc_pid()
260 pid->numbers[i].nr = nr; in alloc_pid()
261 pid->numbers[i].ns = tmp; in alloc_pid()
266 pid->level = ns->level; in alloc_pid()
267 atomic_set(&pid->count, 1); in alloc_pid()
269 INIT_HLIST_HEAD(&pid->tasks[type]); in alloc_pid()
273 upid = &pid->numbers[i]; in alloc_pid()
280 return pid; in alloc_pid()
284 free_pidmap(pid->numbers + i); in alloc_pid()
286 kmem_cache_free(ns->pid_cachep, pid); in alloc_pid()
287 pid = NULL; in alloc_pid()
291 struct pid *find_pid_ns(int nr, struct pid_namespace *ns) in find_pid_ns()
299 return container_of(pnr, struct pid, in find_pid_ns()
306 struct pid *find_vpid(int nr) in find_vpid()
316 struct pid *pid) in attach_pid() argument
321 link->pid = pid; in attach_pid()
322 hlist_add_head_rcu(&link->node, &pid->tasks[type]); in attach_pid()
326 struct pid *new) in __change_pid()
329 struct pid *pid; in __change_pid() local
333 pid = link->pid; in __change_pid()
336 link->pid = new; in __change_pid()
339 if (!hlist_empty(&pid->tasks[tmp])) in __change_pid()
342 free_pid(pid); in __change_pid()
351 struct pid *pid) in change_pid() argument
353 __change_pid(task, type, pid); in change_pid()
354 attach_pid(task, type, pid); in change_pid()
361 new->pids[type].pid = old->pids[type].pid; in transfer_pid()
365 struct task_struct *pid_task(struct pid *pid, enum pid_type type) in pid_task() argument
368 if (pid) { in pid_task()
370 first = rcu_dereference(pid->tasks[type].first); in pid_task()
402 struct pid *get_task_pid(struct task_struct *task, enum pid_type type) in get_task_pid()
404 struct pid *pid; in get_task_pid() local
406 pid = get_pid(task->pids[type].pid); in get_task_pid()
408 return pid; in get_task_pid()
411 struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) in get_pid_task() argument
415 result = pid_task(pid, type); in get_pid_task()
422 struct pid *find_get_pid(pid_t nr) in find_get_pid()
424 struct pid *pid; in find_get_pid() local
427 pid = get_pid(find_vpid(nr)); in find_get_pid()
430 return pid; in find_get_pid()
434 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns) in pid_nr_ns() argument
439 if (pid && ns->level <= pid->level) { in pid_nr_ns()
440 upid = &pid->numbers[ns->level]; in pid_nr_ns()
447 pid_t pid_vnr(struct pid *pid) in pid_vnr() argument
449 return pid_nr_ns(pid, current->nsproxy->pid_ns); in pid_vnr()
488 struct pid *find_ge_pid(int nr, struct pid_namespace *ns) in find_ge_pid()
490 struct pid *pid; in find_ge_pid() local
493 pid = find_pid_ns(nr, ns); in find_ge_pid()
494 if (pid) in find_ge_pid()
499 return pid; in find_ge_pid()
534 init_pid_ns.pid_cachep = KMEM_CACHE(pid, in pidmap_init()