-/* $OpenBSD: kern_event.c,v 1.191 2022/06/27 13:35:21 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.192 2022/07/09 12:48:21 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/fcntl.h>
-#include <sys/selinfo.h>
#include <sys/queue.h>
#include <sys/event.h>
#include <sys/eventvar.h>
free(kq->kq_knlist, M_KEVENT, kq->kq_knlistsize *
sizeof(struct knlist));
hashfree(kq->kq_knhash, KN_HASHSIZE, M_KEVENT);
- klist_free(&kq->kq_sel.si_note);
+ klist_free(&kq->kq_klist);
pool_put(&kqueue_pool, kq);
}
return (EINVAL);
kn->kn_fop = &kqread_filtops;
- klist_insert(&kq->kq_sel.si_note, kn);
+ klist_insert(&kq->kq_klist, kn);
return (0);
}
{
struct kqueue *kq = kn->kn_fp->f_data;
- klist_remove(&kq->kq_sel.si_note, kn);
+ klist_remove(&kq->kq_klist, kn);
}
int
TAILQ_INIT(&kq->kq_head);
mtx_init(&kq->kq_lock, IPL_HIGH);
task_set(&kq->kq_task, kqueue_task, kq);
- klist_init_mutex(&kq->kq_sel.si_note, &kqueue_klist_lock);
+ klist_init_mutex(&kq->kq_klist, &kqueue_klist_lock);
return (kq);
}
* Any knotes that were attached to this kqueue were deleted
* by knote_fdclose() when this kqueue's file descriptor was closed.
*/
- KASSERT(klist_empty(&kq->kq_sel.si_note));
+ KASSERT(klist_empty(&kq->kq_klist));
if (state & KQ_TASK)
taskq_del_barrier(systqmp, &kq->kq_task);
}
struct kqueue *kq = arg;
mtx_enter(&kqueue_klist_lock);
- KNOTE(&kq->kq_sel.si_note, 0);
+ KNOTE(&kq->kq_klist, 0);
mtx_leave(&kqueue_klist_lock);
}
kq->kq_state &= ~KQ_SLEEP;
wakeup(kq);
}
- if (!klist_empty(&kq->kq_sel.si_note)) {
+ if (!klist_empty(&kq->kq_klist)) {
/* Defer activation to avoid recursion. */
kq->kq_state |= KQ_TASK;
task_add(systqmp, &kq->kq_task);
-/* $OpenBSD: sys_pipe.c,v 1.140 2022/06/20 01:39:44 visa Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.141 2022/07/09 12:48:21 visa Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
{
rw_assert_wrlock(cpipe->pipe_lock);
- KNOTE(&cpipe->pipe_sel.si_note, 0);
+ KNOTE(&cpipe->pipe_klist, 0);
if (cpipe->pipe_state & PIPE_ASYNC)
pgsigio(&cpipe->pipe_sigio, SIGIO, 0);
case EVFILT_READ:
kn->kn_fop = &pipe_rfiltops;
kn->kn_hook = rpipe;
- klist_insert_locked(&rpipe->pipe_sel.si_note, kn);
+ klist_insert_locked(&rpipe->pipe_klist, kn);
break;
case EVFILT_WRITE:
if (wpipe == NULL) {
}
kn->kn_fop = &pipe_wfiltops;
kn->kn_hook = wpipe;
- klist_insert_locked(&wpipe->pipe_sel.si_note, kn);
+ klist_insert_locked(&wpipe->pipe_klist, kn);
break;
case EVFILT_EXCEPT:
if (kn->kn_flags & __EV_SELECT) {
}
kn->kn_fop = &pipe_efiltops;
kn->kn_hook = rpipe;
- klist_insert_locked(&rpipe->pipe_sel.si_note, kn);
+ klist_insert_locked(&rpipe->pipe_klist, kn);
break;
default:
error = EINVAL;
{
struct pipe *cpipe = kn->kn_hook;
- klist_remove(&cpipe->pipe_sel.si_note, kn);
+ klist_remove(&cpipe->pipe_klist, kn);
}
int
pp->pp_wpipe.pipe_lock = &pp->pp_lock;
pp->pp_rpipe.pipe_lock = &pp->pp_lock;
- klist_init_rwlock(&pp->pp_wpipe.pipe_sel.si_note, &pp->pp_lock);
- klist_init_rwlock(&pp->pp_rpipe.pipe_sel.si_note, &pp->pp_lock);
+ klist_init_rwlock(&pp->pp_wpipe.pipe_klist, &pp->pp_lock);
+ klist_init_rwlock(&pp->pp_rpipe.pipe_klist, &pp->pp_lock);
if (pipe_create(&pp->pp_wpipe) || pipe_create(&pp->pp_rpipe))
goto err;
void
pipe_pair_destroy(struct pipe_pair *pp)
{
- klist_free(&pp->pp_wpipe.pipe_sel.si_note);
- klist_free(&pp->pp_rpipe.pipe_sel.si_note);
+ klist_free(&pp->pp_wpipe.pipe_klist);
+ klist_free(&pp->pp_rpipe.pipe_klist);
pool_put(&pipe_pair_pool, pp);
}
-/* $OpenBSD: bpf.c,v 1.218 2022/07/05 15:06:16 visa Exp $ */
+/* $OpenBSD: bpf.c,v 1.219 2022/07/09 12:48:21 visa Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
#include <sys/sysctl.h>
#include <sys/rwlock.h>
#include <sys/atomic.h>
+#include <sys/event.h>
+#include <sys/mutex.h>
#include <sys/refcnt.h>
#include <sys/smr.h>
#include <sys/specdev.h>
-#include <sys/selinfo.h>
#include <sys/sigio.h>
#include <sys/task.h>
#include <sys/time.h>
task_set(&bd->bd_wake_task, bpf_wakeup_cb, bd);
smr_init(&bd->bd_smr);
sigio_init(&bd->bd_sigio);
- klist_init_mutex(&bd->bd_sel.si_note, &bd->bd_mtx);
+ klist_init_mutex(&bd->bd_klist, &bd->bd_mtx);
bd->bd_rtout = 0; /* no timeout by default */
if (d->bd_nreaders)
wakeup(d);
- KNOTE(&d->bd_sel.si_note, 0);
+ KNOTE(&d->bd_klist, 0);
/*
* As long as pgsigio() needs to be protected
switch (kn->kn_filter) {
case EVFILT_READ:
- klist = &d->bd_sel.si_note;
+ klist = &d->bd_klist;
kn->kn_fop = &bpfread_filtops;
break;
default:
{
struct bpf_d *d = kn->kn_hook;
- klist_remove(&d->bd_sel.si_note, kn);
+ klist_remove(&d->bd_klist, kn);
bpf_put(d);
}
if (bd->bd_wfilter != NULL)
bpf_prog_smr(bd->bd_wfilter);
- klist_free(&bd->bd_sel.si_note);
+ klist_free(&bd->bd_klist);
free(bd, M_DEVBUF, sizeof(*bd));
}
while ((bd = SMR_SLIST_FIRST_LOCKED(&bp->bif_dlist))) {
vdevgone(maj, bd->bd_unit, bd->bd_unit, VCHR);
- klist_invalidate(&bd->bd_sel.si_note);
+ klist_invalidate(&bd->bd_klist);
}
for (tbp = bpf_iflist; tbp; tbp = tbp->bif_next) {
-/* $OpenBSD: bpfdesc.h,v 1.46 2022/03/17 14:22:03 visa Exp $ */
+/* $OpenBSD: bpfdesc.h,v 1.47 2022/07/09 12:48:21 visa Exp $ */
/* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */
/*
struct sigio_ref
bd_sigio; /* async I/O registration */
struct refcnt bd_refcnt; /* reference count */
- struct selinfo bd_sel; /* bsd select info */
+ struct klist bd_klist; /* list of knotes */
int bd_unit; /* logical unit number */
LIST_ENTRY(bpf_d) bd_list; /* descriptor list */
-/* $OpenBSD: eventvar.h,v 1.16 2022/06/27 13:35:21 visa Exp $ */
+/* $OpenBSD: eventvar.h,v 1.17 2022/07/09 12:48:21 visa Exp $ */
/*-
* Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>
/*
* Locking:
* I immutable after creation
+ * L kqueue_klist_lock
* a atomic operations
* q kq_lock
*/
TAILQ_HEAD(, knote) kq_head; /* [q] list of pending event */
int kq_count; /* [q] # of pending events */
struct refcnt kq_refcnt; /* [a] # of references */
- struct selinfo kq_sel;
+ struct klist kq_klist; /* [L] knotes of other kqs */
struct filedesc *kq_fdp; /* [I] fd table of this kq */
LIST_ENTRY(kqueue) kq_next;
-/* $OpenBSD: pipe.h,v 1.28 2022/06/20 01:39:44 visa Exp $ */
+/* $OpenBSD: pipe.h,v 1.29 2022/07/09 12:48:21 visa Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
#ifndef _KERNEL
#include <sys/time.h> /* for struct timespec */
-#include <sys/selinfo.h> /* for struct selinfo */
#endif /* _KERNEL */
+#include <sys/event.h> /* for struct klist */
#include <sys/sigio.h> /* for struct sigio_ref */
/*
struct pipe {
struct rwlock *pipe_lock;
struct pipebuf pipe_buffer; /* [p] data storage */
- struct selinfo pipe_sel; /* [p] for compat with select */
+ struct klist pipe_klist; /* [p] list of knotes */
struct timespec pipe_atime; /* [p] time of last access */
struct timespec pipe_mtime; /* [p] time of last modify */
struct timespec pipe_ctime; /* [I] time of status change */