sync with OpenBSD -current
This commit is contained in:
parent
7768d1f254
commit
c9341f2e4a
65 changed files with 2158 additions and 1228 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uipc_socket2.c,v 1.150 2024/04/25 17:32:53 bluhm Exp $ */
|
||||
/* $OpenBSD: uipc_socket2.c,v 1.152 2024/05/02 21:26:52 mvs Exp $ */
|
||||
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -142,10 +142,15 @@ soisdisconnecting(struct socket *so)
|
|||
soassertlocked(so);
|
||||
so->so_state &= ~SS_ISCONNECTING;
|
||||
so->so_state |= SS_ISDISCONNECTING;
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
so->so_rcv.sb_state |= SS_CANTRCVMORE;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
so->so_snd.sb_state |= SS_CANTSENDMORE;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
|
||||
wakeup(&so->so_timeo);
|
||||
sowwakeup(so);
|
||||
sorwakeup(so);
|
||||
|
@ -157,10 +162,15 @@ soisdisconnected(struct socket *so)
|
|||
soassertlocked(so);
|
||||
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
|
||||
so->so_state |= SS_ISDISCONNECTED;
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
so->so_rcv.sb_state |= SS_CANTRCVMORE;
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
so->so_snd.sb_state |= SS_CANTSENDMORE;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
|
||||
wakeup(&so->so_timeo);
|
||||
sowwakeup(so);
|
||||
sorwakeup(so);
|
||||
|
@ -315,14 +325,16 @@ void
|
|||
socantsendmore(struct socket *so)
|
||||
{
|
||||
soassertlocked(so);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
so->so_snd.sb_state |= SS_CANTSENDMORE;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
sowwakeup(so);
|
||||
}
|
||||
|
||||
void
|
||||
socantrcvmore(struct socket *so)
|
||||
{
|
||||
if ((so->so_rcv.sb_flags & SB_OWNLOCK) == 0)
|
||||
if ((so->so_rcv.sb_flags & SB_MTXLOCK) == 0)
|
||||
soassertlocked(so);
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
|
@ -666,6 +678,8 @@ soreserve(struct socket *so, u_long sndcc, u_long rcvcc)
|
|||
{
|
||||
soassertlocked(so);
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
mtx_enter(&so->so_snd.sb_mtx);
|
||||
if (sbreserve(so, &so->so_snd, sndcc))
|
||||
goto bad;
|
||||
so->so_snd.sb_wat = sndcc;
|
||||
|
@ -673,21 +687,20 @@ soreserve(struct socket *so, u_long sndcc, u_long rcvcc)
|
|||
so->so_snd.sb_lowat = MCLBYTES;
|
||||
if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat)
|
||||
so->so_snd.sb_lowat = so->so_snd.sb_hiwat;
|
||||
|
||||
mtx_enter(&so->so_rcv.sb_mtx);
|
||||
if (sbreserve(so, &so->so_rcv, rcvcc)) {
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
if (sbreserve(so, &so->so_rcv, rcvcc))
|
||||
goto bad2;
|
||||
}
|
||||
so->so_rcv.sb_wat = rcvcc;
|
||||
if (so->so_rcv.sb_lowat == 0)
|
||||
so->so_rcv.sb_lowat = 1;
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
|
||||
return (0);
|
||||
bad2:
|
||||
sbrelease(so, &so->so_snd);
|
||||
bad:
|
||||
mtx_leave(&so->so_snd.sb_mtx);
|
||||
mtx_leave(&so->so_rcv.sb_mtx);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue