public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Update SOMAXCONN value from Linux 5.4
@ 2019-11-29  1:10 Joseph Myers
  2019-11-29  4:18 ` Carlos O'Donell
  2019-11-29  8:32 ` Florian Weimer
  0 siblings, 2 replies; 4+ messages in thread
From: Joseph Myers @ 2019-11-29  1:10 UTC (permalink / raw)
  To: libc-alpha

Linux 5.4 changes the SOMAXCONN value from 128 to 4096 (this isn't in
a uapi header; various constants related to the kernel/userspace
interface, including this one, are in the non-uapi linux/socket.h
header).

This patch increases the value in glibc.  As I understand it, it is
safe to use a higher value even with older kernels (the kernel will
simply adjust the value passed to listen to be no more than the value
supported in the kernel), and SOMAXCONN is actually only a default for
a sysctl value in the kernel that can be changed at runtime.  So I
think updating the value in glibc is a reasonable and safe thing to
do.

Tested for x86_64.

diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 3e88d66328..7537a7e86b 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -169,7 +169,7 @@ typedef __socklen_t socklen_t;
 #define SOL_XDP		283
 
 /* Maximum queue length specifiable by listen.  */
-#define SOMAXCONN	128
+#define SOMAXCONN	4096
 
 /* Get the definition of the macro to define the common sockaddr members.  */
 #include <bits/sockaddr.h>

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-29  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-29  1:10 Update SOMAXCONN value from Linux 5.4 Joseph Myers
2019-11-29  4:18 ` Carlos O'Donell
2019-11-29  8:32 ` Florian Weimer
2019-11-29  8:35   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).