diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-01-12 04:47:02 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-01-12 04:47:02 +0000 |
commit | de9dd8527c35d730c294c117984ff69e78290635 (patch) | |
tree | 5ba29e8d0244ba581704af7abdffd2838890b884 | |
parent | 6b1f89400b6bd4ba02da281d3f265611541de814 (diff) |
klist_invalidate to help clean up when the backend disappears, tested by mpf@
-rw-r--r-- | sys/kern/kern_event.c | 13 | ||||
-rw-r--r-- | sys/sys/event.h | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 368bc6c79b6..caedf478e22 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.21 2003/09/23 16:51:12 millert Exp $ */ +/* $OpenBSD: kern_event.c,v 1.22 2004/01/12 04:47:01 tedu Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -924,3 +924,14 @@ knote_dequeue(struct knote *kn) kq->kq_count--; splx(s); } + +void +klist_invalidate(struct klist *list) +{ + struct knote *kn; + + SLIST_FOREACH(kn, list, kn_selnext) { + kn->kn_status |= KN_DETACHED; + kn->kn_flags |= EV_EOF | EV_ONESHOT; + } +} diff --git a/sys/sys/event.h b/sys/sys/event.h index 826332fd639..32416b711fb 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.8 2003/12/17 02:43:25 tedu Exp $ */ +/* $OpenBSD: event.h,v 1.9 2004/01/12 04:47:01 tedu Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -168,6 +168,7 @@ extern void knote_fdclose(struct proc *p, int fd); extern int kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p); extern int filt_seltrue(struct knote *kn, long hint); +extern void klist_invalidate(struct klist *); #else /* !_KERNEL */ |