diff options
author | Pavel Emelianov <xemul@openvz.org> | 2007-10-19 02:39:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:37 -0400 |
commit | a47afb0f9d794d525a372c8d69902147cc88222a (patch) | |
tree | 7bd67280e2edc1c3b1803d4a93bee794088e9342 | |
parent | 858d72ead4864da0fb0b89b919524125ce998e27 (diff) |
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>
-rw-r--r-- | arch/mips/kernel/irixelf.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/irixsig.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 4 | ||||
-rw-r--r-- | arch/sparc64/solaris/misc.c | 4 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 4 | ||||
-rw-r--r-- | fs/autofs/inode.c | 2 | ||||
-rw-r--r-- | fs/autofs/root.c | 4 | ||||
-rw-r--r-- | fs/autofs4/autofs_i.h | 2 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 4 | ||||
-rw-r--r-- | fs/autofs4/root.c | 4 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 8 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 8 | ||||
-rw-r--r-- | fs/coda/upcall.c | 2 | ||||
-rw-r--r-- | fs/proc/array.c | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 15 | ||||
-rw-r--r-- | kernel/exit.c | 10 | ||||
-rw-r--r-- | kernel/fork.c | 4 | ||||
-rw-r--r-- | kernel/signal.c | 2 | ||||
-rw-r--r-- | kernel/sys.c | 14 |
19 files changed, 48 insertions, 53 deletions
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c index b997af713eb3..7852c7cdf29e 100644 --- a/arch/mips/kernel/irixelf.c +++ b/arch/mips/kernel/irixelf.c | |||
@@ -1172,8 +1172,8 @@ static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, u | |||
1172 | prstatus.pr_sighold = current->blocked.sig[0]; | 1172 | prstatus.pr_sighold = current->blocked.sig[0]; |
1173 | psinfo.pr_pid = prstatus.pr_pid = current->pid; | 1173 | psinfo.pr_pid = prstatus.pr_pid = current->pid; |
1174 | psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; | 1174 | psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; |
1175 | psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current); | 1175 | psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_nr(current); |
1176 | psinfo.pr_sid = prstatus.pr_sid = process_session(current); | 1176 | psinfo.pr_sid = prstatus.pr_sid = task_session_nr(current); |
1177 | if (current->pid == current->tgid) { | 1177 | if (current->pid == current->tgid) { |
1178 | /* | 1178 | /* |
1179 | * This is the record for the group leader. Add in the | 1179 | * This is the record for the group leader. Add in the |
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 85c2e389edd6..a0a91056fda7 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c | |||
@@ -609,7 +609,7 @@ repeat: | |||
609 | p = list_entry(_p, struct task_struct, sibling); | 609 | p = list_entry(_p, struct task_struct, sibling); |
610 | if ((type == IRIX_P_PID) && p->pid != pid) | 610 | if ((type == IRIX_P_PID) && p->pid != pid) |
611 | continue; | 611 | continue; |
612 | if ((type == IRIX_P_PGID) && process_group(p) != pid) | 612 | if ((type == IRIX_P_PGID) && task_pgrp_nr(p) != pid) |
613 | continue; | 613 | continue; |
614 | if ((p->exit_signal != SIGCHLD)) | 614 | if ((p->exit_signal != SIGCHLD)) |
615 | continue; | 615 | continue; |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index ee7790d9debe..4c477c7ff74a 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -763,11 +763,11 @@ asmlinkage int irix_setpgrp(int flags) | |||
763 | printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); | 763 | printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); |
764 | #endif | 764 | #endif |
765 | if(!flags) | 765 | if(!flags) |
766 | error = process_group(current); | 766 | error = task_pgrp_nr(current); |
767 | else | 767 | else |
768 | error = sys_setsid(); | 768 | error = sys_setsid(); |
769 | #ifdef DEBUG_PROCGRPS | 769 | #ifdef DEBUG_PROCGRPS |
770 | printk("returning %d\n", process_group(current)); | 770 | printk("returning %d\n", task_pgrp_nr(current)); |
771 | #endif | 771 | #endif |
772 | 772 | ||
773 | return error; | 773 | return error; |
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index 3b67de7455f1..c86cb3091a8e 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c | |||
@@ -415,7 +415,7 @@ asmlinkage int solaris_procids(int cmd, s32 pid, s32 pgid) | |||
415 | 415 | ||
416 | switch (cmd) { | 416 | switch (cmd) { |
417 | case 0: /* getpgrp */ | 417 | case 0: /* getpgrp */ |
418 | return process_group(current); | 418 | return task_pgrp_nr(current); |
419 | case 1: /* setpgrp */ | 419 | case 1: /* setpgrp */ |
420 | { | 420 | { |
421 | int (*sys_setpgid)(pid_t,pid_t) = | 421 | int (*sys_setpgid)(pid_t,pid_t) = |
@@ -426,7 +426,7 @@ asmlinkage int solaris_procids(int cmd, s32 pid, s32 pgid) | |||
426 | ret = sys_setpgid(0, 0); | 426 | ret = sys_setpgid(0, 0); |
427 | if (ret) return ret; | 427 | if (ret) return ret; |
428 | proc_clear_tty(current); | 428 | proc_clear_tty(current); |
429 | return process_group(current); | 429 | return task_pgrp_nr(current); |
430 | } | 430 | } |
431 | case 2: /* getsid */ | 431 | case 2: /* getsid */ |
432 | { | 432 | { |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 9c867cf6de64..9820f86831ee 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3528,7 +3528,7 @@ void __do_SAK(struct tty_struct *tty) | |||
3528 | /* Kill the entire session */ | 3528 | /* Kill the entire session */ |
3529 | do_each_pid_task(session, PIDTYPE_SID, p) { | 3529 | do_each_pid_task(session, PIDTYPE_SID, p) { |
3530 | printk(KERN_NOTICE "SAK: killed process %d" | 3530 | printk(KERN_NOTICE "SAK: killed process %d" |
3531 | " (%s): process_session(p)==tty->session\n", | 3531 | " (%s): task_session_nr(p)==tty->session\n", |
3532 | p->pid, p->comm); | 3532 | p->pid, p->comm); |
3533 | send_sig(SIGKILL, p, 1); | 3533 | send_sig(SIGKILL, p, 1); |
3534 | } while_each_pid_task(session, PIDTYPE_SID, p); | 3534 | } while_each_pid_task(session, PIDTYPE_SID, p); |
@@ -3538,7 +3538,7 @@ void __do_SAK(struct tty_struct *tty) | |||
3538 | do_each_thread(g, p) { | 3538 | do_each_thread(g, p) { |
3539 | if (p->signal->tty == tty) { | 3539 | if (p->signal->tty == tty) { |
3540 | printk(KERN_NOTICE "SAK: killed process %d" | 3540 | printk(KERN_NOTICE "SAK: killed process %d" |
3541 | " (%s): process_session(p)==tty->session\n", | 3541 | " (%s): task_session_nr(p)==tty->session\n", |
3542 | p->pid, p->comm); | 3542 | p->pid, p->comm); |
3543 | send_sig(SIGKILL, p, 1); | 3543 | send_sig(SIGKILL, p, 1); |
3544 | continue; | 3544 | continue; |
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index e7204d71acc9..45f5992a0957 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c | |||
@@ -80,7 +80,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | |||
80 | 80 | ||
81 | *uid = current->uid; | 81 | *uid = current->uid; |
82 | *gid = current->gid; | 82 | *gid = current->gid; |
83 | *pgrp = process_group(current); | 83 | *pgrp = task_pgrp_nr(current); |
84 | 84 | ||
85 | *minproto = *maxproto = AUTOFS_PROTO_VERSION; | 85 | *minproto = *maxproto = AUTOFS_PROTO_VERSION; |
86 | 86 | ||
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index c1489533277a..592f64037ae2 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c | |||
@@ -215,7 +215,7 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr | |||
215 | oz_mode = autofs_oz_mode(sbi); | 215 | oz_mode = autofs_oz_mode(sbi); |
216 | DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, " | 216 | DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, " |
217 | "oz_mode = %d\n", pid_nr(task_pid(current)), | 217 | "oz_mode = %d\n", pid_nr(task_pid(current)), |
218 | process_group(current), sbi->catatonic, | 218 | task_pgrp_nr(current), sbi->catatonic, |
219 | oz_mode)); | 219 | oz_mode)); |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -536,7 +536,7 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp, | |||
536 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); | 536 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); |
537 | void __user *argp = (void __user *)arg; | 537 | void __user *argp = (void __user *)arg; |
538 | 538 | ||
539 | DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,process_group(current))); | 539 | DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,task_pgrp_nr(current))); |
540 | 540 | ||
541 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || | 541 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || |
542 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) | 542 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index d85f42fa9206..2d4ae40718d9 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -131,7 +131,7 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) | |||
131 | filesystem without "magic".) */ | 131 | filesystem without "magic".) */ |
132 | 132 | ||
133 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { | 133 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { |
134 | return sbi->catatonic || process_group(current) == sbi->oz_pgrp; | 134 | return sbi->catatonic || task_pgrp_nr(current) == sbi->oz_pgrp; |
135 | } | 135 | } |
136 | 136 | ||
137 | /* Does a dentry have some pending activity? */ | 137 | /* Does a dentry have some pending activity? */ |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index cd81f0836671..7f05d6ccdb13 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -226,7 +226,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | |||
226 | 226 | ||
227 | *uid = current->uid; | 227 | *uid = current->uid; |
228 | *gid = current->gid; | 228 | *gid = current->gid; |
229 | *pgrp = process_group(current); | 229 | *pgrp = task_pgrp_nr(current); |
230 | 230 | ||
231 | *minproto = AUTOFS_MIN_PROTO_VERSION; | 231 | *minproto = AUTOFS_MIN_PROTO_VERSION; |
232 | *maxproto = AUTOFS_MAX_PROTO_VERSION; | 232 | *maxproto = AUTOFS_MAX_PROTO_VERSION; |
@@ -323,7 +323,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
323 | sbi->pipe = NULL; | 323 | sbi->pipe = NULL; |
324 | sbi->catatonic = 1; | 324 | sbi->catatonic = 1; |
325 | sbi->exp_timeout = 0; | 325 | sbi->exp_timeout = 0; |
326 | sbi->oz_pgrp = process_group(current); | 326 | sbi->oz_pgrp = task_pgrp_nr(current); |
327 | sbi->sb = s; | 327 | sbi->sb = s; |
328 | sbi->version = 0; | 328 | sbi->version = 0; |
329 | sbi->sub_version = 0; | 329 | sbi->sub_version = 0; |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 45ff3d63b758..2bbcc8151dc3 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -582,7 +582,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
582 | oz_mode = autofs4_oz_mode(sbi); | 582 | oz_mode = autofs4_oz_mode(sbi); |
583 | 583 | ||
584 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", | 584 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", |
585 | current->pid, process_group(current), sbi->catatonic, oz_mode); | 585 | current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode); |
586 | 586 | ||
587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); | 587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); |
588 | if (!unhashed) { | 588 | if (!unhashed) { |
@@ -976,7 +976,7 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp, | |||
976 | void __user *p = (void __user *)arg; | 976 | void __user *p = (void __user *)arg; |
977 | 977 | ||
978 | DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", | 978 | DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", |
979 | cmd,arg,sbi,process_group(current)); | 979 | cmd,arg,sbi,task_pgrp_nr(current)); |
980 | 980 | ||
981 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || | 981 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || |
982 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) | 982 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 6e2f3b8dde7f..9ea2b99dc31a 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1385,8 +1385,8 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1385 | prstatus->pr_sighold = p->blocked.sig[0]; | 1385 | prstatus->pr_sighold = p->blocked.sig[0]; |
1386 | prstatus->pr_pid = p->pid; | 1386 | prstatus->pr_pid = p->pid; |
1387 | prstatus->pr_ppid = p->parent->pid; | 1387 | prstatus->pr_ppid = p->parent->pid; |
1388 | prstatus->pr_pgrp = process_group(p); | 1388 | prstatus->pr_pgrp = task_pgrp_nr(p); |
1389 | prstatus->pr_sid = process_session(p); | 1389 | prstatus->pr_sid = task_session_nr(p); |
1390 | if (thread_group_leader(p)) { | 1390 | if (thread_group_leader(p)) { |
1391 | /* | 1391 | /* |
1392 | * This is the record for the group leader. Add in the | 1392 | * This is the record for the group leader. Add in the |
@@ -1431,8 +1431,8 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1431 | 1431 | ||
1432 | psinfo->pr_pid = p->pid; | 1432 | psinfo->pr_pid = p->pid; |
1433 | psinfo->pr_ppid = p->parent->pid; | 1433 | psinfo->pr_ppid = p->parent->pid; |
1434 | psinfo->pr_pgrp = process_group(p); | 1434 | psinfo->pr_pgrp = task_pgrp_nr(p); |
1435 | psinfo->pr_sid = process_session(p); | 1435 | psinfo->pr_sid = task_session_nr(p); |
1436 | 1436 | ||
1437 | i = p->state ? ffz(~p->state) + 1 : 0; | 1437 | i = p->state ? ffz(~p->state) + 1 : 0; |
1438 | psinfo->pr_state = i; | 1438 | psinfo->pr_state = i; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 033861c6b8f1..b8b4e93f6f62 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -1344,8 +1344,8 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1344 | prstatus->pr_sighold = p->blocked.sig[0]; | 1344 | prstatus->pr_sighold = p->blocked.sig[0]; |
1345 | prstatus->pr_pid = p->pid; | 1345 | prstatus->pr_pid = p->pid; |
1346 | prstatus->pr_ppid = p->parent->pid; | 1346 | prstatus->pr_ppid = p->parent->pid; |
1347 | prstatus->pr_pgrp = process_group(p); | 1347 | prstatus->pr_pgrp = task_pgrp_nr(p); |
1348 | prstatus->pr_sid = process_session(p); | 1348 | prstatus->pr_sid = task_session_nr(p); |
1349 | if (thread_group_leader(p)) { | 1349 | if (thread_group_leader(p)) { |
1350 | /* | 1350 | /* |
1351 | * This is the record for the group leader. Add in the | 1351 | * This is the record for the group leader. Add in the |
@@ -1393,8 +1393,8 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1393 | 1393 | ||
1394 | psinfo->pr_pid = p->pid; | 1394 | psinfo->pr_pid = p->pid; |
1395 | psinfo->pr_ppid = p->parent->pid; | 1395 | psinfo->pr_ppid = p->parent->pid; |
1396 | psinfo->pr_pgrp = process_group(p); | 1396 | psinfo->pr_pgrp = task_pgrp_nr(p); |
1397 | psinfo->pr_sid = process_session(p); | 1397 | psinfo->pr_sid = task_session_nr(p); |
1398 | 1398 | ||
1399 | i = p->state ? ffz(~p->state) + 1 : 0; | 1399 | i = p->state ? ffz(~p->state) + 1 : 0; |
1400 | psinfo->pr_state = i; | 1400 | psinfo->pr_state = i; |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index cdb4c07a7870..359e531094dd 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -51,7 +51,7 @@ static void *alloc_upcall(int opcode, int size) | |||
51 | 51 | ||
52 | inp->ih.opcode = opcode; | 52 | inp->ih.opcode = opcode; |
53 | inp->ih.pid = current->pid; | 53 | inp->ih.pid = current->pid; |
54 | inp->ih.pgid = process_group(current); | 54 | inp->ih.pgid = task_pgrp_nr(current); |
55 | #ifdef CONFIG_CODA_FS_OLD_API | 55 | #ifdef CONFIG_CODA_FS_OLD_API |
56 | memset(&inp->ih.cred, 0, sizeof(struct coda_cred)); | 56 | memset(&inp->ih.cred, 0, sizeof(struct coda_cred)); |
57 | inp->ih.cred.cr_fsuid = current->fsuid; | 57 | inp->ih.cred.cr_fsuid = current->fsuid; |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 27b59f5f3bd1..24f7f9f6684d 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -449,8 +449,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
449 | gtime += cputime_add(gtime, sig->gtime); | 449 | gtime += cputime_add(gtime, sig->gtime); |
450 | } | 450 | } |
451 | 451 | ||
452 | sid = signal_session(sig); | 452 | sid = task_session_nr(task); |
453 | pgid = process_group(task); | 453 | pgid = task_pgrp_nr(task); |
454 | ppid = rcu_dereference(task->real_parent)->tgid; | 454 | ppid = rcu_dereference(task->real_parent)->tgid; |
455 | 455 | ||
456 | unlock_task_sighand(task, &flags); | 456 | unlock_task_sighand(task, &flags); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 93a55f2e5ef6..df6049e5e8bf 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1188,24 +1188,19 @@ static inline int rt_task(struct task_struct *p) | |||
1188 | return rt_prio(p->prio); | 1188 | return rt_prio(p->prio); |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | static inline pid_t process_group(struct task_struct *tsk) | 1191 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) |
1192 | { | 1192 | { |
1193 | return tsk->signal->pgrp; | 1193 | return tsk->signal->pgrp; |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | static inline pid_t signal_session(struct signal_struct *sig) | 1196 | static inline pid_t task_session_nr(struct task_struct *tsk) |
1197 | { | 1197 | { |
1198 | return sig->__session; | 1198 | return tsk->signal->__session; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | static inline pid_t process_session(struct task_struct *tsk) | 1201 | static inline void set_task_session(struct task_struct *tsk, pid_t session) |
1202 | { | 1202 | { |
1203 | return signal_session(tsk->signal); | 1203 | tsk->signal->__session = session; |
1204 | } | ||
1205 | |||
1206 | static inline void set_signal_session(struct signal_struct *sig, pid_t session) | ||
1207 | { | ||
1208 | sig->__session = session; | ||
1209 | } | 1204 | } |
1210 | 1205 | ||
1211 | static inline struct pid *task_pid(struct task_struct *task) | 1206 | static inline struct pid *task_pid(struct task_struct *task) |
diff --git a/kernel/exit.c b/kernel/exit.c index cf03a52c3a9a..6e6ec300330f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -299,12 +299,12 @@ void __set_special_pids(pid_t session, pid_t pgrp) | |||
299 | { | 299 | { |
300 | struct task_struct *curr = current->group_leader; | 300 | struct task_struct *curr = current->group_leader; |
301 | 301 | ||
302 | if (process_session(curr) != session) { | 302 | if (task_session_nr(curr) != session) { |
303 | detach_pid(curr, PIDTYPE_SID); | 303 | detach_pid(curr, PIDTYPE_SID); |
304 | set_signal_session(curr->signal, session); | 304 | set_task_session(curr, session); |
305 | attach_pid(curr, PIDTYPE_SID, find_pid(session)); | 305 | attach_pid(curr, PIDTYPE_SID, find_pid(session)); |
306 | } | 306 | } |
307 | if (process_group(curr) != pgrp) { | 307 | if (task_pgrp_nr(curr) != pgrp) { |
308 | detach_pid(curr, PIDTYPE_PGID); | 308 | detach_pid(curr, PIDTYPE_PGID); |
309 | curr->signal->pgrp = pgrp; | 309 | curr->signal->pgrp = pgrp; |
310 | attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp)); | 310 | attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp)); |
@@ -1091,10 +1091,10 @@ static int eligible_child(pid_t pid, int options, struct task_struct *p) | |||
1091 | if (p->pid != pid) | 1091 | if (p->pid != pid) |
1092 | return 0; | 1092 | return 0; |
1093 | } else if (!pid) { | 1093 | } else if (!pid) { |
1094 | if (process_group(p) != process_group(current)) | 1094 | if (task_pgrp_nr(p) != task_pgrp_nr(current)) |
1095 | return 0; | 1095 | return 0; |
1096 | } else if (pid != -1) { | 1096 | } else if (pid != -1) { |
1097 | if (process_group(p) != -pid) | 1097 | if (task_pgrp_nr(p) != -pid) |
1098 | return 0; | 1098 | return 0; |
1099 | } | 1099 | } |
1100 | 1100 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index 61516b89cb6c..fd65bca38a93 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1283,8 +1283,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1283 | 1283 | ||
1284 | if (thread_group_leader(p)) { | 1284 | if (thread_group_leader(p)) { |
1285 | p->signal->tty = current->signal->tty; | 1285 | p->signal->tty = current->signal->tty; |
1286 | p->signal->pgrp = process_group(current); | 1286 | p->signal->pgrp = task_pgrp_nr(current); |
1287 | set_signal_session(p->signal, process_session(current)); | 1287 | set_task_session(p, task_session_nr(current)); |
1288 | attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); | 1288 | attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); |
1289 | attach_pid(p, PIDTYPE_SID, task_session(current)); | 1289 | attach_pid(p, PIDTYPE_SID, task_session(current)); |
1290 | 1290 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index e4f059cd9867..15c6940ab046 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -536,7 +536,7 @@ static int check_kill_permission(int sig, struct siginfo *info, | |||
536 | return error; | 536 | return error; |
537 | error = -EPERM; | 537 | error = -EPERM; |
538 | if (((sig != SIGCONT) || | 538 | if (((sig != SIGCONT) || |
539 | (process_session(current) != process_session(t))) | 539 | (task_session_nr(current) != task_session_nr(t))) |
540 | && (current->euid ^ t->suid) && (current->euid ^ t->uid) | 540 | && (current->euid ^ t->suid) && (current->euid ^ t->uid) |
541 | && (current->uid ^ t->suid) && (current->uid ^ t->uid) | 541 | && (current->uid ^ t->suid) && (current->uid ^ t->uid) |
542 | && !capable(CAP_KILL)) | 542 | && !capable(CAP_KILL)) |
diff --git a/kernel/sys.c b/kernel/sys.c index b8fcbc640193..4cfa213a5ac2 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -968,7 +968,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) | |||
968 | if (err) | 968 | if (err) |
969 | goto out; | 969 | goto out; |
970 | 970 | ||
971 | if (process_group(p) != pgid) { | 971 | if (task_pgrp_nr(p) != pgid) { |
972 | detach_pid(p, PIDTYPE_PGID); | 972 | detach_pid(p, PIDTYPE_PGID); |
973 | p->signal->pgrp = pgid; | 973 | p->signal->pgrp = pgid; |
974 | attach_pid(p, PIDTYPE_PGID, find_pid(pgid)); | 974 | attach_pid(p, PIDTYPE_PGID, find_pid(pgid)); |
@@ -984,7 +984,7 @@ out: | |||
984 | asmlinkage long sys_getpgid(pid_t pid) | 984 | asmlinkage long sys_getpgid(pid_t pid) |
985 | { | 985 | { |
986 | if (!pid) | 986 | if (!pid) |
987 | return process_group(current); | 987 | return task_pgrp_nr(current); |
988 | else { | 988 | else { |
989 | int retval; | 989 | int retval; |
990 | struct task_struct *p; | 990 | struct task_struct *p; |
@@ -996,7 +996,7 @@ asmlinkage long sys_getpgid(pid_t pid) | |||
996 | if (p) { | 996 | if (p) { |
997 | retval = security_task_getpgid(p); | 997 | retval = security_task_getpgid(p); |
998 | if (!retval) | 998 | if (!retval) |
999 | retval = process_group(p); | 999 | retval = task_pgrp_nr(p); |
1000 | } | 1000 | } |
1001 | read_unlock(&tasklist_lock); | 1001 | read_unlock(&tasklist_lock); |
1002 | return retval; | 1002 | return retval; |
@@ -1008,7 +1008,7 @@ asmlinkage long sys_getpgid(pid_t pid) | |||
1008 | asmlinkage long sys_getpgrp(void) | 1008 | asmlinkage long sys_getpgrp(void) |
1009 | { | 1009 | { |
1010 | /* SMP - assuming writes are word atomic this is fine */ | 1010 | /* SMP - assuming writes are word atomic this is fine */ |
1011 | return process_group(current); | 1011 | return task_pgrp_nr(current); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | #endif | 1014 | #endif |
@@ -1016,7 +1016,7 @@ asmlinkage long sys_getpgrp(void) | |||
1016 | asmlinkage long sys_getsid(pid_t pid) | 1016 | asmlinkage long sys_getsid(pid_t pid) |
1017 | { | 1017 | { |
1018 | if (!pid) | 1018 | if (!pid) |
1019 | return process_session(current); | 1019 | return task_session_nr(current); |
1020 | else { | 1020 | else { |
1021 | int retval; | 1021 | int retval; |
1022 | struct task_struct *p; | 1022 | struct task_struct *p; |
@@ -1028,7 +1028,7 @@ asmlinkage long sys_getsid(pid_t pid) | |||
1028 | if (p) { | 1028 | if (p) { |
1029 | retval = security_task_getsid(p); | 1029 | retval = security_task_getsid(p); |
1030 | if (!retval) | 1030 | if (!retval) |
1031 | retval = process_session(p); | 1031 | retval = task_session_nr(p); |
1032 | } | 1032 | } |
1033 | read_unlock(&tasklist_lock); | 1033 | read_unlock(&tasklist_lock); |
1034 | return retval; | 1034 | return retval; |
@@ -1065,7 +1065,7 @@ asmlinkage long sys_setsid(void) | |||
1065 | group_leader->signal->tty = NULL; | 1065 | group_leader->signal->tty = NULL; |
1066 | spin_unlock(&group_leader->sighand->siglock); | 1066 | spin_unlock(&group_leader->sighand->siglock); |
1067 | 1067 | ||
1068 | err = process_group(group_leader); | 1068 | err = task_pgrp_nr(group_leader); |
1069 | out: | 1069 | out: |
1070 | write_unlock_irq(&tasklist_lock); | 1070 | write_unlock_irq(&tasklist_lock); |
1071 | return err; | 1071 | return err; |