]> granicus.if.org Git - apache/commitdiff
Take advantage of the new pre_config return value when apr_proc_detach
authorAaron Bannert <aaron@apache.org>
Tue, 29 Jan 2002 02:41:46 +0000 (02:41 +0000)
committerAaron Bannert <aaron@apache.org>
Tue, 29 Jan 2002 02:41:46 +0000 (02:41 +0000)
fails. I'll be making some changes to apr_proc_detach, and it will be
nice to be able to report runtime errors.

Tested on worker but the code changes are identical on other MPMs.

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

server/mpm/beos/beos.c
server/mpm/experimental/perchild/perchild.c
server/mpm/perchild/perchild.c
server/mpm/prefork/prefork.c
server/mpm/worker/worker.c

index 2f059eae21ab8bd0cca1be86597f68d510cf8fc4..b618e364af49151e1c128d2382d244bc37a73995 100644 (file)
@@ -996,6 +996,7 @@ static int beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
 {
     static int restart_num = 0;
     int no_detach, debug;
+    apr_status_t rv;
 
     debug = ap_exists_config_define("DEBUG");
 
@@ -1011,8 +1012,14 @@ static int beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
     if (restart_num++ == 1) {
         is_graceful = 0;
         
-        if (!one_process && !no_detach)
-               apr_proc_detach();
+        if (!one_process && !no_detach) {
+               rv = apr_proc_detach();
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                             "apr_proc_detach failed");
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }                  
+        }
 
         server_pid = getpid();
     }
index 5bf52b946522ac3a6d051067f5f65475a9e2c538..ddc947f004df7edd141fe5fa359571e45a0611fd 100644 (file)
@@ -1432,6 +1432,7 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
     int i;
     int tmp_server_limit = DEFAULT_SERVER_LIMIT;
     int tmp_thread_limit = DEFAULT_THREAD_LIMIT;
+    apr_status_t rv;
 
     debug = ap_exists_config_define("DEBUG");
 
@@ -1448,7 +1449,12 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
         is_graceful = 0;
 
         if (!one_process && !no_detach) {
-            apr_proc_detach();
+            rv = apr_proc_detach();
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                             "apr_proc_detach failed");
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }                  
         }
 
         my_pid = getpid();
index 5bf52b946522ac3a6d051067f5f65475a9e2c538..ddc947f004df7edd141fe5fa359571e45a0611fd 100644 (file)
@@ -1432,6 +1432,7 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
     int i;
     int tmp_server_limit = DEFAULT_SERVER_LIMIT;
     int tmp_thread_limit = DEFAULT_THREAD_LIMIT;
+    apr_status_t rv;
 
     debug = ap_exists_config_define("DEBUG");
 
@@ -1448,7 +1449,12 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
         is_graceful = 0;
 
         if (!one_process && !no_detach) {
-            apr_proc_detach();
+            rv = apr_proc_detach();
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                             "apr_proc_detach failed");
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }                  
         }
 
         my_pid = getpid();
index 42e1fd9c0c37de99a790cf285f2f1114c2502523..b55bbe4602a25216f933f04c327d68469a7d2ac3 100644 (file)
@@ -1204,6 +1204,7 @@ static int prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
 {
     static int restart_num = 0;
     int no_detach, debug;
+    apr_status_t rv;
 
     debug = ap_exists_config_define("DEBUG");
 
@@ -1219,9 +1220,14 @@ static int prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
     if (restart_num++ == 1) {
        is_graceful = 0;
 
-       if (!one_process && !no_detach) {
-           apr_proc_detach();
-       }
+    if (!one_process && !no_detach) {
+        rv = apr_proc_detach();
+        if (rv != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                         "apr_proc_detach failed");
+            return HTTP_INTERNAL_SERVER_ERROR;
+        }
+    }
 
        parent_pid = ap_my_pid = getpid();
     }
index 1b23c65048e2e0c4e34c2a6b8558d2eea2732ce8..fdf9cafa495aa5e1b4a345368e065af28f315605 100644 (file)
@@ -1541,12 +1541,13 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 }
 
 static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, 
-                              apr_pool_t *ptemp)
+                             apr_pool_t *ptemp)
 {
     static int restart_num = 0;
     int no_detach, debug;
     ap_directive_t *pdir;
     ap_directive_t *max_clients = NULL;
+    apr_status_t rv;
 
     /* make sure that "ThreadsPerChild" gets set before "MaxClients" */
     for (pdir = ap_conftree; pdir != NULL; pdir = pdir->next) {
@@ -1599,7 +1600,12 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
         is_graceful = 0;
 
         if (!one_process && !no_detach) {
-            apr_proc_detach();
+            rv = apr_proc_detach();
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                             "apr_proc_detach failed");
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }
         }
         parent_pid = ap_my_pid = getpid();
     }