[Devel] Re: [RFC][PATCH] Pass struct pid * to copy_process()

Cedric Le Goater clg at fr.ibm.com
Tue Jan 16 06:02:29 PST 2007


Sukadev Bhattiprolu wrote:
> Modify copy_process() to take a struct pid * parameter instead of a pid_t.
> This simplifies the code a bit and also avoids having to call find_pid()
> to convert the pid_t to a struct pid.
> 
> From: Sukadev Bhattiprolu <sukadev at us.ibm.com>
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev at us.ibm.com>
> Cc: Cedric Le Goater <clg at fr.ibm.com>
> Cc: Dave Hansen <haveblue at us.ibm.com>
> Cc: Serge Hallyn <serue at us.ibm.com>
> Cc: Eric Biederman <ebiederm at xmission.com>
> Cc: containers at lists.osdl.org
> ---
>  kernel/fork.c |   46 +++++++++++++++++++++++-----------------------
>  1 files changed, 23 insertions(+), 23 deletions(-)
> 
> Index: lx26-20-rc2-mm1/kernel/fork.c
> ===================================================================
> --- lx26-20-rc2-mm1.orig/kernel/fork.c	2007-01-15 18:05:50.079031592 -0800
> +++ lx26-20-rc2-mm1/kernel/fork.c	2007-01-15 18:31:40.984258160 -0800
> @@ -954,8 +954,9 @@ static struct task_struct *copy_process(
>  					unsigned long stack_size,
>  					int __user *parent_tidptr,
>  					int __user *child_tidptr,
> -					int pid)
> +					struct pid *spid)
>  {
> +	int nr = pid_nr(spid);
>  	int retval;
>  	struct task_struct *p = NULL;
>  
> @@ -1021,7 +1022,7 @@ static struct task_struct *copy_process(
>  	p->did_exec = 0;
>  	delayacct_tsk_init(p);	/* Must remain after dup_task_struct() */
>  	copy_flags(clone_flags, p);
> -	p->pid = pid;
> +	p->pid = nr;

very minor improvement, you could get rid of nr and just say :

	p->pid = pid_nr(spid);


C.
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list