void ap_reclaim_child_processes(int terminate);
void ap_wait_or_timeout(ap_wait_t *status, ap_proc_t *ret, ap_pool_t *p);
+void ap_process_child_status(ap_proc_t *pid, ap_wait_t status);
#define AP_MPM_HARD_LIMITS_FILE "src/" APACHE_MPM_DIR "/mpm_default.h"
-/* ====================================================================
+ap_/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
*/
int ap_max_child_assigned = -1;
int ap_max_threads_limit = -1;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
static port_id port_of_death;
/* shared http_main globals... */
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
}
-static void process_child_status(int 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 %d returned a Fatal error... \n"
- "Apache is exiting!",
- 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 %d exit signal %s (%d), "
- "possible coredump in %s",
- 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 %d exit signal %s (%d)", 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 %d exit signal %d",
- pid, WTERMSIG(status));
-#endif
- }
- }
-}
-
static int setup_listeners(server_rec *s)
{
ap_listen_rec *lr;
ap_wait_or_timeout(&status, &pid, pconf);
if (pid.pid >= 0) {
- process_child_status(pid.pid, status);
+ ap_process_child_status(pid.pid, status);
/* non-fatal death... note that it's gone in the scoreboard. */
child_slot = -1;
for (i = 0; i < ap_max_child_assigned; ++i) {
extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
extern server_rec *ap_server_conf;
-
+extern char ap_coredump_dir[MAX_STRING_LEN];
#endif /* APACHE_MPM_BEOS_H */
*/
int ap_max_daemons_limit = -1;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
static ap_file_t *pipe_of_death_in = NULL;
static ap_file_t *pipe_of_death_out = NULL;
#endif
}
-static void 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
- }
- }
-}
-
static int setup_listeners(server_rec *s)
{
ap_listen_rec *lr;
ap_wait_or_timeout(&status, &pid, pconf);
if (pid.pid != -1) {
- process_child_status(&pid, status);
+ ap_process_child_status(&pid, status);
/* non-fatal death... note that it's gone in the child table and
* clean out the status table. */
child_slot = -1;
extern int ap_max_daemons_limit;
extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
extern server_rec *ap_server_conf;
+extern char ap_coredump_dir[MAX_STRING_LEN];
+
#endif /* APACHE_MPM_DEXTER_H */
extern int ap_max_daemons_limit;
extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
extern server_rec *ap_server_conf;
+extern char ap_coredump_dir[MAX_STRING_LEN];
#endif /* APACHE_MPM_MPMT_BEOS_H */
* value to optimize routines that have to scan the entire scoreboard.
*/
int ap_max_daemons_limit = -1;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
port_id port_of_death;
/* shared http_main globals... */
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
}
-static void process_child_status(int 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, errno, ap_server_conf,
- "Child %d returned a Fatal error... \n"
- "Apache is exiting!",
- 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,
- errno, ap_server_conf,
- "child pid %d exit signal %s (%d), "
- "possible coredump in %s",
- pid, (WTERMSIG(status) >= NumSIG) ? "" :
- SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
- ap_coredump_dir);
- }
- else {
-#endif
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
- errno, ap_server_conf,
- "child pid %d exit signal %s (%d)", pid,
- SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
-#ifdef WCOREDUMP
- }
-#endif
-#else
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
- errno, ap_server_conf,
- "child pid %d exit signal %d",
- pid, WTERMSIG(status));
-#endif
- }
- }
-}
-
static int setup_listeners(server_rec *s)
{
ap_listen_rec *lr;
ap_wait_or_timeout(&status, &pid, pconf);
if (pid.pid >= 0) {
- process_child_status(pid.pid, status);
+ ap_process_child_status(pid.pid, status);
/* non-fatal death... note that it's gone in the scoreboard. */
child_slot = -1;
for (i = 0; i < ap_max_daemons_limit; ++i) {
extern server_rec *ap_server_conf;
extern scoreboard *ap_scoreboard_image;
extern void clean_child_exit(int);
+extern char ap_coredump_dir[MAX_STRING_LEN];
#endif /* APACHE_MPM_MPMT_PTHREAD_H */
*/
int ap_max_daemons_limit = -1;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
static ap_file_t *pipe_of_death_in = NULL;
static ap_file_t *pipe_of_death_out = NULL;
#endif
}
-static void 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
- }
- }
-}
-
static int setup_listeners(server_rec *s)
{
ap_listen_rec *lr;
ap_wait_or_timeout(&status, &pid, pconf);
if (pid.pid != -1) {
- process_child_status(&pid, status);
+ ap_process_child_status(&pid, status);
/* non-fatal death... note that it's gone in the scoreboard. */
child_slot = find_child_by_pid(&pid);
if (child_slot >= 0) {
extern scoreboard *ap_scoreboard_image;
extern server_rec *ap_server_conf;
extern int ap_my_pid;
+extern char ap_coredump_dir[MAX_STRING_LEN];
#endif /* APACHE_MPM_DEXTER_H */
int ap_max_daemons_limit = -1;
server_rec *ap_server_conf;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
/* *Non*-shared http_main globals... */
}
}
-
-static void 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
- }
- }
-}
-
-
static int setup_listeners(server_rec *s)
{
ap_listen_rec *lr;
* extra child
*/
if (pid.pid != -1) {
- process_child_status(&pid, status);
+ ap_process_child_status(&pid, status);
/* non-fatal death... note that it's gone in the scoreboard. */
ap_sync_scoreboard_image();
child_slot = find_child_by_pid(&pid);
#define SPMT_OS2_MPM
+extern char ap_coredump_dir[MAX_STRING_LEN];
+
#endif /* APACHE_MPM_DEXTER_H */
*/
static int max_daemons_limit = -1;
-static char ap_coredump_dir[MAX_STRING_LEN];
+char ap_coredump_dir[MAX_STRING_LEN];
/* *Non*-shared http_main globals... */
}
-static void process_child_status(int tid, 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, server_conf,
- "Child %d returned a Fatal error... \n"
- "Apache is exiting!",
- tid);
- 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,
- server_conf,
- "child tid %d exit signal %s (%d), "
- "possible coredump in %s",
- tid, (WTERMSIG(status) >= NumSIG) ? "" :
- SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
- ap_coredump_dir);
- }
- else {
-#endif
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0,
- server_conf,
- "child tid %d exit signal %s (%d)", tid,
- SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
-#ifdef WCOREDUMP
- }
-#endif
-#else
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0,
- server_conf,
- "child tid %d exit signal %d",
- tid, WTERMSIG(status));
-#endif
- }
- }
-}
-
-
/*****************************************************************
* Executive routines.
*/
* extra child
*/
if (tid >= 0) {
- process_child_status(tid, status);
+ ap_process_child_status(tid, status);
/* non-fatal death... note that it's gone in the scoreboard. */
child_slot = find_child_by_tid(tid);
if (child_slot >= 0) {
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
+ }
+ }
+}
+