summaryrefslogtreecommitdiffstats
path: root/server/mpm_common.c
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2000-07-10 20:21:24 +0200
committerRyan Bloom <rbb@apache.org>2000-07-10 20:21:24 +0200
commit074e3c2fb425f6d94936443e292f9f4bd2bec608 (patch)
treee2f915502587d46aabe87c56c09cba0a8e2f82c2 /server/mpm_common.c
parentStop doing the find for make clean. This was causing us to clean every (diff)
downloadapache2-074e3c2fb425f6d94936443e292f9f4bd2bec608.tar.xz
apache2-074e3c2fb425f6d94936443e292f9f4bd2bec608.zip
Move process_child_status to mpm_common.c. This requires re-naming it
to ap_process_child_status and opening up ap_coredump_dir. I have modified all of the MPMs that I saw using this function to work with this patch. Sorry if I broke anybody. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85808 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm_common.c')
-rw-r--r--server/mpm_common.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/server/mpm_common.c b/server/mpm_common.c
index 3613ccaa0e..9f2923a843 100644
--- a/server/mpm_common.c
+++ b/server/mpm_common.c
@@ -224,4 +224,56 @@ void ap_wait_or_timeout(ap_wait_t *status, ap_proc_t *ret, ap_pool_t *p)
return;
}
+void ap_process_child_status(ap_proc_t *pid, ap_wait_t status)
+{
+ /* Child died... if it died due to a fatal error,
+ * we should simply bail out.
+ */
+ if ((WIFEXITED(status)) &&
+ WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
+ "Child %ld returned a Fatal error... \n"
+ "Apache is exiting!",
+ (long)pid->pid);
+ exit(APEXIT_CHILDFATAL);
+ }
+ if (WIFSIGNALED(status)) {
+ switch (WTERMSIG(status)) {
+ case SIGTERM:
+ case SIGHUP:
+ case SIGUSR1:
+ case SIGKILL:
+ break;
+ default:
+#ifdef SYS_SIGLIST
+#ifdef WCOREDUMP
+ if (WCOREDUMP(status)) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ 0, ap_server_conf,
+ "child pid %ld exit signal %s (%d), "
+ "possible coredump in %s",
+ (long)pid->pid, (WTERMSIG(status) >= NumSIG) ? "" :
+ SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
+ ap_coredump_dir);
+ }
+ else {
+#endif
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ 0, ap_server_conf,
+ "child pid %ld exit signal %s (%d)",
+ (long)pid->pid,
+ SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
+#ifdef WCOREDUMP
+ }
+#endif
+#else
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ 0, ap_server_conf,
+ "child pid %ld exit signal %d",
+ (long)pid->pid, WTERMSIG(status));
+#endif
+ }
+ }
+}
+