aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2002-05-01 20:44:46 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2002-05-01 20:44:46 +0000
commitf132072368c112104e35151ee7a1c30a1b74a107 (patch)
tree47fe7acf6ad89bf88d96ff3e57b5a8e31207cbf6 /sys/kern/kern_descrip.c
parent3498b5ed098ffe6c6bc8e1679da55335a40e055d (diff)
downloadsrc-f132072368c112104e35151ee7a1c30a1b74a107.tar.gz
src-f132072368c112104e35151ee7a1c30a1b74a107.zip
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.
Notes
Notes: svn path=/head/; revision=95883
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c26
1 files changed, 13 insertions, 13 deletions
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 <sys/event.h>
#include <sys/sx.h>
#include <sys/socketvar.h>
+#include <sys/signalvar.h>
#include <machine/limits.h>
@@ -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);
}