configure.in makes a big deal about determining AP_SIG_GRACEFUL, which
defaults to SIGUSR1, but uses SIGWINCH on Linux 2.0. But then
mpm_common.c goes ahead and ignores this for actually sending the
signal, SIGUSR1 is hard-coded;
if (!strcmp(dash_k_arg, "graceful")) {
if (!running) {
printf("httpd not running, trying to start\n");
}
else {
*exit_status = send_signal(otherpid, SIGUSR1);
return 1;
}
}
I can only surmise that there just arn't very many linux 2.0 users who
try to do graceful restarts :-)
Anyway, an easy and obvious fix would be to patch that code to use
AP_SIG_GRACEFUL. However this sucks, so I've attached a totally more
insane patch to just use SIGUSR1 everywhere, and not support "graceful"
on Linux 2,0 (which doesn't work anyway, so it's not exactly a change).
I'm working on adding "graceful stop" (httpd -k drain) [1] and well
there's a shortage of genuinely usable signals. SIGUSR2 would be the
obvious choice, but;
/*
* SIGUSR2 is being removed from the mask for the convenience of
* Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2
*/
#ifdef SIGUSR2
sigdelset(sig_mask, SIGUSR2);
#endif
Which really leaves SIGWINCH as the only semi-reliable signal to use,
but that isn't free because of the stupid Linux 2.0 brokenness. So
rather than seeing this as a lunatic patch, I'm asking you to look into
your hearts and see this as an opportunity to free up a portable signal
so some nifty functionality can be added more easily.
Failing this, can anyone suggest a non-WINCH signal which is portable
and reliable? Or, how would people feel about ditching kill-style
signalling altogher and using some other IPC mechanism, for more
adaptable and futureproofing ?
[1] When you have a few hundred users downloading DVD ISO's over dialup,
not killing their downloads when upgrading the webserver would be a
real nice feature, and well I'm tired of JoS gloating about it in IIS;
http://joelonsoftware.com/items/2005/06/15.html ;)
--
Colm MacCárthaigh Public Key: [EMAIL PROTECTED]
Index: server/mpm/prefork/prefork.c
===================================================================
--- server/mpm/prefork/prefork.c (revision 225483)
+++ server/mpm/prefork/prefork.c (working copy)
@@ -104,7 +104,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with MaxClients changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire scoreboard.
*/
int ap_max_daemons_limit = -1;
@@ -348,7 +348,7 @@
shutdown_pending = 1;
}
-/* restart() is the signal handler for SIGHUP and AP_SIG_GRACEFUL
+/* restart() is the signal handler for SIGHUP and SIGUSR1
* in the parent process, unless running in ONE_PROCESS mode
*/
static void restart(int sig)
@@ -358,7 +358,7 @@
return;
}
restart_pending = 1;
- is_graceful = (sig == AP_SIG_GRACEFUL);
+ is_graceful = (sig == SIGUSR1);
}
static void set_signals(void)
@@ -398,16 +398,16 @@
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one
*/
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -422,9 +422,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -657,7 +657,7 @@
if (one_process) {
apr_signal(SIGHUP, sig_term);
- /* Don't catch AP_SIG_GRACEFUL in ONE_PROCESS mode :) */
+ /* Don't catch SIGUSR1 in ONE_PROCESS mode :) */
apr_signal(SIGINT, sig_term);
#ifdef SIGQUIT
apr_signal(SIGQUIT, SIG_DFL);
@@ -715,10 +715,10 @@
*/
apr_signal(SIGHUP, just_die);
apr_signal(SIGTERM, just_die);
- /* The child process doesn't do anything for AP_SIG_GRACEFUL.
+ /* The child process doesn't do anything for SIGUSR1.
* Instead, the pod is used for signalling graceful restart.
*/
- apr_signal(AP_SIG_GRACEFUL, SIG_IGN);
+ apr_signal(SIGUSR1, SIG_IGN);
child_main(slot);
}
@@ -947,7 +947,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens pretty
+ * below (because we just sent them SIGUSR1). This happens pretty
* rapidly... and for each one that exits we'll start a new one until
* we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
Index: server/mpm/beos/beos.c
===================================================================
--- server/mpm/beos/beos.c (revision 225483)
+++ server/mpm/beos/beos.c (working copy)
@@ -108,7 +108,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We use
+ * to deal with MaxClients changes across graceful restarts. We use
* this value to optimize routines that have to scan the entire scoreboard.
*/
int ap_max_child_assigned = -1;
@@ -226,7 +226,7 @@
static void restart(int sig)
{
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
}
/* Handle queries about our inner workings... */
@@ -385,15 +385,15 @@
if (sigaction(SIGPIPE, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGPIPE)");
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGUSR1)");
}
/*****************************************************************
@@ -904,7 +904,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of threads exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens
+ * below (because we just sent them SIGUSR1). This happens
* pretty rapidly... and for each one that exits we'll start a new one
* until we reach at least threads_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1003,7 +1003,7 @@
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
- AP_SIG_GRACEFUL_STRING " received. Doing graceful
restart");
+ "SIGUSR1 received. Doing graceful restart");
} else {
/* Kill 'em all. Since the child acts the same on the parents SIGTERM
* and a SIGHUP, we may as well use the same signal, because some user
Index: server/mpm/worker/worker.c
===================================================================
--- server/mpm/worker/worker.c (revision 225483)
+++ server/mpm/worker/worker.c (working copy)
@@ -157,7 +157,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with MaxClients changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire
* scoreboard.
*/
@@ -406,7 +406,7 @@
static void restart(int sig)
{
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
}
static void set_signals(void)
@@ -451,17 +451,17 @@
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
- "sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ "sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -476,9 +476,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -1676,7 +1676,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens pretty
+ * below (because we just sent them SIGUSR1). This happens pretty
* rapidly... and for each one that exits we'll start a new one until
* we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1755,7 +1755,7 @@
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
- AP_SIG_GRACEFUL_STRING " received. Doing graceful
restart");
+ "SIGUSR1 received. Doing graceful restart");
/* wake up the children...time to die. But we'll have more soon */
ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
Index: server/mpm/experimental/threadpool/threadpool.c
===================================================================
--- server/mpm/experimental/threadpool/threadpool.c (revision 225483)
+++ server/mpm/experimental/threadpool/threadpool.c (working copy)
@@ -154,7 +154,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with MaxClients changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire
* scoreboard.
*/
@@ -566,7 +566,7 @@
static void restart(int sig)
{
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
}
static void set_signals(void)
@@ -611,17 +611,17 @@
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
- "sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ "sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -636,9 +636,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -1756,7 +1756,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens pretty
+ * below (because we just sent them SIGUSR1). This happens pretty
* rapidly... and for each one that exits we'll start a new one until
* we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1835,7 +1835,7 @@
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
- AP_SIG_GRACEFUL_STRING " received. Doing graceful
restart");
+ "SIGUSR1 received. Doing graceful restart");
/* wake up the children...time to die. But we'll have more soon */
ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
Index: server/mpm/experimental/event/event.c
===================================================================
--- server/mpm/experimental/event/event.c (revision 225483)
+++ server/mpm/experimental/event/event.c (working copy)
@@ -204,7 +204,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with MaxClients changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire
* scoreboard.
*/
@@ -448,7 +448,7 @@
static void restart(int sig)
{
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
}
static void set_signals(void)
@@ -493,17 +493,17 @@
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
- "sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ "sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -518,9 +518,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -1892,7 +1892,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens pretty
+ * below (because we just sent them SIGUSR1). This happens pretty
* rapidly... and for each one that exits we'll start a new one until
* we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1966,8 +1966,7 @@
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
- AP_SIG_GRACEFUL_STRING
- " received. Doing graceful restart");
+ "SIGUSR1 received. Doing graceful restart");
/* wake up the children...time to die. But we'll have more soon */
ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
Index: server/mpm/experimental/perchild/perchild.c
===================================================================
--- server/mpm/experimental/perchild/perchild.c (revision 225483)
+++ server/mpm/experimental/perchild/perchild.c (working copy)
@@ -166,7 +166,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with NumServers changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with NumServers changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire child
* table.
*
@@ -351,7 +351,7 @@
static void restart(int sig)
{
#ifndef WIN32
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
#else
ap_start_restart(1);
#endif
@@ -399,17 +399,17 @@
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
- "sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ "sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -424,9 +424,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -1295,7 +1295,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens
+ * below (because we just sent them SIGUSR1). This happens
* pretty rapidly... and for each one that exits we'll start a new one
* until we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1365,9 +1365,8 @@
if (is_graceful) {
char char_of_death = '!';
- ap_log_error(APLOG_MARK, APLOG_NOTICE, 0,
- ap_server_conf, AP_SIG_GRACEFUL_STRING " received. "
- "Doing graceful restart");
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
+ "SIGUSR1 received. Doing graceful restart");
/* This is mostly for debugging... so that we know what is still
* gracefully dealing with existing request.
Index: server/mpm/experimental/leader/leader.c
===================================================================
--- server/mpm/experimental/leader/leader.c (revision 225483)
+++ server/mpm/experimental/leader/leader.c (working copy)
@@ -149,7 +149,7 @@
/*
* The max child slot ever assigned, preserved across restarts. Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
+ * to deal with MaxClients changes across graceful restarts. We
* use this value to optimize routines that have to scan the entire
* scoreboard.
*/
@@ -495,7 +495,7 @@
static void restart(int sig)
{
- ap_start_restart(sig == AP_SIG_GRACEFUL);
+ ap_start_restart(sig == SIGUSR1);
}
static void set_signals(void)
@@ -540,17 +540,17 @@
"sigaction(SIGPIPE)");
#endif
- /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
+ /* we want to ignore HUPs and USR1 while we're busy
* processing one */
sigaddset(&sa.sa_mask, SIGHUP);
- sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
+ sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
"sigaction(SIGHUP)");
- if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
- "sigaction(" AP_SIG_GRACEFUL_STRING ")");
+ "sigaction(SIGUSR1)");
#else
if (!one_process) {
#ifdef SIGXCPU
@@ -565,9 +565,9 @@
#ifdef SIGHUP
apr_signal(SIGHUP, restart);
#endif /* SIGHUP */
-#ifdef AP_SIG_GRACEFUL
- apr_signal(AP_SIG_GRACEFUL, restart);
-#endif /* AP_SIG_GRACEFUL */
+#ifdef AP_ENABLE_GRACEFUL
+ apr_signal(SIGUSR1, restart);
+#endif /* AP_ENABLE_GRACEFUL */
#ifdef SIGPIPE
apr_signal(SIGPIPE, SIG_IGN);
#endif /* SIGPIPE */
@@ -1507,7 +1507,7 @@
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop
- * below (because we just sent them AP_SIG_GRACEFUL). This happens pretty
+ * below (because we just sent them SIGUSR1). This happens pretty
* rapidly... and for each one that exits we'll start a new one until
* we reach at least daemons_min_free. But we may be permitted to
* start more than that, so we'll just keep track of how many we're
@@ -1588,7 +1588,7 @@
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
- AP_SIG_GRACEFUL_STRING " received. Doing graceful
restart");
+ "SIGUSR1 received. Doing graceful restart");
/* wake up the children...time to die. But we'll have more soon */
ap_mpm_pod_killpg(pod, ap_daemons_limit);
Index: server/mpm_common.c
===================================================================
--- server/mpm_common.c (revision 225483)
+++ server/mpm_common.c (working copy)
@@ -351,7 +351,7 @@
switch (signum) {
case SIGTERM:
case SIGHUP:
- case AP_SIG_GRACEFUL:
+ case SIGUSR1:
case SIGKILL:
break;
@@ -905,6 +905,7 @@
}
if (!strcmp(dash_k_arg, "graceful")) {
+#ifdef AP_ENABLE_GRACEFUL
if (!running) {
printf("httpd not running, trying to start\n");
}
@@ -912,6 +913,9 @@
*exit_status = send_signal(otherpid, SIGUSR1);
return 1;
}
+#else
+ printf("graceful restart not supported on this platform\n");
+#endif /* AP_ENABLE_GRACEFUL */
}
return 0;
Index: server/log.c
===================================================================
--- server/log.c (revision 225483)
+++ server/log.c (working copy)
@@ -687,7 +687,7 @@
mypid = getpid();
if (mypid != saved_pid
&& apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) {
- /* AP_SIG_GRACEFUL and HUP call this on each restart.
+ /* USR1 and HUP call this on each restart.
* Only warn on first time through for this pid.
*
* XXX: Could just write first time through too, although
Index: modules/mappers/mod_so.c
===================================================================
--- modules/mappers/mod_so.c (revision 225483)
+++ modules/mappers/mod_so.c (working copy)
@@ -17,8 +17,8 @@
/*
* This module is used to load Apache modules at runtime. This means that the
* server functionality can be extended without recompiling and even without
- * taking the server down at all. Only a HUP or AP_SIG_GRACEFUL signal
- * needs to be sent to the server to reload the dynamically loaded modules.
+ * taking the server down at all. Only a HUP or USR1 signal needs to be sent
+ * to the server to reload the dynamically loaded modules.
*
* To use, you'll first need to build your module as a shared library, then
* update your configuration (httpd.conf) to get the Apache core to load the
@@ -56,9 +56,9 @@
* directive to get these log messages).
*
* If you edit the LoadModule directives while the server is live you can get
- * Apache to re-load the modules by sending it a HUP or AP_SIG_GRACEFUL
- * signal as normal. You can use this to dynamically change the capability
- * of your server without bringing it down.
+ * Apache to re-load the modules by sending it a HUP or USR1 signal as normal.
+ * You can use this to dynamically change the capability of your server
+ * without bringing it down.
*
* Because currently there is only limited builtin support in the Configure
* script for creating the shared library files (`.so'), please consult your
Index: configure.in
===================================================================
--- configure.in (revision 225483)
+++ configure.in (working copy)
@@ -232,7 +232,7 @@
APACHE_SUBST(SHLTCFLAGS)
APACHE_SUBST(LTCFLAGS)
-AP_SIG_GRACEFUL=USR1
+graceful_enabled="yes"
case $host in
*-apple-aux3*)
@@ -250,7 +250,7 @@
*-linux-*)
case `uname -r` in
2.0* )
- AP_SIG_GRACEFUL=WINCH
+ graceful_enabled="no"
;;
2.[[2-9]]* )
APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
@@ -290,6 +290,10 @@
;;
esac
+if test "$graceful_enabled" = "yes" ; then
+ AC_DEFINE(AP_ENABLE_GRACEFUL, 1, [Allow graceful restarts])
+fi
+
APR_SETVAR(AP_NONBLOCK_WHEN_MULTI_LISTEN, [1])
dnl
@@ -575,14 +579,6 @@
[Listening sockets are non-blocking when there are more than 1])
fi
-AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL, SIG$AP_SIG_GRACEFUL, [Signal used to
gracefully restart])
-AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL_STRING, "SIG$AP_SIG_GRACEFUL", [Signal used
to gracefully restart (as a quoted string)])
-AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL_SHORT, $AP_SIG_GRACEFUL, [Signal used to
gracefully restart (without SIG prefix)])
-AP_SIG_GRACEFUL_SHORT=$AP_SIG_GRACEFUL
-AP_SIG_GRACEFUL=SIG$AP_SIG_GRACEFUL_SHORT
-AC_SUBST(AP_SIG_GRACEFUL)
-AC_SUBST(AP_SIG_GRACEFUL_STRING)
-AC_SUBST(AP_SIG_GRACEFUL_SHORT)
APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile)
APACHE_FAST_OUTPUT(os/Makefile server/Makefile)