summaryrefslogtreecommitdiffstats
path: root/sys/sys/event.h
diff options
context:
space:
mode:
authorssouhlal <ssouhlal@FreeBSD.org>2005-07-01 16:28:32 +0000
committerssouhlal <ssouhlal@FreeBSD.org>2005-07-01 16:28:32 +0000
commitefe31cd3da51660534ea5ec76bd1566fe89689d2 (patch)
treec6d52b2fecc4fcf947f2ca3718ee85b3a7aaeff0 /sys/sys/event.h
parent02c2d90f46ccecd39658689921e212d8dd15f796 (diff)
downloadFreeBSD-src-efe31cd3da51660534ea5ec76bd1566fe89689d2.zip
FreeBSD-src-efe31cd3da51660534ea5ec76bd1566fe89689d2.tar.gz
Fix the recent panics/LORs/hangs created by my kqueue commit by:
- Introducing the possibility of using locks different than mutexes for the knlist locking. In order to do this, we add three arguments to knlist_init() to specify the functions to use to lock, unlock and check if the lock is owned. If these arguments are NULL, we assume mtx_lock, mtx_unlock and mtx_owned, respectively. - Using the vnode lock for the knlist locking, when doing kqueue operations on a vnode. This way, we don't have to lock the vnode while holding a mutex, in filt_vfsread. Reviewed by: jmg Approved by: re (scottl), scottl (mentor override) Pointyhat to: ssouhlal Will be happy: everyone
Diffstat (limited to 'sys/sys/event.h')
-rw-r--r--sys/sys/event.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h
index 82764bc..c2921c4 100644
--- a/sys/sys/event.h
+++ b/sys/sys/event.h
@@ -126,8 +126,11 @@ SLIST_HEAD(klist, knote);
struct kqueue;
SLIST_HEAD(kqlist, kqueue);
struct knlist {
- struct mtx *kl_lock; /* lock to protect kll_list */
struct klist kl_list;
+ void (*kl_lock)(void *); /* lock function */
+ void (*kl_unlock)(void *);
+ int (*kl_locked)(void *);
+ void *kl_lockarg; /* argument passed to kl_lockf() */
};
@@ -209,7 +212,9 @@ extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked);
extern void knlist_remove_inevent(struct knlist *knl, struct knote *kn);
extern int knlist_empty(struct knlist *knl);
-extern void knlist_init(struct knlist *knl, struct mtx *mtx);
+extern void knlist_init(struct knlist *knl, void *lock,
+ void (*kl_lock)(void *), void (*kl_unlock)(void *),
+ int (*kl_locked)(void *));
extern void knlist_destroy(struct knlist *knl);
extern void knlist_cleardel(struct knlist *knl, struct thread *td,
int islocked, int killkn);
OpenPOWER on IntegriCloud