-/* $OpenBSD: sys_socket.c,v 1.62 2024/03/26 09:46:47 mvs Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.63 2024/03/31 13:50:00 mvs Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
case FIOASYNC:
solock(so);
+ mtx_enter(&so->so_rcv.sb_mtx);
if (*(int *)data) {
so->so_rcv.sb_flags |= SB_ASYNC;
so->so_snd.sb_flags |= SB_ASYNC;
so->so_rcv.sb_flags &= ~SB_ASYNC;
so->so_snd.sb_flags &= ~SB_ASYNC;
}
+ mtx_leave(&so->so_rcv.sb_mtx);
sounlock(so);
break;
-/* $OpenBSD: uipc_socket.c,v 1.323 2024/03/27 22:47:53 mvs Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.324 2024/03/31 13:50:00 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
case AF_INET6:
switch (prp->pr_type) {
case SOCK_DGRAM:
+ so->so_rcv.sb_flags |= SB_OWNLOCK;
+ /* FALLTHROUGH */
case SOCK_RAW:
so->so_rcv.sb_flags |= SB_MTXLOCK;
break;
* we sleep, the socket buffers are not marked as spliced yet.
*/
if (somove(so, M_WAIT)) {
+ mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_flags |= SB_SPLICE;
+ mtx_leave(&so->so_rcv.sb_mtx);
sosp->so_snd.sb_flags |= SB_SPLICE;
}
task_del(sosplice_taskq, &so->so_splicetask);
timeout_del(&so->so_idleto);
sosp->so_snd.sb_flags &= ~SB_SPLICE;
+ mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_flags &= ~SB_SPLICE;
+ mtx_leave(&so->so_rcv.sb_mtx);
so->so_sp->ssp_socket = sosp->so_sp->ssp_soback = NULL;
/* Do not wakeup a socket that is about to be freed. */
if ((freeing & SOSP_FREEING_READ) == 0 && soreadable(so))
pru_rcvd(so);
/* Receive buffer did shrink by len bytes, adjust oob. */
+ mtx_enter(&so->so_rcv.sb_mtx);
rcvstate = so->so_rcv.sb_state;
so->so_rcv.sb_state &= ~SS_RCVATMARK;
oobmark = so->so_oobmark;
if (oobmark >= len)
oobmark = 0;
}
+ mtx_leave(&so->so_rcv.sb_mtx);
/*
* Handle oob data. If any malloc fails, ignore error.
-/* $OpenBSD: uipc_socket2.c,v 1.146 2024/03/27 22:47:53 mvs Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.147 2024/03/31 13:50:00 mvs Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
socantrcvmore(struct socket *so)
{
soassertlocked(so);
+ mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_state |= SS_CANTRCVMORE;
+ mtx_leave(&so->so_rcv.sb_mtx);
sorwakeup(so);
}
-/* $OpenBSD: nfs_socket.c,v 1.146 2024/03/22 07:15:04 claudio Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.147 2024/03/31 13:50:00 mvs Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
error = soreserve(so, sndreserve, rcvreserve);
if (error)
goto bad_locked;
+ mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_flags |= SB_NOINTR;
+ mtx_leave(&so->so_rcv.sb_mtx);
so->so_snd.sb_flags |= SB_NOINTR;
sounlock(so);
-/* $OpenBSD: nfs_syscalls.c,v 1.122 2024/03/22 07:15:04 claudio Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.123 2024/03/31 13:50:00 mvs Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
m_freem(m);
}
solock(so);
- so->so_rcv.sb_flags &= ~SB_NOINTR;
mtx_enter(&so->so_rcv.sb_mtx);
+ so->so_rcv.sb_flags &= ~SB_NOINTR;
so->so_rcv.sb_timeo_nsecs = INFSLP;
mtx_leave(&so->so_rcv.sb_mtx);
- so->so_snd.sb_flags &= ~SB_NOINTR;
mtx_enter(&so->so_snd.sb_mtx);
+ so->so_snd.sb_flags &= ~SB_NOINTR;
so->so_snd.sb_timeo_nsecs = INFSLP;
mtx_leave(&so->so_snd.sb_mtx);
sounlock(so);