From 09b7396a2559308ce5ce18d132d60d0f8fd67fe4 Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 22 Oct 1999 11:28:33 +0000 Subject: [PATCH] Bring the BeOS mpm up to date with the error logging changes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84021 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/mpmt_beos/mpmt_beos.c | 79 +++++++++++++++++--------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index db501c1b8e..aa297e432f 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -344,14 +344,14 @@ static void reclaim_child_processes(int terminate) case 7: /* 1.4sec */ /* ok, now it's being annoying */ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - server_conf, + errno, server_conf, "child process %d still did not exit, sending a SIGTERM", pid); kill(pid, SIGTERM); break; case 8: /* 6 sec */ /* die child scum */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno, server_conf, "child process %d still did not exit, sending a SIGKILL", pid); kill(pid, SIGKILL); @@ -362,7 +362,7 @@ static void reclaim_child_processes(int terminate) * exited, we will likely fail to bind to the port * after the restart. */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno, server_conf, "could not make child process %d exit, " "attempting to continue anyway", pid); break; @@ -526,33 +526,33 @@ static void set_signals(void) sa.sa_handler = sig_coredump; if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGSEGV)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)"); if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGBUS)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)"); if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABRT)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)"); if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGILL)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)"); sa.sa_flags = 0; } sa.sa_handler = sig_term; if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGTERM)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)"); if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGINT)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)"); sa.sa_handler = SIG_IGN; if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGPIPE)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)"); /* we want to ignore HUPs and WINCH while we're busy processing one */ sigaddset(&sa.sa_mask, SIGHUP); sigaddset(&sa.sa_mask, SIGWINCH); sa.sa_handler = restart; if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGHUP)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)"); if (sigaction(SIGWINCH, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGWINCH)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGWINCH)"); } static void process_child_status(int pid, ap_wait_t status) @@ -562,7 +562,7 @@ static void process_child_status(int pid, ap_wait_t status) */ if ((WIFEXITED(status)) && WEXITSTATUS(status) == APEXIT_CHILDFATAL) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf, + ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, errno, server_conf, "Child %d returned a Fatal error... \n" "Apache is exiting!", pid); @@ -580,7 +580,7 @@ static void process_child_status(int pid, ap_wait_t status) #ifdef WCOREDUMP if (WCOREDUMP(status)) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, + errno, server_conf, "child pid %d exit signal %s (%d), " "possible coredump in %s", pid, (WTERMSIG(status) >= NumSIG) ? "" : @@ -590,7 +590,7 @@ static void process_child_status(int pid, ap_wait_t status) else { #endif ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, + errno, server_conf, "child pid %d exit signal %s (%d)", pid, SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status)); #ifdef WCOREDUMP @@ -598,7 +598,7 @@ static void process_child_status(int pid, ap_wait_t status) #endif #else ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, + errno, server_conf, "child pid %d exit signal %d", pid, WTERMSIG(status)); #endif @@ -645,7 +645,7 @@ static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num; if (getsockname(csd, &sa_server, &len) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); + ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname"); closesocket(csd); return; } @@ -655,13 +655,13 @@ static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, iol = beos_attach_socket(csd); if (iol == NULL) { if (errno == EBADF) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, NULL, "filedescriptor (%u) larger than FD_SETSIZE (%u) " "found, you probably need to rebuild Apache with a " "larger FD_SETSIZE", csd, FD_SETSIZE); } else { - ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL, "error attaching to socket"); } closesocket(csd); @@ -731,7 +731,7 @@ static int32 worker_thread(void * dummy) /* poll() will only return errors in catastrophic * circumstances. Let's try exiting gracefully, for now. */ - ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec *) + ap_log_error(APLOG_MARK, APLOG_ERR,errno, (const server_rec *) ap_get_server_conf(), "poll: (listen)"); workers_may_exit = 1; } @@ -845,7 +845,7 @@ static int32 child_main(void * data) my_info = (proc_info *)malloc(sizeof(proc_info)); if (my_info == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, + ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "malloc: out of memory"); clean_child_exit(APEXIT_CHILDFATAL); } @@ -860,7 +860,7 @@ static int32 child_main(void * data) if ((thread = spawn_thread(worker_thread, "httpd_worker_thread", B_NORMAL_PRIORITY, my_info)) < B_NO_ERROR) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, + ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "spawn_thread: unable to create worker thread"); /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and @@ -903,7 +903,8 @@ static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */ tid = spawn_thread(child_main, "httpd_child", B_NORMAL_PRIORITY, (void*)slot); if (tid < B_NO_ERROR) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, "spawn_thread: Unable to fork new process"); + ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, + "spawn_thread: Unable to fork new process"); /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again. */ @@ -1020,7 +1021,8 @@ static void perform_idle_server_maintenance(void) /* Kill off one child */ char char_of_death = '!'; if (write_port(port_of_death, 99, &char_of_death, 1) != B_OK) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, + "write pipe_of_death"); } idle_spawn_rate = 1; } @@ -1031,7 +1033,7 @@ static void perform_idle_server_maintenance(void) static int reported = 0; if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno, server_conf, "server reached MaxClients setting, consider" " raising the MaxClients setting"); reported = 1; @@ -1042,7 +1044,7 @@ static void perform_idle_server_maintenance(void) /* ZZZZ */ if (idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, server_conf, "server seems busy, (you may need " "to increase StartServers, ThreadsPerChild " "or Min/MaxSparetThreads), " @@ -1107,7 +1109,7 @@ static void server_main_loop(int remaining_children_to_start) * scoreboard. Somehow we don't know about this * child. */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, server_conf, "long lost child came home! (pid %d)", pid); } /* Don't perform idle maintenance when a child dies, @@ -1145,7 +1147,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) if ((num_listenfds = setup_listeners(server_conf)) < 1) { /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, errno, s, "no listening sockets available, shutting down"); return 1; } @@ -1182,10 +1184,10 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) hold_off_on_exponential_spawning = 10; } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf, "%s configured -- resuming normal operations", ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, server_conf, "Server built: %s", ap_get_server_built()); restart_pending = shutdown_pending = 0; @@ -1196,7 +1198,8 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) * Kill child processes, tell them to call child_exit, etc... */ if (ap_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, + "killpg SIGTERM"); } reclaim_child_processes(1); /* Start with SIGTERM */ @@ -1206,12 +1209,12 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) pidfile = ap_server_root_relative (pconf, ap_pid_fname); if ( pidfile != NULL && unlink(pidfile) == 0) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - server_conf, + errno, server_conf, "removed PID file %s (pid=%ld)", pidfile, (long)getpid()); } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf, "caught SIGTERM, shutting down"); return 1; @@ -1237,14 +1240,15 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) int i, j; char char_of_death = '!'; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf, "SIGWINCH received. Doing graceful restart"); /* give the children the signal to die */ for (i = 0; i < ap_daemons_limit;) { if (write_port(port_of_death, 99, &char_of_death, 1) != B_OK) { if (errno == EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, + "write pipe_of_death"); } i++; } @@ -1267,10 +1271,11 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) * pthreads are stealing signals from us left and right. */ if (ap_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM"); + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, + "killpg SIGTERM"); } reclaim_child_processes(1); /* Start with SIGTERM */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf, "SIGHUP received. Attempting to restart"); } if (!is_graceful) { -- 2.40.0