This is the mail archive of the mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] increase listen backlog (sunrpc)


The default listen backlog in sunrpc/svc_tcp.c and sunrpc/svc_unix.c
is too small for modern servers. Here is a fix (which is similar to
the solution from TI-RPC and all *BSD ports do) to increase the
performance. We use it already since some time for SuSE Linux.

2005-01-11  Thorsten Kukuk  <>

	* sunrpc/svc_tcp.c (svctcp_create): Call listen with SOMAXCONN
	as backlog.
	* sunrpc/svc_unix.c (svcunix_create): Likewise.

--- sunrpc/svc_tcp.c
+++ sunrpc/svc_tcp.c	2004/06/14 16:50:52
@@ -165,7 +165,7 @@
       (void) __bind (sock, (struct sockaddr *) &addr, len);
   if ((__getsockname (sock, (struct sockaddr *) &addr, &len) != 0) ||
-      (__listen (sock, 2) != 0))
+      (__listen (sock, SOMAXCONN) != 0))
       perror (_("svc_tcp.c - cannot getsockname or listen"));
       if (madesock)
--- sunrpc/svc_unix.c
+++ sunrpc/svc_unix.c	2004/06/14 16:51:00
@@ -161,7 +161,7 @@
   __bind (sock, (struct sockaddr *) &addr, len);
   if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
-      || __listen (sock, 2) != 0)
+      || __listen (sock, SOMAXCONN) != 0)
       perror (_("svc_unix.c - cannot getsockname or listen"));
       if (madesock)

Thorsten Kukuk
SuSE Linux Products GmbH       Maxfeldstr. 5       D-90409 Nuernberg
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]