• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/kernel/

Lines Matching refs:pid

8  * pid-structures are backing objects for tasks sharing a given ID to chain
44 struct pid init_struct_pid = INIT_STRUCT_PID;
87 struct pid *pid;
90 pid = task_pid(tsk);
91 if (pid != NULL && pid->numbers[pid->level].nr == 1)
142 * "earlier" value prevails, then a pid may get reused immediately.
148 * we started looking for a pid.
150 * 'pid' is the pid that we eventually found.
152 static void set_last_pid(struct pid_namespace *pid_ns, int base, int pid)
158 last_write = cmpxchg(&pid_ns->last_pid, prev, pid);
159 } while ((prev != last_write) && (pid_before(base, last_write, pid)));
164 int i, offset, max_scan, pid, last = pid_ns->last_pid;
167 pid = last + 1;
168 if (pid >= pid_max)
169 pid = RESERVED_PIDS;
170 offset = pid & BITS_PER_PAGE_MASK;
171 map = &pid_ns->pidmap[pid/BITS_PER_PAGE];
199 set_last_pid(pid_ns, last, pid);
200 return pid;
203 pid = mk_pid(pid_ns, map, offset);
204 } while (offset < BITS_PER_PAGE && pid < pid_max);
215 pid = mk_pid(pid_ns, map, offset);
238 void put_pid(struct pid *pid)
242 if (!pid)
245 ns = pid->numbers[pid->level].ns;
246 if ((atomic_read(&pid->count) == 1) ||
247 atomic_dec_and_test(&pid->count)) {
248 kmem_cache_free(ns->pid_cachep, pid);
256 struct pid *pid = container_of(rhp, struct pid, rcu);
257 put_pid(pid);
260 void free_pid(struct pid *pid)
267 for (i = 0; i <= pid->level; i++)
268 hlist_del_rcu(&pid->numbers[i].pid_chain);
271 for (i = 0; i <= pid->level; i++)
272 free_pidmap(pid->numbers + i);
274 call_rcu(&pid->rcu, delayed_put_pid);
277 struct pid *alloc_pid(struct pid_namespace *ns)
279 struct pid *pid;
285 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
286 if (!pid)
295 pid->numbers[i].nr = nr;
296 pid->numbers[i].ns = tmp;
301 pid->level = ns->level;
302 atomic_set(&pid->count, 1);
304 INIT_HLIST_HEAD(&pid->tasks[type]);
306 upid = pid->numbers + ns->level;
308 for ( ; upid >= pid->numbers; --upid)
314 return pid;
318 free_pidmap(pid->numbers + i);
320 kmem_cache_free(ns->pid_cachep, pid);
321 pid = NULL;
325 struct pid *find_pid_ns(int nr, struct pid_namespace *ns)
333 return container_of(pnr, struct pid,
340 struct pid *find_vpid(int nr)
350 struct pid *pid)
355 link->pid = pid;
356 hlist_add_head_rcu(&link->node, &pid->tasks[type]);
360 struct pid *new)
363 struct pid *pid;
367 pid = link->pid;
370 link->pid = new;
373 if (!hlist_empty(&pid->tasks[tmp]))
376 free_pid(pid);
385 struct pid *pid)
387 __change_pid(task, type, pid);
388 attach_pid(task, type, pid);
395 new->pids[type].pid = old->pids[type].pid;
399 struct task_struct *pid_task(struct pid *pid, enum pid_type type)
402 if (pid) {
404 first = rcu_dereference_check(pid->tasks[type].first,
427 struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
429 struct pid *pid;
433 pid = get_pid(task->pids[type].pid);
435 return pid;
438 struct task_struct *get_pid_task(struct pid *pid, enum pid_type type)
442 result = pid_task(pid, type);
449 struct pid *find_get_pid(pid_t nr)
451 struct pid *pid;
454 pid = get_pid(find_vpid(nr));
457 return pid;
461 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
466 if (pid && ns->level <= pid->level) {
467 upid = &pid->numbers[ns->level];
474 pid_t pid_vnr(struct pid *pid)
476 return pid_nr_ns(pid, current->nsproxy->pid_ns);
491 nr = pid_nr_ns(task->pids[type].pid, ns);
512 * Used by proc to find the first pid that is greater than or equal to nr.
514 * If there is a pid at nr this function is exactly the same as find_pid_ns.
516 struct pid *find_ge_pid(int nr, struct pid_namespace *ns)
518 struct pid *pid;
521 pid = find_pid_ns(nr, ns);
522 if (pid)
527 return pid;
531 * The pid hash table is scaled according to the amount of memory in the
562 init_pid_ns.pid_cachep = KMEM_CACHE(pid,