Remove unused struct fileops field fo_poll and callbacks.

(After this, VOP_POLL() is next in line for removal.)

OK?

Index: sys/dev/pci/drm/drm_linux.c
===================================================================
RCS file: src/sys/dev/pci/drm/drm_linux.c,v
retrieving revision 1.92
diff -u -p -r1.92 drm_linux.c
--- sys/dev/pci/drm/drm_linux.c 1 Mar 2022 11:50:37 -0000       1.92
+++ sys/dev/pci/drm/drm_linux.c 7 May 2022 10:57:52 -0000
@@ -2261,12 +2261,6 @@ dmabuf_ioctl(struct file *fp, u_long com
 }
 
 int
-dmabuf_poll(struct file *fp, int events, struct proc *p)
-{
-       return (0);
-}
-
-int
 dmabuf_kqfilter(struct file *fp, struct knote *kn)
 {
        return (EINVAL);
@@ -2326,7 +2320,6 @@ const struct fileops dmabufops = {
        .fo_read        = dmabuf_read,
        .fo_write       = dmabuf_write,
        .fo_ioctl       = dmabuf_ioctl,
-       .fo_poll        = dmabuf_poll,
        .fo_kqfilter    = dmabuf_kqfilter,
        .fo_stat        = dmabuf_stat,
        .fo_close       = dmabuf_close,
@@ -2849,12 +2842,6 @@ syncfile_ioctl(struct file *fp, u_long c
 }
 
 int
-syncfile_poll(struct file *fp, int events, struct proc *p)
-{
-       return 0;
-}
-
-int
 syncfile_kqfilter(struct file *fp, struct knote *kn)
 {
        return EINVAL;
@@ -2908,7 +2895,6 @@ const struct fileops syncfileops = {
        .fo_read        = syncfile_read,
        .fo_write       = syncfile_write,
        .fo_ioctl       = syncfile_ioctl,
-       .fo_poll        = syncfile_poll,
        .fo_kqfilter    = syncfile_kqfilter,
        .fo_stat        = syncfile_stat,
        .fo_close       = syncfile_close,
Index: sys/kern/kern_event.c
===================================================================
RCS file: src/sys/kern/kern_event.c,v
retrieving revision 1.187
diff -u -p -r1.187 kern_event.c
--- sys/kern/kern_event.c       6 May 2022 13:12:16 -0000       1.187
+++ sys/kern/kern_event.c       7 May 2022 10:57:53 -0000
@@ -49,7 +50,6 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 #include <sys/mount.h>
-#include <sys/poll.h>
 #include <sys/syscallargs.h>
 #include <sys/time.h>
 #include <sys/timeout.h>
@@ -79,7 +79,6 @@ int   kqueue_read(struct file *, struct ui
 int    kqueue_write(struct file *, struct uio *, int);
 int    kqueue_ioctl(struct file *fp, u_long com, caddr_t data,
                    struct proc *p);
-int    kqueue_poll(struct file *fp, int events, struct proc *p);
 int    kqueue_kqfilter(struct file *fp, struct knote *kn);
 int    kqueue_stat(struct file *fp, struct stat *st, struct proc *p);
 int    kqueue_close(struct file *fp, struct proc *p);
@@ -107,7 +106,6 @@ const struct fileops kqueueops = {
        .fo_read        = kqueue_read,
        .fo_write       = kqueue_write,
        .fo_ioctl       = kqueue_ioctl,
-       .fo_poll        = kqueue_poll,
        .fo_kqfilter    = kqueue_kqfilter,
        .fo_stat        = kqueue_stat,
        .fo_close       = kqueue_close
@@ -1526,25 +1623,6 @@ kqueue_ioctl(struct file *fp, u_long com
 }
 
 int
-kqueue_poll(struct file *fp, int events, struct proc *p)
-{
-       struct kqueue *kq = (struct kqueue *)fp->f_data;
-       int revents = 0;
-
-       if (events & (POLLIN | POLLRDNORM)) {
-               mtx_enter(&kq->kq_lock);
-               if (kq->kq_count) {
-                       revents |= events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(p, &kq->kq_sel);
-                       kq->kq_state |= KQ_SEL;
-               }
-               mtx_leave(&kq->kq_lock);
-       }
-       return (revents);
-}
-
-int
 kqueue_stat(struct file *fp, struct stat *st, struct proc *p)
 {
        struct kqueue *kq = fp->f_data;
Index: sys/kern/sys_pipe.c
===================================================================
RCS file: src/sys/kern/sys_pipe.c,v
retrieving revision 1.137
diff -u -p -r1.137 sys_pipe.c
--- sys/kern/sys_pipe.c 6 May 2022 13:09:41 -0000       1.137
+++ sys/kern/sys_pipe.c 7 May 2022 10:57:53 -0000
@@ -40,7 +40,6 @@
 #include <sys/syscallargs.h>
 #include <sys/event.h>
 #include <sys/lock.h>
-#include <sys/poll.h>
 #ifdef KTRACE
 #include <sys/ktrace.h>
 #endif
@@ -61,7 +60,6 @@ struct pipe_pair {
 int    pipe_read(struct file *, struct uio *, int);
 int    pipe_write(struct file *, struct uio *, int);
 int    pipe_close(struct file *, struct proc *);
-int    pipe_poll(struct file *, int events, struct proc *);
 int    pipe_kqfilter(struct file *fp, struct knote *kn);
 int    pipe_ioctl(struct file *, u_long, caddr_t, struct proc *);
 int    pipe_stat(struct file *fp, struct stat *ub, struct proc *p);
@@ -70,7 +68,6 @@ static const struct fileops pipeops = {
        .fo_read        = pipe_read,
        .fo_write       = pipe_write,
        .fo_ioctl       = pipe_ioctl,
-       .fo_poll        = pipe_poll,
        .fo_kqfilter    = pipe_kqfilter,
        .fo_stat        = pipe_stat,
        .fo_close       = pipe_close
@@ -719,46 +716,6 @@ pipe_ioctl(struct file *fp, u_long cmd, 
 }
 
 int
-pipe_poll(struct file *fp, int events, struct proc *p)
-{
-       struct pipe *rpipe = fp->f_data, *wpipe;
-       struct rwlock *lock = rpipe->pipe_lock;
-       int revents = 0;
-
-       rw_enter_write(lock);
-       wpipe = pipe_peer(rpipe);
-
-       if (events & (POLLIN | POLLRDNORM)) {
-               if (rpipe->pipe_buffer.cnt > 0 ||
-                   (rpipe->pipe_state & PIPE_EOF))
-                       revents |= events & (POLLIN | POLLRDNORM);
-       }
-
-       /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */
-       if ((rpipe->pipe_state & PIPE_EOF) || wpipe == NULL)
-               revents |= POLLHUP;
-       else if (events & (POLLOUT | POLLWRNORM)) {
-               if (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt >= 
PIPE_BUF)
-                       revents |= events & (POLLOUT | POLLWRNORM);
-       }
-
-       if (revents == 0) {
-               if (events & (POLLIN | POLLRDNORM)) {
-                       selrecord(p, &rpipe->pipe_sel);
-                       rpipe->pipe_state |= PIPE_SEL;
-               }
-               if (events & (POLLOUT | POLLWRNORM)) {
-                       selrecord(p, &wpipe->pipe_sel);
-                       wpipe->pipe_state |= PIPE_SEL;
-               }
-       }
-
-       rw_exit_write(lock);
-
-       return (revents);
-}
-
-int
 pipe_stat(struct file *fp, struct stat *ub, struct proc *p)
 {
        struct pipe *pipe = fp->f_data;
Index: sys/kern/sys_socket.c
===================================================================
RCS file: src/sys/kern/sys_socket.c,v
retrieving revision 1.49
diff -u -p -r1.49 sys_socket.c
--- sys/kern/sys_socket.c       25 Feb 2022 23:51:03 -0000      1.49
+++ sys/kern/sys_socket.c       7 May 2022 10:57:53 -0000
@@ -41,7 +41,6 @@
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/ioctl.h>
-#include <sys/poll.h>
 #include <sys/stat.h>
 #include <sys/fcntl.h>
 
@@ -52,7 +51,6 @@ const struct fileops socketops = {
        .fo_read        = soo_read,
        .fo_write       = soo_write,
        .fo_ioctl       = soo_ioctl,
-       .fo_poll        = soo_poll,
        .fo_kqfilter    = soo_kqfilter,
        .fo_stat        = soo_stat,
        .fo_close       = soo_close
@@ -150,43 +148,6 @@ soo_ioctl(struct file *fp, u_long cmd, c
 }
 
 int
-soo_poll(struct file *fp, int events, struct proc *p)
-{
-       struct socket *so = fp->f_data;
-       int revents = 0;
-       int s;
-
-       s = solock(so);
-       if (events & (POLLIN | POLLRDNORM)) {
-               if (soreadable(so))
-                       revents |= events & (POLLIN | POLLRDNORM);
-       }
-       /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */
-       if (so->so_state & SS_ISDISCONNECTED) {
-               revents |= POLLHUP;
-       } else if (events & (POLLOUT | POLLWRNORM)) {
-               if (sowriteable(so))
-                       revents |= events & (POLLOUT | POLLWRNORM);
-       }
-       if (events & (POLLPRI | POLLRDBAND)) {
-               if (so->so_oobmark || (so->so_state & SS_RCVATMARK))
-                       revents |= events & (POLLPRI | POLLRDBAND);
-       }
-       if (revents == 0) {
-               if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
-                       selrecord(p, &so->so_rcv.sb_sel);
-                       so->so_rcv.sb_flags |= SB_SEL;
-               }
-               if (events & (POLLOUT | POLLWRNORM)) {
-                       selrecord(p, &so->so_snd.sb_sel);
-                       so->so_snd.sb_flags |= SB_SEL;
-               }
-       }
-       sounlock(so, s);
-       return (revents);
-}
-
-int
 soo_stat(struct file *fp, struct stat *ub, struct proc *p)
 {
        struct socket *so = fp->f_data;
Index: sys/kern/vfs_vnops.c
===================================================================
RCS file: src/sys/kern/vfs_vnops.c,v
retrieving revision 1.119
diff -u -p -r1.119 vfs_vnops.c
--- sys/kern/vfs_vnops.c        13 Nov 2021 06:04:02 -0000      1.119
+++ sys/kern/vfs_vnops.c        7 May 2022 10:57:53 -0000
@@ -54,14 +54,12 @@
 #include <sys/ioctl.h>
 #include <sys/tty.h>
 #include <sys/cdio.h>
-#include <sys/poll.h>
 #include <sys/filedesc.h>
 #include <sys/specdev.h>
 #include <sys/unistd.h>
 
 int vn_read(struct file *, struct uio *, int);
 int vn_write(struct file *, struct uio *, int);
-int vn_poll(struct file *, int, struct proc *);
 int vn_kqfilter(struct file *, struct knote *);
 int vn_closefile(struct file *, struct proc *);
 int vn_seek(struct file *, off_t *, int, struct proc *);
@@ -70,7 +68,6 @@ const struct fileops vnops = {
        .fo_read        = vn_read,
        .fo_write       = vn_write,
        .fo_ioctl       = vn_ioctl,
-       .fo_poll        = vn_poll,
        .fo_kqfilter    = vn_kqfilter,
        .fo_stat        = vn_statfile,
        .fo_close       = vn_closefile,
@@ -548,15 +545,6 @@ vn_ioctl(struct file *fp, u_long com, ca
 }
 
 /*
- * File table vnode poll routine.
- */
-int
-vn_poll(struct file *fp, int events, struct proc *p)
-{
-       return (VOP_POLL(fp->f_data, fp->f_flag, events, p));
-}
-
-/*
  * Check that the vnode is still valid, and if so
  * acquire requested lock.
  */
Index: sys/sys/eventvar.h
===================================================================
RCS file: src/sys/sys/eventvar.h,v
retrieving revision 1.14
diff -u -p -r1.14 eventvar.h
--- sys/sys/eventvar.h  16 Mar 2022 14:38:43 -0000      1.14
+++ sys/sys/eventvar.h  7 May 2022 10:57:53 -0000
@@ -65,7 +65,6 @@ struct kqueue {
        struct          task kq_task;           /* deferring of activation */
 
        int             kq_state;               /* [q] */
-#define KQ_SEL         0x01
 #define KQ_SLEEP       0x02
 #define KQ_DYING       0x04
 };
Index: sys/sys/file.h
===================================================================
RCS file: src/sys/sys/file.h,v
retrieving revision 1.65
diff -u -p -r1.65 file.h
--- sys/sys/file.h      20 Jan 2022 03:43:31 -0000      1.65
+++ sys/sys/file.h      7 May 2022 10:57:53 -0000
@@ -66,7 +66,6 @@ struct        fileops {
        int     (*fo_read)(struct file *, struct uio *, int);
        int     (*fo_write)(struct file *, struct uio *, int);
        int     (*fo_ioctl)(struct file *, u_long, caddr_t, struct proc *);
-       int     (*fo_poll)(struct file *, int, struct proc *);
        int     (*fo_kqfilter)(struct file *, struct knote *);
        int     (*fo_stat)(struct file *, struct stat *, struct proc *);
        int     (*fo_close)(struct file *, struct proc *);
Index: sys/sys/pipe.h
===================================================================
RCS file: src/sys/sys/pipe.h,v
retrieving revision 1.27
diff -u -p -r1.27 pipe.h
--- sys/sys/pipe.h      29 Jun 2020 18:23:18 -0000      1.27
+++ sys/sys/pipe.h      7 May 2022 10:57:53 -0000
@@ -62,7 +62,6 @@ struct pipebuf {
 #define PIPE_WANTR     0x008   /* Reader wants some characters. */
 #define PIPE_WANTW     0x010   /* Writer wants space to put characters. */
 #define PIPE_WANTD     0x020   /* Pipe is wanted to be run-down. */
-#define PIPE_SEL       0x040   /* Pipe has a select active. */
 #define PIPE_EOF       0x080   /* Pipe is in EOF condition. */
 #define PIPE_LOCK      0x100   /* Thread has exclusive I/O access. */
 #define PIPE_LWANT     0x200   /* Thread wants exclusive I/O access. */
Index: sys/sys/socketvar.h
===================================================================
RCS file: src/sys/sys/socketvar.h,v
retrieving revision 1.101
diff -u -p -r1.101 socketvar.h
--- sys/sys/socketvar.h 6 Nov 2021 05:26:33 -0000       1.101
+++ sys/sys/socketvar.h 7 May 2022 10:57:53 -0000
@@ -276,7 +276,6 @@ struct knote;
 int    soo_read(struct file *, struct uio *, int);
 int    soo_write(struct file *, struct uio *, int);
 int    soo_ioctl(struct file *, u_long, caddr_t, struct proc *);
-int    soo_poll(struct file *, int, struct proc *);
 int    soo_kqfilter(struct file *, struct knote *);
 int    soo_close(struct file *, struct proc *);
 int    soo_stat(struct file *, struct stat *, struct proc *);
Index: usr.bin/fstat/fstat.c
===================================================================
RCS file: src/usr.bin/fstat/fstat.c,v
retrieving revision 1.102
diff -u -p -r1.102 fstat.c
--- usr.bin/fstat/fstat.c       17 Jul 2021 20:46:02 -0000      1.102
+++ usr.bin/fstat/fstat.c       7 May 2022 10:57:53 -0000
@@ -562,9 +562,8 @@ kqueuetrans(struct kinfo_file *kf)
 
        printf("kqueue ");
        hide((void *)(uintptr_t)kf->f_data);
-       printf(" %d state: %s%s\n",
+       printf(" %d state: %s\n",
            kf->kq_count,
-           (kf->kq_state & KQ_SEL) ? "S" : "",
            (kf->kq_state & KQ_SLEEP) ? "W" : "");
        return;
 }

Reply via email to