On Mon, Jan 23, 2023 at 02:09:14PM +0300, Vitaliy Makkoveev wrote:
> It should belong to send buffer as the SS_CANTSENDMORE flag.

OK bluhm@

> Index: sys/kern/uipc_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.295
> diff -u -p -r1.295 uipc_socket.c
> --- sys/kern/uipc_socket.c    22 Jan 2023 12:05:44 -0000      1.295
> +++ sys/kern/uipc_socket.c    23 Jan 2023 11:05:09 -0000
> @@ -578,7 +578,7 @@ sosend(struct socket *so, struct mbuf *a
>  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)
> Index: sys/sys/socketvar.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/socketvar.h,v
> retrieving revision 1.116
> diff -u -p -r1.116 socketvar.h
> --- sys/sys/socketvar.h       22 Jan 2023 12:05:44 -0000      1.116
> +++ sys/sys/socketvar.h       23 Jan 2023 11:05:09 -0000
> @@ -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 sockbu
>  
>  /* 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

Reply via email to