summaryrefslogtreecommitdiff
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2004-06-13 21:49:30 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2004-06-13 21:49:30 +0000
commit2dd254afa61a7c0cc5ae920b463d3d4266852804 (patch)
tree7adbebef3be24ba910fd83ee1ba09e1577ae21a8 /sys/kern/kern_resource.c
parent4d62e331dcde739b4067d712dd602c0927ce11b3 (diff)
debranch SMP, have fun
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 1e868518989..6d7af1fd136 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_resource.c,v 1.26 2003/12/11 23:02:30 millert Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.27 2004/06/13 21:49:26 niklas Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
@@ -44,6 +44,7 @@
#include <sys/resourcevar.h>
#include <sys/pool.h>
#include <sys/proc.h>
+#include <sys/sched.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
@@ -184,6 +185,7 @@ donice(curp, chgp, n)
register int n;
{
register struct pcred *pcred = curp->p_cred;
+ int s;
if (pcred->pc_ucred->cr_uid && pcred->p_ruid &&
pcred->pc_ucred->cr_uid != chgp->p_ucred->cr_uid &&
@@ -197,7 +199,9 @@ donice(curp, chgp, n)
if (n < chgp->p_nice && suser(curp, 0))
return (EACCES);
chgp->p_nice = n;
+ SCHED_LOCK(s);
(void)resetpriority(chgp);
+ SCHED_UNLOCK(s);
return (0);
}