#endif
if ((stat = apr_bind(s, server->bind_addr)) != APR_SUCCESS) {
- ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
+ ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, stat, p,
"make_sock: could not bind to address %pI",
server->bind_addr);
apr_socket_close(s);
}
if ((stat = apr_listen(s, ap_listenbacklog)) != APR_SUCCESS) {
- ap_log_perror(APLOG_MARK, APLOG_ERR, stat, p,
+ ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_ERR, stat, p,
"make_sock: unable to listen for connections on address %pI",
server->bind_addr);
apr_socket_close(s);
destroy_and_exit_process(process, 0);
}
apr_pool_clear(plog);
+ /* It is assumed that if you are going to fail the open_logs phase, then
+ * you will print out your own message that explains what has gone wrong.
+ * The server doesn't need to do that for you.
+ */
if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
- ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR| APLOG_NOERRNO, 0, NULL, "Unable to open logs\n");
destroy_and_exit_process(process, 1);
}
if ( ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
{
int index;
int remaining_children_to_start;
- apr_status_t rv;
- pconf = _pconf;
- ap_server_conf = s;
first_server_limit = server_limit;
if (changed_limit_at_restart) {
ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, 0, s,
changed_limit_at_restart = 0;
}
- if ((num_listensocks = ap_setup_listeners(ap_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, 0, s,
- "no listening sockets available, shutting down");
- return 1;
- }
-
- ap_log_pid(pconf, ap_pid_fname);
-
- if ((rv = ap_mpm_pod_open(pconf, &pod))) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
- "Could not open pipe-of-death.");
- return 1;
- }
-
SAFE_ACCEPT(accept_mutex_init(pconf));
if (!is_graceful) {
if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
return 0;
}
+
+/* This really should be a post_config hook, but the error log is already
+ * redirected by that point, so we need to do this in the open_logs phase.
+ */
+static int prefork_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
+{
+ apr_status_t rv;
+
+ pconf = p;
+ ap_server_conf = s;
+
+ if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT|APLOG_STARTUP, 0,
+ NULL, "no listening sockets available, shutting down");
+ return DONE;
+ }
+
+ ap_log_pid(pconf, ap_pid_fname);
+
+ if ((rv = ap_mpm_pod_open(pconf, &pod))) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_STARTUP, rv, NULL,
+ "Could not open pipe-of-death.");
+ return DONE;
+ }
+ return OK;
+}
+
static int prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
{
static int restart_num = 0;
static void prefork_hooks(apr_pool_t *p)
{
+ static const char *const aszSucc[] = {"core.c", NULL};
+
+
#ifdef AUX3
(void) set42sig();
#endif
+ ap_hook_open_logs(prefork_open_logs, NULL, aszSucc, APR_HOOK_MIDDLE);
ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
}