diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-18 17:17:51 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-18 17:17:51 +0000 |
commit | f1382dc4850bb459d24a81c6cb0ef93ea7bd4a79 (patch) | |
tree | 225271a3d5dcd4e9dea5ee393556abd754c964b1 /kernel/sys.c | |
parent | 135b00fc2e90e605ac2a96b20b0ebd93851a3f89 (diff) |
o Merge with Linux 2.1.90.
o Divide L1 cache sizes by 1024 before printing, makes the numbers a
bit more credible ...
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 1d8356de0..e86d18c09 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -578,14 +578,16 @@ asmlinkage int sys_setpgid(pid_t pid, pid_t pgid) if (pgid < 0) return -EINVAL; - if((p = find_task_by_pid(pid)) == NULL) - return -ESRCH; - /* From this point forward we keep holding onto the tasklist lock * so that our parent does not change from under us. -DaveM */ read_lock(&tasklist_lock); + err = -ESRCH; + p = find_task_by_pid(pid); + if (!p) + goto out; + if (p->p_pptr == current || p->p_opptr == current) { err = -EPERM; if (p->session != current->session) @@ -622,12 +624,17 @@ asmlinkage int sys_getpgid(pid_t pid) if (!pid) { return current->pgrp; } else { - struct task_struct *p = find_task_by_pid(pid); + int retval; + struct task_struct *p; - if(p) - return p->pgrp; - else - return -ESRCH; + read_lock(&tasklist_lock); + p = find_task_by_pid(pid); + + retval = -ESRCH; + if (p) + retval = p->pgrp; + read_unlock(&tasklist_lock); + return retval; } } @@ -642,12 +649,17 @@ asmlinkage int sys_getsid(pid_t pid) if (!pid) { return current->session; } else { - struct task_struct *p = find_task_by_pid(pid); + int retval; + struct task_struct *p; + read_lock(&tasklist_lock); + p = find_task_by_pid(pid); + + retval = -ESRCH; if(p) - return p->session; - else - return -ESRCH; + retval = p->session; + read_unlock(&tasklist_lock); + return retval; } } |