]> granicus.if.org Git - apache/commitdiff
mpms: follow up to r1629925: more error reports.
authorYann Ylavic <ylavic@apache.org>
Tue, 1 Mar 2016 22:29:50 +0000 (22:29 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 1 Mar 2016 22:29:50 +0000 (22:29 +0000)
Failing to setup (or no) listeners is also an error.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1733173 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/event/event.c
server/mpm/mpmt_os2/mpmt_os2.c
server/mpm/prefork/prefork.c
server/mpm/winnt/mpm_winnt.c
server/mpm/worker/worker.c

index 9f80b0bdbe42f5ff89cfc7053dad98ef696296ef..0d6d9584fe6904a77244f0755770c11b2af0df7d 100644 (file)
@@ -3345,7 +3345,7 @@ static int event_open_logs(apr_pool_t * p, apr_pool_t * plog,
         ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
                      (startup ? NULL : s), APLOGNO(03272)
                      "no listening sockets available, shutting down");
-        return DONE;
+        return !OK;
     }
 
     if (one_process) {
index 7579d3a64185e204835256c25a36d379a3b8cea3..22bf5e73710478e96882c34de053c67f77578b62 100644 (file)
@@ -102,7 +102,7 @@ typedef struct {
     listen_socket_t listeners[1];
 } parent_info_t;
 
-static char master_main();
+static int master_main();
 static void spawn_child(int slot);
 void ap_mpm_child_main(apr_pool_t *pconf);
 static void set_signals();
@@ -157,7 +157,7 @@ static int mpmt_os2_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
     }
     else {
         /* Parent process */
-        char restart;
+        int rc;
         is_parent_process = TRUE;
 
         if (ap_setup_listeners(ap_server_conf) < 1) {
@@ -168,15 +168,16 @@ static int mpmt_os2_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
 
         ap_log_pid(pconf, ap_pid_fname);
 
-        restart = master_main();
+        rc = master_main();
         ++ap_my_generation;
         ap_scoreboard_image->global->running_generation = ap_my_generation;
 
-        if (!restart) {
+        if (rc != OK) {
             ap_remove_pid(pconf, ap_pid_fname);
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00201)
-                         "caught SIGTERM, shutting down");
-            return DONE;
+                         "caught %s, shutting down",
+                         (rc == DONE) ? "SIGTERM" : "error");
+            return rc;
         }
     }  /* Parent process */
 
@@ -188,7 +189,7 @@ static int mpmt_os2_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
 /* Main processing of the parent process
  * returns TRUE if restarting
  */
-static char master_main()
+static int master_main()
 {
     server_rec *s = ap_server_conf;
     ap_listen_rec *lr;
@@ -203,7 +204,7 @@ static char master_main()
     if (ap_setup_listeners(ap_server_conf) < 1) {
         ap_log_error(APLOG_MARK, APLOG_ALERT, 0, s, APLOGNO(00202)
                      "no listening sockets available, shutting down");
-        return FALSE;
+        return !OK;
     }
 
     /* Allocate a shared memory block for the array of listeners */
@@ -219,7 +220,7 @@ static char master_main()
     if (rc) {
         ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, APLOGNO(00203)
                      "failure allocating shared memory, shutting down");
-        return FALSE;
+        return !OK;
     }
 
     /* Store the listener sockets in the shared memory area for our children to see */
@@ -236,7 +237,7 @@ static char master_main()
     if (rc) {
         ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, APLOGNO(00204)
                      "failure creating accept mutex, shutting down");
-        return FALSE;
+        return !OK;
     }
 
     parent_info->accept_mutex = ap_mpm_accept_mutex;
@@ -251,7 +252,7 @@ static char master_main()
         if (rc) {
             ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, APLOGNO(00205)
                          "unable to allocate shared memory for scoreboard , exiting");
-            return FALSE;
+            return !OK;
         }
 
         ap_init_scoreboard(sb_mem);
@@ -266,7 +267,7 @@ static char master_main()
     if (one_process) {
         ap_scoreboard_image->parent[0].pid = getpid();
         ap_mpm_child_main(pconf);
-        return FALSE;
+        return DONE;
     }
 
     while (!restart_pending && !shutdown_pending) {
@@ -318,7 +319,7 @@ static char master_main()
     }
 
     DosFreeMem(parent_info);
-    return restart_pending;
+    return restart_pending ? OK : DONE;
 }
 
 
index d66d969483d991eb108d8868c0f23e91fb1503e9..c0f9371adf0ede81f28f11fed603fd330dc1c1ca 100644 (file)
@@ -1308,7 +1308,7 @@ static int prefork_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
         ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
                      (startup ? NULL : s), APLOGNO(03279)
                      "no listening sockets available, shutting down");
-        return DONE;
+        return !OK;
     }
 
     if (one_process) {
index 0df9e2f3f729bca4dc335194e9019d13b9e57637..d9251b1cd28ca805f97077871fb2709465a3c2b6 100644 (file)
@@ -1653,7 +1653,7 @@ static int winnt_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, s
     if (ap_setup_listeners(s) < 1) {
         ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_STARTUP, 0,
                      NULL, APLOGNO(00451) "no listening sockets available, shutting down");
-        return DONE;
+        return !OK;
     }
 
     return OK;
index 9629962ac8000576986f51c0f74f9ce5d77fdbc9..5cb516f9c22c2e47d2e32ec92844c9a00193f2b5 100644 (file)
@@ -2033,7 +2033,7 @@ static int worker_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
         ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
                      (startup ? NULL : s), APLOGNO(03290)
                      "no listening sockets available, shutting down");
-        return DONE;
+        return !OK;
     }
 
     if (one_process) {