diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-01-26 18:24:24 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-01-26 18:24:24 +0000 |
commit | 4c15708952436a05784f57ea1734e6031a546dba (patch) | |
tree | b9fd86e325561b5f487057abbe5e84011c8892ae /sys/kern | |
parent | cce255a4dd575e3ece1031929aed5f14f11110b2 (diff) |
Unlock listen(2). `somaxconn_local' and `sominconn_local' used
respectively to cache values as we do in other places.
ok bluhm
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/syscalls.master | 4 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index c30a0f92e57..0400b8ea8d4 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.256 2023/12/21 19:34:07 miod Exp $ +; $OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -223,7 +223,7 @@ socklen_t namelen); } 105 STD NOLOCK { int sys_setsockopt(int s, int level, int name, \ const void *val, socklen_t valsize); } -106 STD { int sys_listen(int s, int backlog); } +106 STD NOLOCK { int sys_listen(int s, int backlog); } 107 STD { int sys_chflagsat(int fd, const char *path, \ u_int flags, int atflags); } 108 STD NOLOCK { int sys_pledge(const char *promises, \ diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 9da3bdd2040..41a6bd7045d 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.314 2024/01/12 10:48:03 bluhm Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.315 2024/01/26 18:24:23 mvs Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -226,6 +226,8 @@ sobind(struct socket *so, struct mbuf *nam, struct proc *p) int solisten(struct socket *so, int backlog) { + int somaxconn_local = READ_ONCE(somaxconn); + int sominconn_local = READ_ONCE(sominconn); int error; soassertlocked(so); @@ -241,10 +243,10 @@ solisten(struct socket *so, int backlog) return (error); if (TAILQ_FIRST(&so->so_q) == NULL) so->so_options |= SO_ACCEPTCONN; - if (backlog < 0 || backlog > somaxconn) - backlog = somaxconn; - if (backlog < sominconn) - backlog = sominconn; + if (backlog < 0 || backlog > somaxconn_local) + backlog = somaxconn_local; + if (backlog < sominconn_local) + backlog = sominconn_local; so->so_qlimit = backlog; return (0); } |