version 1.134, 2021/10/21 01:11:21 |
version 1.135, 2021/10/21 02:34:03 |
Line 116 static int filt_timer(struct knote *, lo |
|
Line 116 static int filt_timer(struct knote *, lo |
|
static int filt_userattach(struct knote *); |
static int filt_userattach(struct knote *); |
static void filt_userdetach(struct knote *); |
static void filt_userdetach(struct knote *); |
static int filt_user(struct knote *, long hint); |
static int filt_user(struct knote *, long hint); |
static void filt_usertouch(struct knote *, struct kevent *, long type); |
static int filt_usertouch(struct knote *, struct kevent *, long type); |
|
|
static const struct fileops kqueueops = { |
static const struct fileops kqueueops = { |
.fo_name = "kqueue", |
.fo_name = "kqueue", |
Line 476 filter_event(struct knote *kn, long hint |
|
Line 476 filter_event(struct knote *kn, long hint |
|
return rv; |
return rv; |
} |
} |
|
|
static void |
static int |
filter_touch(struct knote *kn, struct kevent *kev, long type) |
filter_touch(struct knote *kn, struct kevent *kev, long type) |
{ |
{ |
kn->kn_fop->f_touch(kn, kev, type); |
return kn->kn_fop->f_touch(kn, kev, type); |
} |
} |
|
|
static kauth_listener_t kqueue_listener; |
static kauth_listener_t kqueue_listener; |
Line 1384 filt_user(struct knote *kn, long hint) |
|
Line 1384 filt_user(struct knote *kn, long hint) |
|
return hookid; |
return hookid; |
} |
} |
|
|
static void |
static int |
filt_usertouch(struct knote *kn, struct kevent *kev, long type) |
filt_usertouch(struct knote *kn, struct kevent *kev, long type) |
{ |
{ |
int ffctrl; |
int ffctrl; |
Line 1441 filt_usertouch(struct knote *kn, struct |
|
Line 1441 filt_usertouch(struct knote *kn, struct |
|
panic("filt_usertouch() - invalid type (%ld)", type); |
panic("filt_usertouch() - invalid type (%ld)", type); |
break; |
break; |
} |
} |
|
|
|
return 0; |
} |
} |
|
|
/* |
/* |
Line 1874 kqueue_register(struct kqueue *kq, struc |
|
Line 1876 kqueue_register(struct kqueue *kq, struc |
|
if (!(kn->kn_fop->f_flags & FILTEROP_ISFD) && |
if (!(kn->kn_fop->f_flags & FILTEROP_ISFD) && |
kn->kn_fop->f_touch != NULL) { |
kn->kn_fop->f_touch != NULL) { |
mutex_spin_enter(&kq->kq_lock); |
mutex_spin_enter(&kq->kq_lock); |
filter_touch(kn, kev, EVENT_REGISTER); |
error = filter_touch(kn, kev, EVENT_REGISTER); |
mutex_spin_exit(&kq->kq_lock); |
mutex_spin_exit(&kq->kq_lock); |
|
if (__predict_false(error != 0)) { |
|
/* Never a new knote (which would consume newkn). */ |
|
KASSERT(newkn != NULL); |
|
goto doneunlock; |
|
} |
} else { |
} else { |
kn->kn_sfflags = kev->fflags; |
kn->kn_sfflags = kev->fflags; |
kn->kn_sdata = kev->data; |
kn->kn_sdata = kev->data; |
Line 1887 kqueue_register(struct kqueue *kq, struc |
|
Line 1894 kqueue_register(struct kqueue *kq, struc |
|
* support events, and the attach routine is |
* support events, and the attach routine is |
* broken and does not return an error. |
* broken and does not return an error. |
*/ |
*/ |
done_ev_add: |
done_ev_add: |
rv = filter_event(kn, 0); |
rv = filter_event(kn, 0); |
if (rv) |
if (rv) |
knote_activate(kn); |
knote_activate(kn); |
|
|
if ((kev->flags & EV_ENABLE)) { |
if ((kev->flags & EV_ENABLE)) { |
knote_enqueue(kn); |
knote_enqueue(kn); |
} |
} |
doneunlock: |
doneunlock: |
mutex_exit(&fdp->fd_lock); |
mutex_exit(&fdp->fd_lock); |
done: |
done: |
rw_exit(&kqueue_filter_lock); |
rw_exit(&kqueue_filter_lock); |
|
|
kn->kn_fop->f_touch != NULL); |
kn->kn_fop->f_touch != NULL); |
/* XXXAD should be got from f_event if !oneshot. */ |
/* XXXAD should be got from f_event if !oneshot. */ |
if (touch) { |
if (touch) { |
filter_touch(kn, kevp, EVENT_PROCESS); |
(void)filter_touch(kn, kevp, EVENT_PROCESS); |
} else { |
} else { |
*kevp = kn->kn_kevent; |
*kevp = kn->kn_kevent; |
} |
} |