case 6: /* 344ms */
case 7: /* 1.4sec */
/* ok, now it's being annoying */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno,
server_conf,
"child process %d still did not exit, sending a SIGTERM",
pid);
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_flags = SA_RESETHAND;
#endif
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)");
#ifdef SIGBUS
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)");
#endif
#ifdef SIGABORT
if (sigaction(SIGABORT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABORT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
#endif
#ifdef SIGABRT
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)");
#endif
#ifdef SIGILL
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)");
#endif
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)");
#ifdef SIGINT
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)");
#endif
#ifdef SIGXCPU
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXCPU, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXCPU)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
#endif
#ifdef SIGXFSZ
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXFSZ, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXFSZ)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
#endif
#ifdef SIGPIPE
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)");
#endif
/* we want to ignore HUPs and WINCH while we're busy processing one */
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)");
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
*/
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 SYS_SIGLIST
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
server_conf,
"child pid %d exit signal %s (%d), "
"possible coredump in %s",
}
else {
#endif
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
server_conf,
"child pid %d exit signal %s (%d)", pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
}
#endif
#else
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
server_conf,
"child pid %d exit signal %d",
pid, WTERMSIG(status));
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
sizeof(int)) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"setsockopt: (TCP_NODELAY)");
}
}
ap_iol *iol;
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");
close(csd);
return;
}
iol = unix_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");
}
close(csd);
if (worker_thread_count < max_threads) {
if (pthread_create(&thread, &worker_thread_attr, worker_thread,
&worker_thread_free_ids[worker_thread_count])) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
"pthread_create: 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
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 MaxThreadsPerChild setting, consider raising the"
" MaxThreadsPerChild or NumServers settings");
reported = 1;
/* 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;
}
sigfillset(&sig_mask);
if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask");
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
+ "pthread_sigmask");
}
requests_this_child = max_requests_per_child;
just_die(signal_received);
break;
default:
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
"received impossible signal: %d", signal_received);
just_die(SIGTERM);
}
}
if ((pid = fork()) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, s,
+ "fork: 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. */
int status = bindprocessor(BINDPROCESS, (int)getpid(),
PROCESSOR_CLASS_ANY);
if (status != OK)
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf,
- "processor unbind failed %d", status);
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno,
+ server_conf, "processor unbind failed %d", status);
#endif
RAISE_SIGSTOP(MAKE_CHILD);
* child table. 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,
pconf = _pconf;
server_conf = s;
if (pipe(pipe_of_death) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno,
(const server_rec*) server_conf,
"pipe: (pipe_of_death)");
exit(1);
ap_register_cleanup(pconf, &pipe_of_death[0], cleanup_fd, cleanup_fd);
ap_register_cleanup(pconf, &pipe_of_death[1], cleanup_fd, cleanup_fd);
if (fcntl(pipe_of_death[0], F_SETFD, O_NONBLOCK) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno,
(const server_rec*) server_conf,
"fcntl: O_NONBLOCKing (pipe_of_death)");
exit(1);
server_conf = 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;
}
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 */
const char *pidfile = NULL;
pidfile = ap_server_root_relative (pconf, ap_pid_fname);
if ( pidfile != NULL && unlink(pidfile) == 0)
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno,
server_conf,
"removed PID file %s (pid=%ld)",
pidfile, (long)getpid());
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
- "caught SIGTERM, shutting down");
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
+ server_conf, "caught SIGTERM, shutting down");
return 1;
}
if (is_graceful) {
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");
/* This is mostly for debugging... so that we know what is still
for (i = 0; i < num_daemons;) {
if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
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,
- "SIGHUP received. Attempting to restart");
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
+ server_conf, "SIGHUP received. Attempting to restart");
}
return 0;
}
if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) {
#ifdef LINUX
if (errno == ENOSYS) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno,
+ server_conf,
"Your kernel was built without CONFIG_SYSVIPC\n"
"%s: Please consult the Apache FAQ for details",
ap_server_argv0);
}
#endif
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"could not call shmget");
exit(APEXIT_INIT);
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, server_conf,
"created shared memory segment #%d", shmid);
#ifdef MOVEBREAK
* attach the segment and then move break back down. Ugly
*/
if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"sbrk() could not move break");
}
#endif
#define BADSHMAT ((scoreboard *)(-1))
if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) {
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error");
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
+ "shmat error");
/*
* We exit below, after we try to remove the segment
*/
}
else { /* only worry about permissions if we attached the segment */
if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not stat segment #%d", shmid);
}
else {
shmbuf.shm_perm.uid = unixd_config.user_id;
shmbuf.shm_perm.gid = unixd_config.group_id;
if (shmctl(shmid, IPC_SET, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not set segment #%d", shmid);
}
}
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"shmctl: IPC_RMID: could not remove shared memory segment #%d",
shmid);
}
if (obrk == (char *) -1)
return; /* nothing else to do */
if (sbrk(-(MOVEBREAK)) == (char *) -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"sbrk() could not move break back");
}
#endif