mirror of
https://git.freebsd.org/src.git
synced 2026-01-17 07:11:54 +00:00
knotes: kqueue: handle copy for trivial filters
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D52045
This commit is contained in:
parent
7a72e88781
commit
3613896984
39 changed files with 77 additions and 9 deletions
|
|
@ -793,6 +793,7 @@ static const struct filterops ti_pruss_kq_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = ti_pruss_irq_kqread_detach,
|
||||
.f_event = ti_pruss_irq_kqevent,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -206,7 +206,8 @@ static struct cdevsw pass_cdevsw = {
|
|||
static const struct filterops passread_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = passreadfiltdetach,
|
||||
.f_event = passreadfilt
|
||||
.f_event = passreadfilt,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static MALLOC_DEFINE(M_SCSIPASS, "scsi_pass", "scsi passthrough buffers");
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ static const struct filterops targread_filtops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = targreadfiltdetach,
|
||||
.f_event = targreadfilt,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdevsw targ_cdevsw = {
|
||||
|
|
|
|||
|
|
@ -1171,12 +1171,14 @@ static const struct filterops linux_dev_kqfiltops_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = linux_file_kqfilter_detach,
|
||||
.f_event = linux_file_kqfilter_read_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops linux_dev_kqfiltops_write = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = linux_file_kqfilter_detach,
|
||||
.f_event = linux_file_kqfilter_write_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ static struct filterops zvol_filterops_vnode = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = zvol_filter_detach,
|
||||
.f_event = zvol_filter_vnode,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
extern uint_t zfs_geom_probe_vdev_key;
|
||||
|
|
|
|||
|
|
@ -5287,6 +5287,7 @@ static const struct filterops psmfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = psmfilter_detach,
|
||||
.f_event = psmfilter,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,8 @@ static int cyapafilt(struct knote *, long);
|
|||
static const struct filterops cyapa_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = cyapafiltdetach,
|
||||
.f_event = cyapafilt
|
||||
.f_event = cyapafilt,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ static const struct filterops evdev_cdev_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = evdev_kqdetach,
|
||||
.f_event = evdev_kqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ static const struct filterops uinput_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = uinput_kqdetach,
|
||||
.f_event = uinput_kqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
struct uinput_cdev_state
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ static const struct filterops gpioc_read_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = gpioc_kqdetach,
|
||||
.f_event = gpioc_kqread,
|
||||
.f_touch = NULL
|
||||
.f_touch = NULL,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct gpioc_pin_event *
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ static const struct filterops hidraw_filterops_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = hidraw_kqdetach,
|
||||
.f_event = hidraw_kqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ static struct filterops u2f_filterops_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = u2f_kqdetach,
|
||||
.f_event = u2f_kqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -61,12 +61,14 @@ static int zero_ev(struct knote *kn, long hint);
|
|||
|
||||
static const struct filterops one_fop = {
|
||||
.f_isfd = 1,
|
||||
.f_event = one_ev
|
||||
.f_event = one_ev,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops zero_fop = {
|
||||
.f_isfd = 1,
|
||||
.f_event = zero_ev
|
||||
.f_event = zero_ev,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdevsw full_cdevsw = {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ static struct filterops adf_state_read_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = adf_state_kqread_detach,
|
||||
.f_event = adf_state_kqread_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdev *adf_processes_dev;
|
||||
|
|
|
|||
|
|
@ -1231,12 +1231,14 @@ static const struct filterops usb_filtops_write = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = usb_filter_detach,
|
||||
.f_event = usb_filter_write,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops usb_filtops_read = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = usb_filter_detach,
|
||||
.f_event = usb_filter_read,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/* ARGSUSED */
|
||||
|
|
|
|||
|
|
@ -195,12 +195,14 @@ static const struct filterops cuse_client_kqfilter_read_ops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = cuse_client_kqfilter_read_detach,
|
||||
.f_event = cuse_client_kqfilter_read_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops cuse_client_kqfilter_write_ops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = cuse_client_kqfilter_write_detach,
|
||||
.f_event = cuse_client_kqfilter_write_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static d_open_t cuse_client_open;
|
||||
|
|
|
|||
|
|
@ -126,11 +126,13 @@ static const struct filterops fuse_device_rfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = fuse_device_filt_detach,
|
||||
.f_event = fuse_device_filt_read,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops fuse_device_wfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_event = fuse_device_filt_write,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/****************************
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ static const struct filterops gdev_filterops_vnode = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = gdev_filter_detach,
|
||||
.f_event = gdev_filter_vnode,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdevsw g_dev_cdevsw = {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ static const struct filterops devctl_rfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = filt_devctl_detach,
|
||||
.f_event = filt_devctl_read,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdev *devctl_dev;
|
||||
|
|
|
|||
|
|
@ -191,11 +191,13 @@ static void filt_usertouch(struct knote *kn, struct kevent *kev,
|
|||
static const struct filterops file_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_attach = filt_fileattach,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops kqread_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_kqdetach,
|
||||
.f_event = filt_kqueue,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
/* XXX - move to kern_proc.c? */
|
||||
static const struct filterops proc_filtops = {
|
||||
|
|
@ -203,12 +205,14 @@ static const struct filterops proc_filtops = {
|
|||
.f_attach = filt_procattach,
|
||||
.f_detach = filt_procdetach,
|
||||
.f_event = filt_proc,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops jail_filtops = {
|
||||
.f_isfd = 0,
|
||||
.f_attach = filt_jailattach,
|
||||
.f_detach = filt_jaildetach,
|
||||
.f_event = filt_jail,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops timer_filtops = {
|
||||
.f_isfd = 0,
|
||||
|
|
@ -223,6 +227,7 @@ static const struct filterops user_filtops = {
|
|||
.f_detach = filt_userdetach,
|
||||
.f_event = filt_user,
|
||||
.f_touch = filt_usertouch,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static uma_zone_t knote_zone;
|
||||
|
|
@ -352,6 +357,7 @@ filt_nullattach(struct knote *kn)
|
|||
static const struct filterops null_filtops = {
|
||||
.f_isfd = 0,
|
||||
.f_attach = filt_nullattach,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/* XXX - make SYSINIT to add these, and move into respective modules. */
|
||||
|
|
@ -3132,6 +3138,12 @@ kqueue_fork(struct filedesc *fdp, struct file *fp, struct file **fp1,
|
|||
return (kqueue_fork_copy(fdp, fp, *fp1, p1, td));
|
||||
}
|
||||
|
||||
int
|
||||
knote_triv_copy(struct knote *kn __unused, struct proc *p1 __unused)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct knote_status_export_bit {
|
||||
int kn_status_bit;
|
||||
int knt_status_bit;
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ static const struct filterops jaildesc_kqops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = jaildesc_kqops_detach,
|
||||
.f_event = jaildesc_kqops_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ const struct filterops sig_filtops = {
|
|||
.f_attach = filt_sigattach,
|
||||
.f_detach = filt_sigdetach,
|
||||
.f_event = filt_signal,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int kern_forcesigexit = 1;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ static const struct filterops log_read_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = logkqdetach,
|
||||
.f_event = logkqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct logsoftc {
|
||||
|
|
|
|||
|
|
@ -85,13 +85,16 @@ static int filt_eventfdwrite(struct knote *kn, long hint);
|
|||
static const struct filterops eventfd_rfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_eventfddetach,
|
||||
.f_event = filt_eventfdread
|
||||
.f_event = filt_eventfdread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
|
||||
static const struct filterops eventfd_wfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_eventfddetach,
|
||||
.f_event = filt_eventfdwrite
|
||||
.f_event = filt_eventfdwrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
struct eventfd {
|
||||
|
|
|
|||
|
|
@ -181,20 +181,23 @@ static int filt_pipedump(struct proc *p, struct knote *kn,
|
|||
static const struct filterops pipe_nfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_pipedetach_notsup,
|
||||
.f_event = filt_pipenotsup
|
||||
.f_event = filt_pipenotsup,
|
||||
/* no userdump */
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops pipe_rfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_pipedetach,
|
||||
.f_event = filt_piperead,
|
||||
.f_userdump = filt_pipedump,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops pipe_wfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_pipedetach,
|
||||
.f_event = filt_pipewrite,
|
||||
.f_userdump = filt_pipedump,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -486,6 +486,7 @@ static const struct filterops procdesc_kqops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = procdesc_kqops_detach,
|
||||
.f_event = procdesc_kqops_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -754,12 +754,14 @@ static const struct filterops tty_kqops_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = tty_kqops_read_detach,
|
||||
.f_event = tty_kqops_read_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops tty_kqops_write = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = tty_kqops_write_detach,
|
||||
.f_event = tty_kqops_write_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -491,11 +491,13 @@ static const struct filterops pts_kqops_read = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = pts_kqops_read_detach,
|
||||
.f_event = pts_kqops_read_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops pts_kqops_write = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = pts_kqops_write_detach,
|
||||
.f_event = pts_kqops_write_event,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -281,11 +281,13 @@ static const struct filterops mq_rfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = filt_mqdetach,
|
||||
.f_event = filt_mqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops mq_wfiltops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_mqdetach,
|
||||
.f_event = filt_mqwrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -191,16 +191,19 @@ static const struct filterops soread_filtops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = filt_sordetach,
|
||||
.f_event = filt_soread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops sowrite_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_sowdetach,
|
||||
.f_event = filt_sowrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops soempty_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_sowdetach,
|
||||
.f_event = filt_soempty,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
so_gen_t so_gencnt; /* generation count for sockets */
|
||||
|
|
|
|||
|
|
@ -1855,11 +1855,13 @@ static const struct filterops uipc_write_filtops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = uipc_filt_sowdetach,
|
||||
.f_event = uipc_filt_sowrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops uipc_empty_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = uipc_filt_sowdetach,
|
||||
.f_event = uipc_filt_soempty,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -345,12 +345,14 @@ static const struct filterops aio_filtops = {
|
|||
.f_attach = filt_aioattach,
|
||||
.f_detach = filt_aiodetach,
|
||||
.f_event = filt_aio,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
static const struct filterops lio_filtops = {
|
||||
.f_isfd = 0,
|
||||
.f_attach = filt_lioattach,
|
||||
.f_detach = filt_liodetach,
|
||||
.f_event = filt_lio
|
||||
.f_event = filt_lio,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static eventhandler_tag exit_tag, exec_tag;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ static const struct filterops inotify_rfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = filt_inotifydetach,
|
||||
.f_event = filt_inotifyevent,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static MALLOC_DEFINE(M_INOTIFY, "inotify", "inotify data structures");
|
||||
|
|
|
|||
|
|
@ -6545,6 +6545,7 @@ const struct filterops fs_filtops = {
|
|||
.f_attach = filt_fsattach,
|
||||
.f_detach = filt_fsdetach,
|
||||
.f_event = filt_fsevent,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -253,12 +253,14 @@ static const struct filterops bpfread_filtops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = filt_bpfdetach,
|
||||
.f_event = filt_bpfread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops bpfwrite_filtops = {
|
||||
.f_isfd = 1,
|
||||
.f_detach = filt_bpfdetach,
|
||||
.f_event = filt_bpfwrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ static const struct filterops tun_read_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = tunkqdetach,
|
||||
.f_event = tunkqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static const struct filterops tun_write_filterops = {
|
||||
|
|
@ -268,6 +269,7 @@ static const struct filterops tun_write_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = tunkqdetach,
|
||||
.f_event = tunkqwrite,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct tuntap_driver {
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ static const struct filterops audit_pipe_read_filterops = {
|
|||
.f_attach = NULL,
|
||||
.f_detach = audit_pipe_kqdetach,
|
||||
.f_event = audit_pipe_kqread,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ struct rwlock;
|
|||
|
||||
void knote(struct knlist *list, long hint, int lockflags);
|
||||
void knote_fork(struct knlist *list, int pid);
|
||||
int knote_triv_copy(struct knote *kn, struct proc *p1);
|
||||
struct knlist *knlist_alloc(struct mtx *lock);
|
||||
void knlist_detach(struct knlist *knl);
|
||||
void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ static const struct filterops apm_readfiltops = {
|
|||
.f_isfd = 1,
|
||||
.f_detach = apmreadfiltdetach,
|
||||
.f_event = apmreadfilt,
|
||||
.f_copy = knote_triv_copy,
|
||||
};
|
||||
|
||||
static struct cdevsw apm_cdevsw = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue