pid namespaces: round up the API

The set of functions process_session, task_session, process_group and
task_pgrp is confusing, as the names can be mixed with each other when looking
at the code for a long time.

The proposals are to
* equip the functions that return the integer with _nr suffix to
  represent that fact,
* and to make all functions work with task (not process) by making
  the common prefix of the same name.

For monotony the routines signal_session() and set_signal_session() are
replaced with task_session_nr() and set_task_session(), especially since they
are only used with the explicit task->signal dereference.

Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Pavel Emelianov
2007-10-18 23:39:46 -07:00
committed by Linus Torvalds
parent 858d72ead4
commit a47afb0f9d
19 changed files with 48 additions and 53 deletions
+7 -7
View File
@@ -968,7 +968,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
if (err)
goto out;
if (process_group(p) != pgid) {
if (task_pgrp_nr(p) != pgid) {
detach_pid(p, PIDTYPE_PGID);
p->signal->pgrp = pgid;
attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
@@ -984,7 +984,7 @@ out:
asmlinkage long sys_getpgid(pid_t pid)
{
if (!pid)
return process_group(current);
return task_pgrp_nr(current);
else {
int retval;
struct task_struct *p;
@@ -996,7 +996,7 @@ asmlinkage long sys_getpgid(pid_t pid)
if (p) {
retval = security_task_getpgid(p);
if (!retval)
retval = process_group(p);
retval = task_pgrp_nr(p);
}
read_unlock(&tasklist_lock);
return retval;
@@ -1008,7 +1008,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 task_pgrp_nr(current);
}
#endif
@@ -1016,7 +1016,7 @@ asmlinkage long sys_getpgrp(void)
asmlinkage long sys_getsid(pid_t pid)
{
if (!pid)
return process_session(current);
return task_session_nr(current);
else {
int retval;
struct task_struct *p;
@@ -1028,7 +1028,7 @@ asmlinkage long sys_getsid(pid_t pid)
if (p) {
retval = security_task_getsid(p);
if (!retval)
retval = process_session(p);
retval = task_session_nr(p);
}
read_unlock(&tasklist_lock);
return retval;
@@ -1065,7 +1065,7 @@ asmlinkage long sys_setsid(void)
group_leader->signal->tty = NULL;
spin_unlock(&group_leader->sighand->siglock);
err = process_group(group_leader);
err = task_pgrp_nr(group_leader);
out:
write_unlock_irq(&tasklist_lock);
return err;