From a651bdb436248032f5838750b81603bd0dd6309c Mon Sep 17 00:00:00 2001 From: mvs Date: Mon, 23 Jan 2023 18:34:24 +0000 Subject: [PATCH] Move SS_ISSENDING flag to `sb_state'. It should belong to the send buffer as the SS_CANTSENDMORE flag. ok bluhm@ --- sys/kern/uipc_socket.c | 16 ++++++++-------- sys/sys/socketvar.h | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index b5ca9eab359..0d2bc0b348a 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.296 2023/01/23 18:33:34 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.297 2023/01/23 18:34:24 mvs Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -578,7 +578,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top, restart: if ((error = sblock(so, &so->so_snd, SBLOCKWAIT(flags))) != 0) goto out; - so->so_state |= SS_ISSENDING; + so->so_snd.sb_state |= SS_ISSENDING; do { if (so->so_snd.sb_state & SS_CANTSENDMORE) snderr(EPIPE); @@ -612,7 +612,7 @@ restart: snderr(EWOULDBLOCK); sbunlock(so, &so->so_snd); error = sbwait(so, &so->so_snd); - so->so_state &= ~SS_ISSENDING; + so->so_snd.sb_state &= ~SS_ISSENDING; if (error) goto out; goto restart; @@ -638,7 +638,7 @@ restart: top->m_flags |= M_EOR; } if (resid == 0) - so->so_state &= ~SS_ISSENDING; + so->so_snd.sb_state &= ~SS_ISSENDING; if (top && so->so_options & SO_ZEROIZE) top->m_flags |= M_ZEROIZE; if (flags & MSG_OOB) @@ -654,7 +654,7 @@ restart: } while (resid); release: - so->so_state &= ~SS_ISSENDING; + so->so_snd.sb_state &= ~SS_ISSENDING; sbunlock(so, &so->so_snd); out: sounlock(so); @@ -1502,7 +1502,7 @@ somove(struct socket *so, int wait) goto release; len = space; } - sosp->so_state |= SS_ISSENDING; + sosp->so_snd.sb_state |= SS_ISSENDING; SBLASTRECORDCHK(&so->so_rcv, "somove 1"); SBLASTMBUFCHK(&so->so_rcv, "somove 1"); @@ -1697,7 +1697,7 @@ somove(struct socket *so, int wait) /* Append all remaining data to drain socket. */ if (so->so_rcv.sb_cc == 0 || maxreached) - sosp->so_state &= ~SS_ISSENDING; + sosp->so_snd.sb_state &= ~SS_ISSENDING; error = pru_send(sosp, m, NULL, NULL); if (error) { if (sosp->so_snd.sb_state & SS_CANTSENDMORE) @@ -1711,7 +1711,7 @@ somove(struct socket *so, int wait) goto nextpkt; release: - sosp->so_state &= ~SS_ISSENDING; + sosp->so_snd.sb_state &= ~SS_ISSENDING; if (!error && maxreached && so->so_splicemax == so->so_splicelen) error = EFBIG; if (error) diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index c99caac0dcc..9ee8d059a21 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.116 2023/01/22 12:05:44 mvs Exp $ */ +/* $OpenBSD: socketvar.h,v 1.117 2023/01/23 18:34:24 mvs Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -146,7 +146,8 @@ struct socket { * NOTE: The following states should be used with corresponding socket's * buffer `sb_state' only: * - * SS_CANTSENDMORE with `so_snd' + * SS_CANTSENDMORE with `so_snd' + * SS_ISSENDING with `so_snd' * SS_CANTRCVMORE with `so_rcv' * SS_RCVATMARK with `so_rcv' */ @@ -225,7 +226,7 @@ sbspace(struct socket *so, struct sockbuf *sb) /* are we sending on this socket? */ #define soissending(so) \ - ((so)->so_state & SS_ISSENDING) + ((so)->so_snd.sb_state & SS_ISSENDING) /* can we read something from so? */ static inline int -- 2.20.1