summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lockf.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
committerjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
commit5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch)
treeb1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/kern/kern_lockf.c
parent83e00d4274950d2b531c24692cd123538ffbddb9 (diff)
downloadFreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip
FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/kern/kern_lockf.c')
-rw-r--r--sys/kern/kern_lockf.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c
index c60705f..3bbb4d0 100644
--- a/sys/kern/kern_lockf.c
+++ b/sys/kern/kern_lockf.c
@@ -242,25 +242,29 @@ lf_setlock(lock)
if ((lock->lf_flags & F_POSIX) &&
(block->lf_flags & F_POSIX)) {
register struct proc *wproc;
+ struct thread *td;
register struct lockf *waitblock;
int i = 0;
/* The block is waiting on something */
+ /* XXXKSE this is not complete under threads */
wproc = (struct proc *)block->lf_id;
mtx_lock_spin(&sched_lock);
- while (wproc->p_wchan &&
- (wproc->p_wmesg == lockstr) &&
- (i++ < maxlockdepth)) {
- waitblock = (struct lockf *)wproc->p_wchan;
- /* Get the owner of the blocking lock */
- waitblock = waitblock->lf_next;
- if ((waitblock->lf_flags & F_POSIX) == 0)
- break;
- wproc = (struct proc *)waitblock->lf_id;
- if (wproc == (struct proc *)lock->lf_id) {
- mtx_unlock_spin(&sched_lock);
- free(lock, M_LOCKF);
- return (EDEADLK);
+ FOREACH_THREAD_IN_PROC(wproc, td) {
+ while (td->td_wchan &&
+ (td->td_wmesg == lockstr) &&
+ (i++ < maxlockdepth)) {
+ waitblock = (struct lockf *)td->td_wchan;
+ /* Get the owner of the blocking lock */
+ waitblock = waitblock->lf_next;
+ if ((waitblock->lf_flags & F_POSIX) == 0)
+ break;
+ wproc = (struct proc *)waitblock->lf_id;
+ if (wproc == (struct proc *)lock->lf_id) {
+ mtx_unlock_spin(&sched_lock);
+ free(lock, M_LOCKF);
+ return (EDEADLK);
+ }
}
}
mtx_unlock_spin(&sched_lock);
OpenPOWER on IntegriCloud