From: Sukadev Bhattiprolu Date: Fri, 11 May 2007 05:23:04 +0000 (-0700) Subject: Use task_pgrp() task_session() in copy_process() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0800d30832ddecf2d9dc40068fed9df95930a8f1;p=openwrt%2Fstaging%2Fblogic.git Use task_pgrp() task_session() in copy_process() Use task_pgrp() and task_session() in copy_process(), and avoid find_pid() call when attaching the task to its process group and session. Signed-off-by: Sukadev Bhattiprolu Cc: Cedric Le Goater Cc: Dave Hansen Cc: Serge Hallyn Cc: Acked-by: Eric W. Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/fork.c b/kernel/fork.c index cf13c44f3da3..083bf8953ce8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1249,14 +1249,11 @@ static struct task_struct *copy_process(unsigned long clone_flags, __ptrace_link(p, current->parent); if (thread_group_leader(p)) { - pid_t pgid = process_group(current); - pid_t sid = process_session(current); - p->signal->tty = current->signal->tty; - p->signal->pgrp = pgid; + p->signal->pgrp = process_group(current); set_signal_session(p->signal, process_session(current)); - attach_pid(p, PIDTYPE_PGID, find_pid(pgid)); - attach_pid(p, PIDTYPE_SID, find_pid(sid)); + attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); + attach_pid(p, PIDTYPE_SID, task_session(current)); list_add_tail_rcu(&p->tasks, &init_task.tasks); __get_cpu_var(process_counts)++;