diff options
author | tjr <tjr@FreeBSD.org> | 2003-03-13 00:54:53 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-03-13 00:54:53 +0000 |
commit | a9d877b4c2853a9964b1070dc4d5a9fa6b86c417 (patch) | |
tree | d4dbe216f9c1b7217af90405ea4d130e644fa40d /sys/kern/kern_resource.c | |
parent | 9e54553707adc602a2998bbed6fc9d43c7875ca6 (diff) | |
download | FreeBSD-src-a9d877b4c2853a9964b1070dc4d5a9fa6b86c417.zip FreeBSD-src-a9d877b4c2853a9964b1070dc4d5a9fa6b86c417.tar.gz |
Back out previous. The locking here needs a rethink.
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 65bcfd4..5dfbfd7 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -98,21 +98,17 @@ getpriority(td, uap) switch (uap->which) { case PRIO_PROCESS: - if (uap->who == 0) { - mtx_lock_spin(&sched_lock); + if (uap->who == 0) low = td->td_ksegrp->kg_nice; - mtx_unlock_spin(&sched_lock); - } else { + else { p = pfind(uap->who); if (p == NULL) break; if (p_cansee(td, p) == 0) { - mtx_lock_spin(&sched_lock); FOREACH_KSEGRP_IN_PROC(p, kg) { if (kg->kg_nice < low) low = kg->kg_nice; } - mtx_unlock_spin(&sched_lock); } PROC_UNLOCK(p); } @@ -136,12 +132,10 @@ getpriority(td, uap) LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); if (!p_cansee(td, p)) { - mtx_lock_spin(&sched_lock); FOREACH_KSEGRP_IN_PROC(p, kg) { if (kg->kg_nice < low) low = kg->kg_nice; } - mtx_unlock_spin(&sched_lock); } PROC_UNLOCK(p); } @@ -157,12 +151,10 @@ getpriority(td, uap) PROC_LOCK(p); if (!p_cansee(td, p) && p->p_ucred->cr_uid == uap->who) { - mtx_lock_spin(&sched_lock); FOREACH_KSEGRP_IN_PROC(p, kg) { if (kg->kg_nice < low) low = kg->kg_nice; } - mtx_unlock_spin(&sched_lock); } PROC_UNLOCK(p); } @@ -297,19 +289,15 @@ donice(struct thread *td, struct proc *p, int n) * Only allow nicing if to more than the lowest nice. * e.g. nices of 4,3,2 allow nice to 3 but not 1 */ - mtx_lock_spin(&sched_lock); FOREACH_KSEGRP_IN_PROC(p, kg) { if (kg->kg_nice < low) low = kg->kg_nice; } - if (n < low && suser(td)) { - mtx_unlock_spin(&sched_lock); + if (n < low && suser(td)) return (EACCES); - } FOREACH_KSEGRP_IN_PROC(p, kg) { sched_nice(kg, n); } - mtx_unlock_spin(&sched_lock); return (0); } |