Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern if donice fails, don't keep going with the next pro...
details: https://anonhg.NetBSD.org/src/rev/9ffc729a013a
branches: trunk
changeset: 764691:9ffc729a013a
user: christos <christos%NetBSD.org@localhost>
date: Sun May 01 02:46:19 2011 +0000
description:
if donice fails, don't keep going with the next process.
diffstat:
sys/kern/kern_resource.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (67 lines):
diff -r 7700a41a02d6 -r 9ffc729a013a sys/kern/kern_resource.c
--- a/sys/kern/kern_resource.c Sun May 01 02:08:15 2011 +0000
+++ b/sys/kern/kern_resource.c Sun May 01 02:46:19 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_resource.c,v 1.161 2011/05/01 01:15:18 rmind Exp $ */
+/* $NetBSD: kern_resource.c,v 1.162 2011/05/01 02:46:19 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.161 2011/05/01 01:15:18 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.162 2011/05/01 02:46:19 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -233,9 +233,9 @@
p = who ? proc_find(who) : curp;
if (p != NULL) {
mutex_enter(p->p_lock);
+ found++;
error = donice(l, p, SCARG(uap, prio));
mutex_exit(p->p_lock);
- found++;
}
break;
@@ -248,9 +248,11 @@
break;
LIST_FOREACH(p, &pg->pg_members, p_pglist) {
mutex_enter(p->p_lock);
+ found++;
error = donice(l, p, SCARG(uap, prio));
mutex_exit(p->p_lock);
- found++;
+ if (error)
+ break;
}
break;
}
@@ -262,10 +264,12 @@
mutex_enter(p->p_lock);
if (kauth_cred_geteuid(p->p_cred) ==
(uid_t)SCARG(uap, who)) {
+ found++;
error = donice(l, p, SCARG(uap, prio));
- found++;
}
mutex_exit(p->p_lock);
+ if (error)
+ break;
}
break;
@@ -275,8 +279,8 @@
}
mutex_exit(proc_lock);
if (found == 0)
- return (ESRCH);
- return (error);
+ return ESRCH;
+ return error;
}
/*
Home |
Main Index |
Thread Index |
Old Index