ap_file_t *f;
struct stat finfo;
- ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r,
"%s: %s", error, r->filename);
if (!conf->logname ||
* on Unix, thanks to the magic of fork().
*/
while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, errno, r,
"%s", argsbuffer);
}
#else
(ap_setprocattr_dir(procattr, ap_make_dirstr_parent(r->pool, r->filename)) != APR_SUCCESS) ||
(ap_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) {
/* Something bad happened, tell the world. */
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"couldn't create child process: %s", r->filename);
rc = !APR_SUCCESS;
}
if (rc != APR_SUCCESS) {
/* Bad things happened. Everyone should have cleaned up. */
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"couldn't create child process: %d: %s", rc, r->filename);
}
else {
fileType = ap_get_win32_interpreter(r, &interpreter);
if (fileType == eFileTypeUNKNOWN) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, errno, r,
"%s is not executable; ensure interpreted scripts have "
"\"#!\" first line",
r->filename);
/* build the command line */
if (build_command_line(&command, r, p) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"couldn't spawn child process: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
/* build the argument list */
else if (build_argv_list(&argv, r, p) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"couldn't spawn child process: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
/* run the script in its own process */
else if (run_cgi_child(&script_out, &script_in, &script_err, command, &argv, r, p) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"couldn't spawn child process: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
int rc = DosOpenMutexSem(NULL, &lock_sem);
if (rc != 0) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"Child cannot open lock semaphore, rc=%d", rc);
clean_child_exit(APEXIT_CHILDINIT);
} else {
int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE);
if (rc != 0) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"Parent cannot create lock semaphore, rc=%d", rc);
exit(APEXIT_INIT);
}
int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT);
if (rc != 0) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"OS2SEM: Error %d getting accept lock. Exiting!", rc);
clean_child_exit(APEXIT_CHILDFATAL);
}
int rc = DosReleaseMutexSem(lock_sem);
if (rc != 0) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"OS2SEM: Error %d freeing accept lock. Exiting!", rc);
clean_child_exit(APEXIT_CHILDFATAL);
}
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 USR1 while we're busy processing one */
sigaddset(&sa.sa_mask, SIGUSR1);
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(SIGUSR1, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGUSR1)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGUSR1)");
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
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)");
}
}
* on Linux 2.0.x we seem to end up with EFAULT
* occasionally, and we'd loop forever due to it.
*/
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "select: (listen)");
clean_child_exit(1);
}
#endif
break;
default:
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, server_conf,
"accept: (client socket)");
clean_child_exit(1);
}
ap_get_os_sock(&sockdes, csd);
clen = sizeof(sa_server);
if (getsockname(sockdes, &sa_server, &clen) < 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname");
ap_close_socket(csd);
continue;
}
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, 0, NULL,
"filedescriptor (%u) larger than FD_SETSIZE (%u) "
"found, you probably need to rebuild Apache with a "
"larger FD_SETSIZE", sockdes, FD_SETSIZE);
}
else {
- ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
"error attaching to socket");
}
ap_close_socket(csd);
ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL);
if ((tid = _beginthread(child_main, NULL, 65536, (void *)slot)) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, s, "_beginthread: Unable to create new thread");
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s, "_beginthread: Unable to create new thread");
/* _beginthread didn't succeed. Fix the scoreboard or else
* it will say SERVER_STARTING forever and ever
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, 0, server_conf,
"server reached MaxClients setting, consider"
" raising the MaxClients setting");
reported = 1;
}
else {
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, 0, server_conf,
"server seems busy, (you may need "
"to increase StartServers, or Min/MaxSpareServers), "
"spawning %d children, there are %d idle, and "
*/
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, 0, server_conf,
"Child %d returned a Fatal error... \n"
"Apache is exiting!",
tid);
#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, 0,
server_conf,
"child tid %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, 0,
server_conf,
"child tid %d exit signal %s (%d)", tid,
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, 0,
server_conf,
"child tid %d exit signal %d",
tid, WTERMSIG(status));
{
int remaining_children_to_start;
int i;
+ ap_status_t status;
pconf = _pconf;
server_conf = s;
ap_log_pid(pconf, ap_pid_fname);
- if (ap_listen_open(s->process, s->port)) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
+ if ((status = ap_listen_open(s->process, s->port)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, status, s,
"no listening sockets available, shutting down");
return -1;
}
if (ppthread_globals == NULL) {
if (DosAllocThreadLocalMemory(1, (PULONG *)&ppthread_globals)) {
- ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server_conf,
"Error allocating thread local storage"
"Apache is exiting!");
} else {
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, 0, 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, 0, server_conf,
"Server built: %s", ap_get_server_built());
restart_pending = shutdown_pending = 0;
* 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, 0, server_conf,
"long lost child came home! (tid %d)", tid);
}
/* Don't perform idle maintenance when a child dies,
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, 0,
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, 0, server_conf,
"caught SIGTERM, shutting down");
return 1;
}
++ap_scoreboard_image->global.running_generation;
if (is_graceful) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGUSR1 received. Doing graceful restart");
/* kill off the idle ones */
for (i = 0; i < ap_daemons_limit; ++i) {
DosKillThread(ap_scoreboard_image->parent[i].tid);
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGHUP received. Attempting to restart");
}