]> granicus.if.org Git - apache/blobdiff - server/mpm_unix.c
event: child_main() never returns, so remove some dead code after
[apache] / server / mpm_unix.c
index eadfa33aa3d2ef27b2b99b064c5c0a0ca93dc9a8..c0620191cb9efe0b71a797e32831f91020c8d05a 100644 (file)
@@ -42,6 +42,7 @@
 #include "mpm_common.h"
 #include "ap_mpm.h"
 #include "ap_listen.h"
+#include "scoreboard.h"
 #include "util_mutex.h"
 
 #ifdef HAVE_PWD_H
@@ -55,6 +56,8 @@
 #endif
 
 
+APLOG_USE_MODULE(core);
+
 typedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t;
 
 typedef struct extra_process_t {
@@ -141,17 +144,7 @@ static int reclaim_one_pid(pid_t pid, action_t action)
                      " still did not exit, "
                      "sending a SIGKILL",
                      pid);
-#ifndef BEOS
         kill(pid, SIGKILL);
-#else
-        /* sending a SIGKILL kills the entire team on BeOS, and as
-         * httpd thread is part of that team it removes any chance
-         * of ever doing a restart.  To counter this I'm changing to
-         * use a kinder, gentler way of killing a specific thread
-         * that is just as effective.
-         */
-        kill_thread(pid);
-#endif
         break;
 
     case GIVEUP:
@@ -227,7 +220,8 @@ void ap_reclaim_child_processes(int terminate)
         /* now see who is done */
         not_dead_yet = 0;
         for (i = 0; i < max_daemons; ++i) {
-            pid_t pid = ap_mpm_get_child_pid(i);
+            process_score *ps = ap_get_scoreboard_process(i);
+            pid_t pid = ps->pid;
 
             if (pid == 0) {
                 continue; /* not every scoreboard entry is in use */
@@ -271,7 +265,8 @@ void ap_relieve_child_processes(void)
 
     /* now see who is done */
     for (i = 0; i < max_daemons; ++i) {
-        pid_t pid = ap_mpm_get_child_pid(i);
+        process_score *ps = ap_get_scoreboard_process(i);
+        pid_t pid = ps->pid;
 
         if (pid == 0) {
             continue; /* not every scoreboard entry is in use */
@@ -560,7 +555,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
      * requests in their logs.
      */
     srequest = apr_pstrcat(p, "OPTIONS * HTTP/1.0\r\nUser-Agent: ",
-                           ap_get_server_banner(),
+                           ap_get_server_description(),
                            " (internal dummy connection)\r\n\r\n", NULL);
 
     /* Since some operating systems support buffering of data or entire
@@ -614,7 +609,8 @@ void ap_mpm_pod_killpg(ap_pod_t *pod, int num)
     }
 }
 
-static const char *dash_k_arg;
+static const char *dash_k_arg = NULL;
+static const char *dash_k_arg_noarg = "noarg";
 
 static int send_signal(pid_t pid, int sig)
 {
@@ -631,7 +627,6 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
     apr_status_t rv;
     pid_t otherpid;
     int running = 0;
-    int have_pid_file = 0;
     const char *status;
 
     *exit_status = 0;
@@ -649,7 +644,6 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
         status = "httpd (no pid file) not running";
     }
     else {
-        have_pid_file = 1;
         if (kill(otherpid, 0) == 0) {
             running = 1;
             status = apr_psprintf(pconf,
@@ -663,7 +657,7 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
         }
     }
 
-    if (!strcmp(dash_k_arg, "start")) {
+    if (!strcmp(dash_k_arg, "start") || dash_k_arg == dash_k_arg_noarg) {
         if (running) {
             printf("%s\n", status);
             return 1;
@@ -720,12 +714,10 @@ void ap_mpm_rewrite_args(process_rec *process)
     apr_getopt_t *opt;
     char optbuf[3];
     const char *optarg;
-    int fixed_args;
 
     mpm_new_argv = apr_array_make(process->pool, process->argc,
                                   sizeof(const char **));
     *(const char **)apr_array_push(mpm_new_argv) = process->argv[0];
-    fixed_args = mpm_new_argv->nelts;
     apr_getopt_init(&opt, process->pool, process->argc, process->argv);
     opt->errfn = NULL;
     optbuf[0] = '-';
@@ -764,10 +756,12 @@ void ap_mpm_rewrite_args(process_rec *process)
 
     process->argc = mpm_new_argv->nelts;
     process->argv = (const char * const *)mpm_new_argv->elts;
-
-    if (dash_k_arg) {
-        APR_REGISTER_OPTIONAL_FN(ap_signal_server);
+  
+    if (NULL == dash_k_arg) { 
+        dash_k_arg = dash_k_arg_noarg;
     }
+
+    APR_REGISTER_OPTIONAL_FN(ap_signal_server);
 }
 
 static pid_t parent_pid, my_pid;