summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-08-06 20:13:59 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-08-06 20:13:59 +0000
commit6222f3724ce112d5711dbb1f6d8faf5611f00754 (patch)
treefe7d138fb7bfdba58471aebe793e3f969e5bc0e8 /sys
parent2a48c4e1c18515bf90be650cbdce8aebb1f7c303 (diff)
Use atomic_load_int(9) for unlocked read access to net.unix.*space
sysctl(2) variables. ok bluhm
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_usrreq.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 1dbe0e72eef..1b5117b97bf 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.208 2024/06/28 21:30:24 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.209 2024/08/06 20:13:58 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -235,12 +235,12 @@ uipc_setaddr(const struct unpcb *unp, struct mbuf *nam)
* be large enough for at least one max-size datagram plus address.
*/
#define PIPSIZ 8192
-u_int unpst_sendspace = PIPSIZ;
-u_int unpst_recvspace = PIPSIZ;
-u_int unpsq_sendspace = PIPSIZ;
-u_int unpsq_recvspace = PIPSIZ;
-u_int unpdg_sendspace = 2*1024; /* really max datagram size */
-u_int unpdg_recvspace = 16*1024;
+u_int unpst_sendspace = PIPSIZ; /* [a] */
+u_int unpst_recvspace = PIPSIZ; /* [a] */
+u_int unpsq_sendspace = PIPSIZ; /* [a] */
+u_int unpsq_recvspace = PIPSIZ; /* [a] */
+u_int unpdg_sendspace = 2*1024; /* [a] really max datagram size */
+u_int unpdg_recvspace = 16*1024; /* [a] */
const struct sysctl_bounded_args unpstctl_vars[] = {
{ UNPCTL_RECVSPACE, &unpst_recvspace, 0, SB_MAX },
@@ -267,15 +267,21 @@ uipc_attach(struct socket *so, int proto, int wait)
switch (so->so_type) {
case SOCK_STREAM:
- error = soreserve(so, unpst_sendspace, unpst_recvspace);
+ error = soreserve(so,
+ atomic_load_int(&unpst_sendspace),
+ atomic_load_int(&unpst_recvspace));
break;
case SOCK_SEQPACKET:
- error = soreserve(so, unpsq_sendspace, unpsq_recvspace);
+ error = soreserve(so,
+ atomic_load_int(&unpsq_sendspace),
+ atomic_load_int(&unpsq_recvspace));
break;
case SOCK_DGRAM:
- error = soreserve(so, unpdg_sendspace, unpdg_recvspace);
+ error = soreserve(so,
+ atomic_load_int(&unpdg_sendspace),
+ atomic_load_int(&unpdg_recvspace));
break;
default: