[Devel] [PATCH] Use task_pgrp() and task_session() in setpgid/setsid

sukadev at us.ibm.com sukadev at us.ibm.com
Thu Feb 22 15:30:51 PST 2007


From: Sukadev Bhattiprolu <sukadev at us.ibm.com>
Subject: [PATCH] Use task_pgrp() and task_session() in setpgid/setsid

Use the container-friendly interfaces task_pgrp() and task_session()
in getpgid() and setpgid().


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: containers at lists.osdl.org
---
 kernel/sys.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: lx26-20-mm1/kernel/sys.c
===================================================================
--- lx26-20-mm1.orig/kernel/sys.c	2007-02-16 14:42:41.000000000 -0800
+++ lx26-20-mm1/kernel/sys.c	2007-02-16 15:42:09.000000000 -0800
@@ -1483,7 +1483,7 @@ asmlinkage long sys_setpgid(pid_t pid, p
 	if (err)
 		goto out;
 
-	if (process_group(p) != pgid) {
+	if (pid_nr(task_pgrp(p)) != pgid) {
 		detach_pid(p, PIDTYPE_PGID);
 		p->signal->pgrp = pgid;
 		attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
@@ -1499,7 +1499,7 @@ out:
 asmlinkage long sys_getpgid(pid_t pid)
 {
 	if (!pid)
-		return process_group(current);
+		return pid_nr(task_pgrp(current));
 	else {
 		int retval;
 		struct task_struct *p;
@@ -1511,7 +1511,7 @@ asmlinkage long sys_getpgid(pid_t pid)
 		if (p) {
 			retval = security_task_getpgid(p);
 			if (!retval)
-				retval = process_group(p);
+				retval = pid_nr(task_pgrp(p));
 		}
 		read_unlock(&tasklist_lock);
 		return retval;
@@ -1523,7 +1523,7 @@ asmlinkage long sys_getpgid(pid_t pid)
 asmlinkage long sys_getpgrp(void)
 {
 	/* SMP - assuming writes are word atomic this is fine */
-	return process_group(current);
+	return pid_nr(task_pgrp(current));
 }
 
 #endif
@@ -1531,7 +1531,7 @@ asmlinkage long sys_getpgrp(void)
 asmlinkage long sys_getsid(pid_t pid)
 {
 	if (!pid)
-		return process_session(current);
+		return pid_nr(task_session(current));
 	else {
 		int retval;
 		struct task_struct *p;
@@ -1543,7 +1543,7 @@ asmlinkage long sys_getsid(pid_t pid)
 		if (p) {
 			retval = security_task_getsid(p);
 			if (!retval)
-				retval = process_session(p);
+				retval = pid_nr(task_session(p));
 		}
 		read_unlock(&tasklist_lock);
 		return retval;
@@ -1580,7 +1580,7 @@ asmlinkage long sys_setsid(void)
 	group_leader->signal->tty = NULL;
 	spin_unlock(&group_leader->sighand->siglock);
 
-	err = process_group(group_leader);
+	err = pid_nr(task_pgrp(group_leader));
 out:
 	write_unlock_irq(&tasklist_lock);
 	return err;
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list