On Thu, Jan 26, 2023 at 09:51:14PM +0300, Vitaliy Makkoveev wrote:
> No reason to keep it, selinfo is just wrapper to klist. netstat(1) and
> libkvm use socket structure, but don't touch
> so_{snd,rcv}.sb_sel.si_note. 

OK visa@

> Index: sys/kern/uipc_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.297
> diff -u -p -r1.297 uipc_socket.c
> --- sys/kern/uipc_socket.c    23 Jan 2023 18:34:24 -0000      1.297
> +++ sys/kern/uipc_socket.c    26 Jan 2023 18:39:31 -0000
> @@ -176,8 +176,8 @@ socreate(int dom, struct socket **aso, i
>       if (prp->pr_type != type)
>               return (EPROTOTYPE);
>       so = soalloc(M_WAIT);
> -     klist_init(&so->so_rcv.sb_sel.si_note, &socket_klistops, so);
> -     klist_init(&so->so_snd.sb_sel.si_note, &socket_klistops, so);
> +     klist_init(&so->so_rcv.sb_klist, &socket_klistops, so);
> +     klist_init(&so->so_snd.sb_klist, &socket_klistops, so);
>       sigio_init(&so->so_sigio);
>       TAILQ_INIT(&so->so_q0);
>       TAILQ_INIT(&so->so_q);
> @@ -303,8 +303,8 @@ sofree(struct socket *so, int keep_lock)
>       }
>  
>       sigio_free(&so->so_sigio);
> -     klist_free(&so->so_rcv.sb_sel.si_note);
> -     klist_free(&so->so_snd.sb_sel.si_note);
> +     klist_free(&so->so_rcv.sb_klist);
> +     klist_free(&so->so_snd.sb_klist);
>  #ifdef SOCKET_SPLICE
>       if (so->so_sp) {
>               if (issplicedback(so)) {
> @@ -2095,7 +2095,7 @@ void
>  sohasoutofband(struct socket *so)
>  {
>       pgsigio(&so->so_sigio, SIGURG, 0);
> -     KNOTE(&so->so_rcv.sb_sel.si_note, 0);
> +     KNOTE(&so->so_rcv.sb_klist, 0);
>  }
>  
>  int
> @@ -2126,7 +2126,7 @@ soo_kqfilter(struct file *fp, struct kno
>               return (EINVAL);
>       }
>  
> -     klist_insert_locked(&sb->sb_sel.si_note, kn);
> +     klist_insert_locked(&sb->sb_klist, kn);
>       sounlock(so);
>  
>       return (0);
> @@ -2137,7 +2137,7 @@ filt_sordetach(struct knote *kn)
>  {
>       struct socket *so = kn->kn_fp->f_data;
>  
> -     klist_remove(&so->so_rcv.sb_sel.si_note, kn);
> +     klist_remove(&so->so_rcv.sb_klist, kn);
>  }
>  
>  int
> @@ -2178,7 +2178,7 @@ filt_sowdetach(struct knote *kn)
>  {
>       struct socket *so = kn->kn_fp->f_data;
>  
> -     klist_remove(&so->so_snd.sb_sel.si_note, kn);
> +     klist_remove(&so->so_snd.sb_klist, kn);
>  }
>  
>  int
> Index: sys/kern/uipc_socket2.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket2.c,v
> retrieving revision 1.133
> diff -u -p -r1.133 uipc_socket2.c
> --- sys/kern/uipc_socket2.c   22 Jan 2023 12:05:44 -0000      1.133
> +++ sys/kern/uipc_socket2.c   26 Jan 2023 18:39:31 -0000
> @@ -226,8 +226,8 @@ sonewconn(struct socket *head, int conns
>       so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;
>       so->so_rcv.sb_timeo_nsecs = head->so_rcv.sb_timeo_nsecs;
>  
> -     klist_init(&so->so_rcv.sb_sel.si_note, &socket_klistops, so);
> -     klist_init(&so->so_snd.sb_sel.si_note, &socket_klistops, so);
> +     klist_init(&so->so_rcv.sb_klist, &socket_klistops, so);
> +     klist_init(&so->so_snd.sb_klist, &socket_klistops, so);
>       sigio_init(&so->so_sigio);
>       sigio_copy(&so->so_sigio, &head->so_sigio);
>  
> @@ -262,8 +262,8 @@ sonewconn(struct socket *head, int conns
>               if (persocket)
>                       sounlock(so);
>               sigio_free(&so->so_sigio);
> -             klist_free(&so->so_rcv.sb_sel.si_note);
> -             klist_free(&so->so_snd.sb_sel.si_note);
> +             klist_free(&so->so_rcv.sb_klist);
> +             klist_free(&so->so_snd.sb_klist);
>               pool_put(&socket_pool, so);
>               return (NULL);
>       }
> @@ -549,7 +549,7 @@ sowakeup(struct socket *so, struct sockb
>       }
>       if (sb->sb_flags & SB_ASYNC)
>               pgsigio(&so->so_sigio, SIGIO, 0);
> -     KNOTE(&sb->sb_sel.si_note, 0);
> +     KNOTE(&sb->sb_klist, 0);
>  }
>  
>  /*
> Index: sys/kern/uipc_syscalls.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_syscalls.c,v
> retrieving revision 1.209
> diff -u -p -r1.209 uipc_syscalls.c
> --- sys/kern/uipc_syscalls.c  22 Jan 2023 12:05:44 -0000      1.209
> +++ sys/kern/uipc_syscalls.c  26 Jan 2023 18:39:31 -0000
> @@ -326,7 +326,7 @@ doaccept(struct proc *p, int sock, struc
>           : (flags & SOCK_NONBLOCK ? FNONBLOCK : 0);
>  
>       /* connection has been removed from the listen queue */
> -     KNOTE(&head->so_rcv.sb_sel.si_note, 0);
> +     KNOTE(&head->so_rcv.sb_klist, 0);
>  
>       if (persocket)
>               sounlock(head);
> Index: sys/miscfs/fifofs/fifo_vnops.c
> ===================================================================
> RCS file: /cvs/src/sys/miscfs/fifofs/fifo_vnops.c,v
> retrieving revision 1.100
> diff -u -p -r1.100 fifo_vnops.c
> --- sys/miscfs/fifofs/fifo_vnops.c    22 Jan 2023 12:05:44 -0000      1.100
> +++ sys/miscfs/fifofs/fifo_vnops.c    26 Jan 2023 18:39:31 -0000
> @@ -504,7 +504,7 @@ fifo_kqfilter(void *v)
>  
>       ap->a_kn->kn_hook = so;
>  
> -     klist_insert(&sb->sb_sel.si_note, ap->a_kn);
> +     klist_insert(&sb->sb_klist, ap->a_kn);
>  
>       return (0);
>  }
> @@ -514,7 +514,7 @@ filt_fifordetach(struct knote *kn)
>  {
>       struct socket *so = (struct socket *)kn->kn_hook;
>  
> -     klist_remove(&so->so_rcv.sb_sel.si_note, kn);
> +     klist_remove(&so->so_rcv.sb_klist, kn);
>  }
>  
>  int
> @@ -548,7 +548,7 @@ filt_fifowdetach(struct knote *kn)
>  {
>       struct socket *so = (struct socket *)kn->kn_hook;
>  
> -     klist_remove(&so->so_snd.sb_sel.si_note, kn);
> +     klist_remove(&so->so_snd.sb_klist, kn);
>  }
>  
>  int
> Index: sys/sys/socketvar.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/socketvar.h,v
> retrieving revision 1.118
> diff -u -p -r1.118 socketvar.h
> --- sys/sys/socketvar.h       23 Jan 2023 18:35:13 -0000      1.118
> +++ sys/sys/socketvar.h       26 Jan 2023 18:39:31 -0000
> @@ -35,7 +35,7 @@
>  #ifndef _SYS_SOCKETVAR_H_
>  #define _SYS_SOCKETVAR_H_
>  
> -#include <sys/selinfo.h>                     /* for struct selinfo */
> +#include <sys/event.h>
>  #include <sys/queue.h>
>  #include <sys/sigio.h>                               /* for struct sigio_ref 
> */
>  #include <sys/task.h>
> @@ -123,7 +123,7 @@ struct socket {
>  #define      sb_endzero      sb_flags
>               short   sb_state;       /* socket state on sockbuf */
>               uint64_t sb_timeo_nsecs;/* timeout for read/write */
> -             struct  selinfo sb_sel; /* process selecting read/write */
> +             struct klist sb_klist;  /* process selecting read/write */
>       } so_rcv, so_snd;
>  #define      SB_MAX          (2*1024*1024)   /* default for max chars in 
> sockbuf */
>  #define      SB_LOCK         0x01            /* lock on data queue */
> @@ -202,7 +202,7 @@ sb_notify(struct socket *so, struct sock
>  {
>       soassertlocked(so);
>       return ((sb->sb_flags & (SB_WAIT|SB_ASYNC|SB_SPLICE)) != 0 ||
> -         !klist_empty(&sb->sb_sel.si_note));
> +         !klist_empty(&sb->sb_klist));
>  }
>  
>  /*
> 

Reply via email to