OpenVZ Forum


Home » Mailing lists » Devel » [RFC][PATCH] Pass struct pid * to copy_process()
Re: [RFC][PATCH] Pass struct pid * to copy_process() [message #17218 is a reply to message #17145] Tue, 16 January 2007 14:02 Go to previous message
Cedric Le Goater is currently offline  Cedric Le Goater
Messages: 443
Registered: February 2006
Senior Member
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@us.ibm.com>
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
> Cc: Cedric Le Goater <clg@fr.ibm.com>
> Cc: Dave Hansen <haveblue@us.ibm.com>
> Cc: Serge Hallyn <serue@us.ibm.com>
> Cc: Eric Biederman <ebiederm@xmission.com>
> Cc: containers@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@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers
 
Read Message
Read Message
Previous Topic: [RFC][PATCH] Static init struct pid for swapper
Next Topic: [PATCH -mm] uts namespace : remove CONFIG_UTS_NS
Goto Forum:
  


Current Time: Sun Jul 27 13:33:17 GMT 2025

Total time taken to generate the page: 0.34231 seconds