You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/12/22 23:24:16 UTC

[PATCH] more useful warning message for fcntl() lock failure

I think this patch is self-explanatory.  We've got what, about umpteen
dozen reports from folks who just don't search the bugdb first before
telling us about their F_SETLKW errors? 

I'm unsure why we test for EINTR while locking but not while unlocking,
this can't be healthy. 

Dean

Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.258
diff -u -r1.258 http_main.c
--- http_main.c	1997/12/21 01:54:39	1.258
+++ http_main.c	1997/12/22 22:08:42
@@ -592,21 +592,31 @@
 {
     int ret;
 
-    while ((ret = fcntl(lock_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR)
-	continue;
+    while ((ret = fcntl(lock_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR) {
+	/* nop */
+    }
 
     if (ret < 0) {
 	aplog_error(APLOG_MARK, APLOG_EMERG, server_conf,
-		    "fcntl: F_SETLKW: Error getting accept lock. Exiting!");
+		    "fcntl: F_SETLKW: Error getting accept lock, exiting!  "
+		    "Perhaps you need to use the LockFile directive to place "
+		    "your lock file on a local disk!");
 	exit(1);
     }
 }
 
 static void accept_mutex_off(void)
 {
-    if (fcntl(lock_fd, F_SETLKW, &unlock_it) < 0) {
+    int ret;
+
+    while ((ret = fcntl(lock_fd, F_SETLKW, &unlock_it)) < 0 && errno == EINTR) {
+	/* nop */
+    }
+    if (ret < 0) {
 	aplog_error(APLOG_MARK, APLOG_EMERG, server_conf,
-		    "fcntl: F_SETLKW: Error freeing accept lock. Exiting!");
+		    "fcntl: F_SETLKW: Error freeing accept lock, exiting!  "
+		    "Perhaps you need to use the LockFile directive to place "
+		    "your lock file on a local disk!");
 	exit(1);
     }
 }