From 80b1b8fbf93f72f67d383f3fa3bc7fd1e9c2ef17 Mon Sep 17 00:00:00 2001 From: mvs Date: Fri, 27 Jan 2023 18:46:34 +0000 Subject: [PATCH] Replace selinfo structure by klist in sockbuf. 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. ok visa@ --- sys/kern/uipc_socket.c | 18 +++++++++--------- sys/kern/uipc_socket2.c | 12 ++++++------ sys/kern/uipc_syscalls.c | 4 ++-- sys/miscfs/fifofs/fifo_vnops.c | 8 ++++---- sys/sys/socketvar.h | 8 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 0d2bc0b348a..ca142be8e86 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.297 2023/01/23 18:34:24 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.298 2023/01/27 18:46:34 mvs Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -176,8 +176,8 @@ socreate(int dom, struct socket **aso, int type, int proto) 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 knote *kn) 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 diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 4b6f1e9708e..e37fef4c503 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.133 2023/01/22 12:05:44 mvs Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.134 2023/01/27 18:46:34 mvs Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -226,8 +226,8 @@ sonewconn(struct socket *head, int connstatus, int wait) 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 connstatus, int wait) 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 sockbuf *sb) } if (sb->sb_flags & SB_ASYNC) pgsigio(&so->so_sigio, SIGIO, 0); - KNOTE(&sb->sb_sel.si_note, 0); + KNOTE(&sb->sb_klist, 0); } /* diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 8efc1a2f046..9ce55835b1e 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.209 2023/01/22 12:05:44 mvs Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.210 2023/01/27 18:46:34 mvs Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -326,7 +326,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, : (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); diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index f3f0e96cdd4..8586550539f 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.100 2023/01/22 12:05:44 mvs Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.101 2023/01/27 18:46:34 mvs Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -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 diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 2986a6b65a3..834a2b582eb 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.118 2023/01/23 18:35:13 mvs Exp $ */ +/* $OpenBSD: socketvar.h,v 1.119 2023/01/27 18:46:34 mvs Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -35,7 +35,7 @@ #ifndef _SYS_SOCKETVAR_H_ #define _SYS_SOCKETVAR_H_ -#include /* for struct selinfo */ +#include #include #include /* for struct sigio_ref */ #include @@ -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 sockbuf *sb) { 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)); } /* -- 2.20.1