summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-04-27 08:24:29 +0000
committertanimura <tanimura@FreeBSD.org>2002-04-27 08:24:29 +0000
commitdbb4756491715a06ce4578841f6eba43fc62fa70 (patch)
tree982f8e96f9de9e219deaa4ea138a8334dc086c3c /sys/kern/kern_descrip.c
parentbcaaa89ad095d7a175927dd7e531fa6f278ed18e (diff)
downloadFreeBSD-src-dbb4756491715a06ce4578841f6eba43fc62fa70.zip
FreeBSD-src-dbb4756491715a06ce4578841f6eba43fc62fa70.tar.gz
Add a global sx sigio_lock to protect the pointer to the sigio object
of a socket. This avoids lock order reversal caused by locking a process in pgsigio(). sowakeup() and the callers of it (sowwakeup, soisconnected, etc.) now require sigio_lock to be locked. Provide sowwakeup_locked(), soisconnected_locked(), and so on in case where we have to modify a socket and wake up a process atomically.
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 65f85d5..c645a56 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -113,6 +113,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 */
/*
* System calls on descriptors.
@@ -2186,4 +2187,5 @@ filelistinit(dummy)
NULL, NULL, UMA_ALIGN_PTR, 0);
sx_init(&filelist_lock, "filelist lock");
+ sx_init(&sigio_lock, "sigio lock");
}
OpenPOWER on IntegriCloud