From f132072368c112104e35151ee7a1c30a1b74a107 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Wed, 1 May 2002 20:44:46 +0000 Subject: Redo the sigio locking. Turn the sigio sx into a mutex. Sigio lock is really only needed to protect interrupts from dereferencing the sigio pointer in an object when the sigio itself is being destroyed. In order to do this in the most unintrusive manner change pgsigio's sigio * argument into a **, that way we can lock internally to the function. --- sys/kern/kern_descrip.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'sys/kern/kern_descrip.c') diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 13b91adecf79..425cb3947152 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -63,6 +63,7 @@ #include #include #include +#include #include @@ -113,7 +114,7 @@ struct filelist filehead; /* head of list of open files */ int nfiles; /* actual number of open files */ extern int cmask; struct sx filelist_lock; /* sx to protect filelist */ -struct sx sigio_lock; /* sx to protect pointers to sigio */ +struct mtx sigio_lock; /* mtx to protect pointers to sigio */ /* * System calls on descriptors. @@ -536,14 +537,14 @@ void funsetown(sigio) struct sigio *sigio; { - int s; - if (sigio == NULL) + SIGIO_LOCK(); + if (sigio == NULL) { + SIGIO_UNLOCK(); return; - - s = splhigh(); + } *(sigio->sio_myref) = NULL; - splx(s); + SIGIO_UNLOCK(); if ((sigio)->sio_pgid < 0) { struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); @@ -566,7 +567,6 @@ void funsetownlst(sigiolst) struct sigiolst *sigiolst; { - int s; struct sigio *sigio; struct proc *p; struct pgrp *pg; @@ -591,9 +591,9 @@ funsetownlst(sigiolst) } while ((sigio = SLIST_FIRST(sigiolst)) != NULL) { - s = splhigh(); + SIGIO_LOCK(); *(sigio->sio_myref) = NULL; - splx(s); + SIGIO_UNLOCK(); if (pg != NULL) { KASSERT(sigio->sio_pgid < 0, ("Proc sigio in pgrp sigio list")); KASSERT(sigio->sio_pgrp == pg, ("Bogus pgrp in sigio list")); @@ -632,7 +632,7 @@ fsetown(pgid, sigiop) struct proc *proc; struct pgrp *pgrp; struct sigio *sigio; - int s, ret; + int ret; if (pgid == 0) { funsetown(*sigiop); @@ -706,9 +706,9 @@ fsetown(pgid, sigiop) PGRP_UNLOCK(pgrp); } sx_sunlock(&proctree_lock); - s = splhigh(); + SIGIO_LOCK(); *sigiop = sigio; - splx(s); + SIGIO_UNLOCK(); return (0); fail: @@ -2187,5 +2187,5 @@ filelistinit(dummy) NULL, NULL, UMA_ALIGN_PTR, 0); sx_init(&filelist_lock, "filelist lock"); - sx_init(&sigio_lock, "sigio lock"); + mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); } -- cgit v1.2.3