From f093adcc36a4f6704ae7c5215c58fd23d48fef04 Mon Sep 17 00:00:00 2001 From: visa Date: Sun, 13 Feb 2022 13:05:51 +0000 Subject: [PATCH] Use knote_modify() and knote_process() in obvious places. --- sys/kern/kern_event.c | 18 +++--------------- sys/kern/sys_pipe.c | 12 +++--------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 64c6131090c..8e5911fc734 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.181 2022/02/13 12:58:46 visa Exp $ */ +/* $OpenBSD: kern_event.c,v 1.182 2022/02/13 13:05:51 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -737,10 +737,8 @@ filter_modify(struct kevent *kev, struct knote *kn) if (kn->kn_fop->f_modify != NULL) { active = kn->kn_fop->f_modify(kev, kn); } else { - /* Emulate f_modify using f_event. */ s = splhigh(); - knote_assign(kev, kn); - active = kn->kn_fop->f_event(kn, 0); + active = knote_modify(kev, kn); splx(s); } KERNEL_UNLOCK(); @@ -760,18 +758,8 @@ filter_process(struct knote *kn, struct kevent *kev) if (kn->kn_fop->f_process != NULL) { active = kn->kn_fop->f_process(kn, kev); } else { - /* Emulate f_process using f_event. */ s = splhigh(); - /* - * If called from kqueue_scan(), skip f_event - * when EV_ONESHOT is set, to preserve old behaviour. - */ - if (kev != NULL && (kn->kn_flags & EV_ONESHOT)) - active = 1; - else - active = kn->kn_fop->f_event(kn, 0); - if (active) - knote_submit(kn, kev); + active = knote_process(kn, kev); splx(s); } KERNEL_UNLOCK(); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index cf7912dbe12..5168916e405 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.135 2022/02/13 12:58:46 visa Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.136 2022/02/13 13:05:51 visa Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -1015,8 +1015,7 @@ filt_pipemodify(struct kevent *kev, struct knote *kn) int active; rw_enter_write(rpipe->pipe_lock); - knote_assign(kev, kn); - active = kn->kn_fop->f_event(kn, 0); + active = knote_modify(kev, kn); rw_exit_write(rpipe->pipe_lock); return (active); @@ -1029,12 +1028,7 @@ filt_pipeprocess(struct knote *kn, struct kevent *kev) int active; rw_enter_write(rpipe->pipe_lock); - if (kev != NULL && (kn->kn_flags & EV_ONESHOT)) - active = 1; - else - active = kn->kn_fop->f_event(kn, 0); - if (active) - knote_submit(kn, kev); + active = knote_process(kn, kev); rw_exit_write(rpipe->pipe_lock); return (active); -- 2.20.1