Home » Mailing lists » Devel » [RFC][PATCH 0/15] Pid namespaces
Re: [PATCH 8/15] Helpers to find the task by its numerical ids [message #15324 is a reply to message #15302] |
Thu, 26 July 2007 19:05   |
Dave Hansen
Messages: 240 Registered: October 2005
|
Senior Member |
|
|
On Thu, 2007-07-26 at 18:51 +0400, Pavel Emelyanov wrote:
> +extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
> + struct pid_namespace *ns);
> +
> +#define find_task_by_pid_ns(nr, ns) \
> + find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns)
> +#define find_task_by_pid_type(type, nr) \
> + find_task_by_pid_type_ns(type, nr, &init_pid_ns)
> +#define find_task_by_pid(nr) \
> + find_task_by_pid_type(PIDTYPE_PID, nr)
> +
> extern void __set_special_pids(pid_t session, pid_t pgrp);
Do these _have_ to be macros?
> /* per-UID process charging. */
> diff -upr linux-2.6.23-rc1-mm1.orig/kernel/pid.c linux-2.6.23-rc1-mm1-7/kernel/pid.c
> --- linux-2.6.23-rc1-mm1.orig/kernel/pid.c 2007-07-26 16:34:45.000000000 +0400
> +++ linux-2.6.23-rc1-mm1-7/kernel/pid.c 2007-07-26 16:36:37.000000000 +0400
> @@ -204,19 +221,20 @@ static void delayed_put_pid(struct rcu_h
> goto out;
> }
>
> -struct pid * fastcall find_pid(int nr)
> +struct pid * fastcall find_pid_ns(int nr, struct pid_namespace *ns)
> {
> struct hlist_node *elem;
> - struct pid *pid;
> + struct upid *pnr;
> +
> + hlist_for_each_entry_rcu(pnr, elem,
> + &pid_hash[pid_hashfn(nr, ns)], pid_chain)
> + if (pnr->nr == nr && pnr->ns == ns)
> + return container_of(pnr, struct pid,
> + numbers[ns->level]);
Do we do this loop anywhere else? Should we have a for_each_pid() that
makes this a little less messy?
> - hlist_for_each_entry_rcu(pid, elem,
> - &pid_hash[pid_hashfn(nr)], pid_chain) {
> - if (pid->nr == nr)
> - return pid;
> - }
> return NULL;
> }
> -EXPORT_SYMBOL_GPL(find_pid);
> +EXPORT_SYMBOL_GPL(find_pid_ns);
>
> /*
> * attach_pid() must be called with the tasklist_lock write-held.
> @@ -318,12 +355,13 @@ struct task_struct * fastcall pid_task(s
> /*
> * Must be called under rcu_read_lock() or with tasklist_lock read-held.
> */
> -struct task_struct *find_task_by_pid_type(int type, int nr)
> +struct task_struct *find_task_by_pid_type_ns(int type, int nr,
> + struct pid_namespace *ns)
> {
> - return pid_task(find_pid(nr), type);
> + return pid_task(find_pid_ns(nr, ns), type);
> }
>
> -EXPORT_SYMBOL(find_task_by_pid_type);
> +EXPORT_SYMBOL(find_task_by_pid_type_ns);
>
> struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
> {
> @@ -342,7 +426,7 @@ struct pid *find_get_pid(pid_t nr)
> struct pid *pid;
>
> rcu_read_lock();
> - pid = get_pid(find_pid(nr));
> + pid = get_pid(find_vpid(nr));
> rcu_read_unlock();
OK, I think this is really confusing. If find_get_pid() finds vpids,
should we not call it find_get_vpid()?
-- Dave
|
|
|
 |
|
[RFC][PATCH 0/15] Pid namespaces
|
 |
|
[PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
By: dev on Thu, 26 July 2007 16:59
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
By: xemul on Fri, 27 July 2007 06:38
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
Re: [PATCH 1/15] Move exit_task_namespaces()
|
 |
|
[PATCH 2/15] Introduce MS_KERNMOUNT flag
|
 |
|
[PATCH 3/15] kern_siginfo helper
|
 |
|
Re: [PATCH 3/15] kern_siginfo helper
|
 |
|
Re: [PATCH 3/15] kern_siginfo helper
|
 |
|
Re: [PATCH 3/15] kern_siginfo helper
|
 |
|
[PATCH 4/15] Make proc_flust_task() flush entries from multiple proc trees
|
 |
|
[PATCH 5/15] Introduce struct upid
|
 |
|
Re: [PATCH 5/15] Introduce struct upid
|
 |
|
Re: [PATCH 5/15] Introduce struct upid
|
 |
|
[PATCH 6/15] Make alloc_pid(), free_pid() and put_pid() work with struct upid
|
 |
|
Re: [PATCH 6/15] Make alloc_pid(), free_pid() and put_pid() work with struct upid
|
 |
|
Re: [PATCH 6/15] Make alloc_pid(), free_pid() and put_pid() work with struct upid
|
 |
|
[PATCH 7/15] Helpers to obtain pid numbers
|
 |
|
Re: [PATCH 7/15] Helpers to obtain pid numbers
|
 |
|
Re: [PATCH 7/15] Helpers to obtain pid numbers
|
 |
|
Re: [PATCH 7/15] Helpers to obtain pid numbers
|
 |
|
Re: [PATCH 7/15] Helpers to obtain pid numbers
|
 |
|
[PATCH 8/15] Helpers to find the task by its numerical ids
|
 |
|
Re: [PATCH 8/15] Helpers to find the task by its numerical ids
|
 |
|
Re: [PATCH 8/15] Helpers to find the task by its numerical ids
|
 |
|
Re: [PATCH 8/15] Helpers to find the task by its numerical ids
|
 |
|
Re: [PATCH 8/15] Helpers to find the task by its numerical ids
|
 |
|
[PATCH 9/15] Move alloc_pid() after the namespace is cloned
|
 |
|
Re: [PATCH 9/15] Move alloc_pid() after the namespace is cloned
|
 |
|
Re: [PATCH 9/15] Move alloc_pid() after the namespace is cloned
|
 |
|
Re: [PATCH 9/15] Move alloc_pid() after the namespace is cloned
|
 |
|
Re: [PATCH 9/15] Move alloc_pid() after the namespace is cloned
|
 |
|
[PATCH 10/15] Make each namespace has its own proc tree
|
 |
|
Re: [PATCH 10/15] Make each namespace has its own proc tree
|
 |
|
Re: [PATCH 10/15] Make each namespace has its own proc tree
|
 |
|
Re: [PATCH 10/15] Make each namespace has its own proc tree
|
 |
|
Re: [PATCH 10/15] Make each namespace has its own proc tree
|
 |
|
[PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
By: serue on Fri, 27 July 2007 19:59
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
Re: [PATCH 11/15] Signal semantics
By: serue on Wed, 01 August 2007 16:13
|
 |
|
Re: [PATCH 11/15] Signal semantics
By: dev on Thu, 02 August 2007 08:35
|
 |
|
Re: [PATCH 11/15] Signal semantics
By: serue on Thu, 02 August 2007 20:09
|
 |
|
Re: [PATCH 11/15] Signal semantics
|
 |
|
[PATCH 12/15] Miscelaneous stuff for pid namespaces
|
 |
|
Re: [PATCH 12/15] Miscelaneous stuff for pid namespaces
|
 |
|
Re: [PATCH 12/15] Miscelaneous stuff for pid namespaces
|
 |
|
[PATCH 13/15] Clone the pid namespace
|
 |
|
[PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
By: dev on Thu, 02 August 2007 08:37
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
By: serue on Thu, 02 August 2007 19:13
|
 |
|
Re: [PATCH 14/15] Destroy pid namespace on init's death
|
 |
|
[PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [PATCH 15/15] Hooks over the code to show correct values to user
|
 |
|
Re: [RFC][PATCH 0/15] Pid namespaces
|
 |
|
Re: [RFC][PATCH 0/15] Pid namespaces
|
 |
|
Re: [RFC][PATCH 0/15] Pid namespaces
|
Goto Forum:
Current Time: Sat Sep 06 12:22:21 GMT 2025
Total time taken to generate the page: 0.09021 seconds
|