lkml.org 
[lkml]   [2006]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH 05/20] sched: Fixup the scheduler syscalls to deal with pspaces.
From
Date

The scheduler is controlled by pid, so fix up the guts of it's system
calls to pass the appropriate pspace when looking up tasks by pid.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

kernel/sched.c | 2 +-
kernel/sys.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)

e37379b11b63503c1146cc17cec75c358154a1ec
diff --git a/kernel/sched.c b/kernel/sched.c
index 6579d49..449cc6e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3701,7 +3701,7 @@ task_t *idle_task(int cpu)
*/
static inline task_t *find_process_by_pid(pid_t pid)
{
- return pid ? find_task_by_pid(pid) : current;
+ return pid ? find_task_by_pid(current->pspace, pid) : current;
}

/* Actually do priority change: must hold rq lock. */
diff --git a/kernel/sys.c b/kernel/sys.c
index dc8cb58..bd594c3 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -264,6 +264,7 @@ out:

asmlinkage long sys_setpriority(int which, int who, int niceval)
{
+ struct pspace *pspace = current->pspace;
struct task_struct *g, *p;
struct user_struct *user;
int error = -EINVAL;
@@ -283,16 +284,16 @@ asmlinkage long sys_setpriority(int whic
case PRIO_PROCESS:
if (!who)
who = current->pid;
- p = find_task_by_pid(who);
+ p = find_task_by_pid(pspace, who);
if (p)
error = set_one_prio(p, niceval, error);
break;
case PRIO_PGRP:
if (!who)
who = process_group(current);
- do_each_task_pid(who, PIDTYPE_PGID, p) {
+ do_each_task_pid(pspace, who, PIDTYPE_PGID, p) {
error = set_one_prio(p, niceval, error);
- } while_each_task_pid(who, PIDTYPE_PGID, p);
+ } while_each_task_pid(pspace, who, PIDTYPE_PGID, p);
break;
case PRIO_USER:
user = current->user;
@@ -324,6 +325,7 @@ out:
*/
asmlinkage long sys_getpriority(int which, int who)
{
+ struct pspace *pspace = current->pspace;
struct task_struct *g, *p;
struct user_struct *user;
long niceval, retval = -ESRCH;
@@ -336,7 +338,7 @@ asmlinkage long sys_getpriority(int whic
case PRIO_PROCESS:
if (!who)
who = current->pid;
- p = find_task_by_pid(who);
+ p = find_task_by_pid(pspace, who);
if (p) {
niceval = 20 - task_nice(p);
if (niceval > retval)
@@ -346,11 +348,11 @@ asmlinkage long sys_getpriority(int whic
case PRIO_PGRP:
if (!who)
who = process_group(current);
- do_each_task_pid(who, PIDTYPE_PGID, p) {
+ do_each_task_pid(pspace, who, PIDTYPE_PGID, p) {
niceval = 20 - task_nice(p);
if (niceval > retval)
retval = niceval;
- } while_each_task_pid(who, PIDTYPE_PGID, p);
+ } while_each_task_pid(pspace, who, PIDTYPE_PGID, p);
break;
case PRIO_USER:
user = current->user;
--
1.1.5.g3480
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-06 20:41    [W:0.121 / U:6.388 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site