git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] daemon.c: squelch error message from EINTR

From
Junio C Hamano <junkio@cox.net>
Date
Aug 3, 2005, 06:20 UTC
Message-ID
<7voe8fk0dq.fsf@assigned-by-dhcp.cox.net>

This is a "call for help" patch. The kernel.org folks are talking about installing git daemon, and while the problem I am trying to address should not matter when the daemon is spawned from inetd, I would like to get this resolved. Help greatly apprciated.

-jc

------------ It appears that every time after servicing the connection, select() first fails with EINTR and ends up waiting for one second before serving the next client. The sleep() was placed by the original author per suggestion from the list to avoid spinning on failing select, but at least this EINTR situation should not result in "at most one client per second" service limit.

I am not sure if this is the right fix, and I have not received an answer from the original author of the patch. I would appreciate help from the folks on the list who are familiar with the networking.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 daemon.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
34be43e7af874923cfa1c8baeaf19fa17bae4d30
diff --git a/daemon.c b/daemon.c
--- a/daemon.c
+++ b/daemon.c
@@ -294,8 +294,11 @@ static int serve(int port)
 		fds = fds_init;
 		
 		if (select(maxfd + 1, &fds, NULL, NULL, NULL) < 0) {
-			error("select failed, resuming: %s", strerror(errno));
-			sleep(1);
+			if (errno != EINTR) {
+				error("select failed, resuming: %s",
+				      strerror(errno));
+				sleep(1);
+			}
 			continue;
 		}
 
Next: Petr Baudis
Message 1 of 2 in “daemon.c: squelch error message from EINTR”
  1. daemon.c: squelch error message from EINTRJunio C Hamano, Aug 3, 2005
  2. Petr BaudisAug 4, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.