#include "mpm_common.h"
#include "ap_mpm.h"
#include "ap_listen.h"
+#include "scoreboard.h"
#include "util_mutex.h"
#ifdef HAVE_PWD_H
#endif
+APLOG_USE_MODULE(core);
+
typedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t;
typedef struct extra_process_t {
" 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:
/* 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 */
/* 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 */
* 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
}
}
-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)
{
apr_status_t rv;
pid_t otherpid;
int running = 0;
- int have_pid_file = 0;
const char *status;
*exit_status = 0;
status = "httpd (no pid file) not running";
}
else {
- have_pid_file = 1;
if (kill(otherpid, 0) == 0) {
running = 1;
status = apr_psprintf(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;
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] = '-';
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;