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);
* 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;
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)
*/
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);
#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) ? "" :
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
#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
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;
}
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);
/* 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;
}
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);
}
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
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. */
/* 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;
}
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;
/* 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), "
* 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,
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;
}
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;
* 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 */
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;
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++;
}
* 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) {