main.c revision db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* ====================================================================
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * The Apache Software License, Version 1.1
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Copyright (c) 2000 The Apache Software Foundation. All rights
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * reserved.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Redistribution and use in source and binary forms, with or without
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * modification, are permitted provided that the following conditions
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * are met:
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 1. Redistributions of source code must retain the above copyright
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * notice, this list of conditions and the following disclaimer.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 2. Redistributions in binary form must reproduce the above copyright
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * notice, this list of conditions and the following disclaimer in
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * the documentation and/or other materials provided with the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * distribution.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 3. The end-user documentation included with the redistribution,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * if any, must include the following acknowledgment:
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * "This product includes software developed by the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Apache Software Foundation (http://www.apache.org/)."
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Alternately, this acknowledgment may appear in the software itself,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * if and wherever such third-party acknowledgments normally appear.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 4. The names "Apache" and "Apache Software Foundation" must
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * not be used to endorse or promote products derived from this
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * software without prior written permission. For written
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * permission, please contact apache@apache.org.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 5. Products derived from this software may not be called "Apache",
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * nor may "Apache" appear in their name, without prior written
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * permission of the Apache Software Foundation.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * SUCH DAMAGE.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ====================================================================
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * This software consists of voluntary contributions made by many
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * individuals on behalf of the Apache Software Foundation. For more
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * information on the Apache Software Foundation, please see
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * <http://www.apache.org/>.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Portions of this software are based upon public domain software
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * originally written at the National Center for Supercomputing Applications,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * University of Illinois, Urbana-Champaign.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "apr.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "apr_strings.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "apr_getopt.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "apr_general.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#if APR_HAVE_STDIO_H
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include <stdio.h>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define CORE_PRIVATE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "ap_config.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "httpd.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "http_main.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "http_log.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "http_config.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "http_vhost.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "util_uri.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "util_ebcdic.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "ap_mpm.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * extern functions and global data in another appropriate module.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Most significant main() global data can be found in http_config.c
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* XXX - We should be able to grab the per-MPM settings here too */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbstatic void show_compile_settings(void)
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb{
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server version: %s\n", ap_get_server_version());
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server built: %s\n", ap_get_server_built());
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server's Module Magic Number: %u:%u\n",
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server compiled with....\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef BIG_SECURITY_HOLE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D BIG_SECURITY_HOLE\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe#ifdef SECURITY_HOLE_PASS_AUTHORIZATION
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D SECURITY_HOLE_PASS_AUTHORIZATION\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef APR_HAS_MMAP
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D HAVE_MMAP\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef HAVE_SHMGET
b45c1c292ff1fa635004ae81fa691f8cb3cdda85rbb printf(" -D HAVE_SHMGET\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef AP_USE_FILE_BASED_SCOREBOARD
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D AP_USE_FILE_BASED_SCOREBOARD\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe#ifdef AP_USE_MEM_BASED_SCOREBOARD
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe printf(" -D AP_USE_MEM_BASED_SCOREBOARD\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef AP_USE_MMAP_FILES
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D AP_USE_MMAP_FILES\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef MMAP_SEGMENT_SIZE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D MMAP_SEGMENT_SIZE=%ld\n",(long)MMAP_SEGMENT_SIZE);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif /*AP_USE_MMAP_FILES*/
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef NO_WRITEV
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf(" -D NO_WRITEV\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifdef NO_LINGCLOSE
c3e342e5b0b9fea6617ee16d2da02c3ef2108126dougm printf(" -D NO_LINGCLOSE\n");
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_HAVE_IPV6
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_HAVE_IPV6\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_USE_FLOCK_SERIALIZE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_USE_FLOCK_SERIALIZE\n");
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_USE_SYSVSEM_SERIALIZE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_USE_SYSVSEM_SERIALIZE\n");
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_USE_FCNTL_SERIALIZE
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar printf(" -D APR_USE_FCNTL_SERIALIZE\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_USE_PROC_PTHREAD_SERIALIZE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_USE_PROC_PTHREAD_SERIALIZE\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_USE_PTHREAD_SERIALIZE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_USE_PTHREAD_SERIALIZE\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_PROCESS_LOCK_IS_GLOBAL
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_PROCESS_LOCK_IS_GLOBAL\n");
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if APR_HAS_OTHER_CHILD
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D APR_HAS_OTHER_CHILD\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef AP_HAVE_RELIABLE_PIPED_LOGS
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D AP_HAVE_RELIABLE_PIPED_LOGS\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef BUFFERED_LOGS
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D BUFFERED_LOGS\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef PIPE_BUF
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames printf(" -D PIPE_BUF=%ld\n",(long)PIPE_BUF);
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames#endif
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#if APR_CHARSET_EBCDIC
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar printf(" -D APR_CHARSET_EBCDIC\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef APACHE_XLATE
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D APACHE_XLATE\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef NEED_HASHBANG_EMUL
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D NEED_HASHBANG_EMUL\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef SHARED_CORE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D SHARED_CORE\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe/* This list displays the compiled in default paths: */
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef HTTPD_ROOT
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n");
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef SUEXEC_BIN
4775dfc34c90fada8c7c4d6a57ed8a3114d55c2dtrawick printf(" -D SUEXEC_BIN=\"" SUEXEC_BIN "\"\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#if defined(SHARED_CORE) && defined(SHARED_CORE_DIR)
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D SHARED_CORE_DIR=\"" SHARED_CORE_DIR "\"\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar#ifdef DEFAULT_PIDLOG
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D DEFAULT_PIDLOG=\"" DEFAULT_PIDLOG "\"\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef DEFAULT_SCOREBOARD
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D DEFAULT_SCOREBOARD=\"" DEFAULT_SCOREBOARD "\"\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef DEFAULT_LOCKFILE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D DEFAULT_LOCKFILE=\"" DEFAULT_LOCKFILE "\"\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef DEFAULT_XFERLOG
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D DEFAULT_XFERLOG=\"" DEFAULT_XFERLOG "\"\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef DEFAULT_ERRORLOG
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe printf(" -D DEFAULT_ERRORLOG=\"" DEFAULT_ERRORLOG "\"\n");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef TYPES_CONFIG_FILE
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D TYPES_CONFIG_FILE=\"" TYPES_CONFIG_FILE "\"\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#ifdef SERVER_CONFIG_FILE
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe printf(" -D SERVER_CONFIG_FILE=\"" SERVER_CONFIG_FILE "\"\n");
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe}
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowestatic void destroy_and_exit_process(process_rec *process, int process_exit_value)
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe{
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe apr_destroy_pool(process->pool); /* and destroy all descendent pools */
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe apr_terminate();
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe exit(process_exit_value);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar}
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowestatic process_rec *create_process(int argc, const char * const *argv)
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe{
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe process_rec *process;
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe apr_pool_t *cntx;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe apr_status_t stat;
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
c2cf53a40a9814eb91db2cdf820f97d943f21628coar stat = apr_create_pool(&cntx, NULL);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar if (stat != APR_SUCCESS) {
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
c2cf53a40a9814eb91db2cdf820f97d943f21628coar "apr_create_pool() failed to create "
c2cf53a40a9814eb91db2cdf820f97d943f21628coar "initial context");
c2cf53a40a9814eb91db2cdf820f97d943f21628coar apr_terminate();
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe exit(1);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar }
c2cf53a40a9814eb91db2cdf820f97d943f21628coar
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe process = apr_palloc(cntx, sizeof(process_rec));
c2cf53a40a9814eb91db2cdf820f97d943f21628coar process->pool = cntx;
c2cf53a40a9814eb91db2cdf820f97d943f21628coar
c2cf53a40a9814eb91db2cdf820f97d943f21628coar apr_create_pool(&process->pconf, process->pool);
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe process->argc = argc;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe process->argv = argv;
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe process->short_name = apr_filename_of_pathname(argv[0]);
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe return process;
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe}
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowestatic void usage(process_rec *process)
c2cf53a40a9814eb91db2cdf820f97d943f21628coar{
c2cf53a40a9814eb91db2cdf820f97d943f21628coar const char *bin = process->argv[0];
c2cf53a40a9814eb91db2cdf820f97d943f21628coar char pad[MAX_STRING_LEN];
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe unsigned i;
c2cf53a40a9814eb91db2cdf820f97d943f21628coar
c2cf53a40a9814eb91db2cdf820f97d943f21628coar for (i = 0; i < strlen(bin); i++)
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe pad[i] = ' ';
c2cf53a40a9814eb91db2cdf820f97d943f21628coar pad[i] = '\0';
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#ifdef SHARED_CORE
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,NULL , "Usage: %s [-R directory] [-D name] [-d directory] [-f file]", bin);
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#else
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Usage: %s [-D name] [-d directory] [-f file]", bin);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-C \"directive\"] [-c \"directive\"]", pad);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#ifdef WIN32
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-k restart|shutdown|start]", pad);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-n service_name]", pad);
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-i] [-u]", pad);
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-t] [-T]", pad);
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Options:");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef SHARED_CORE
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -R directory : specify an alternate location for shared object files");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -D name : define a name for use in <IfDefine name> directives");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -d directory : specify an alternate initial ServerRoot");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -f file : specify an alternate ServerConfigFile");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -C \"directive\" : process directive before reading config files");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -c \"directive\" : process directive after reading config files");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#ifdef WIN32
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -n name : set service name and use its ServerConfigFile");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k shutdown : tell running Apache to shutdown");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k restart : tell running Apache to do a graceful restart");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k start : tell Apache to start");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -i : install an Apache service");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -u : uninstall an Apache service");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#endif
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -v : show version number");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -V : show compile settings");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -l : list compiled in modules");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -L : list available configuration directives");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t : run syntax check for config files (with docroot check)");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -T : run syntax check for config files (without docroot check)");
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe /* TODOC: -X goes away, expect MPMs to use -D options */
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe destroy_and_exit_process(process, 1);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe}
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wroweint main(int argc, const char * const argv[])
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe{
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe char c;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe int configtestonly = 0;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe const char *confname = SERVER_CONFIG_FILE;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe const char *def_server_root = HTTPD_ROOT;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe process_rec *process;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe server_rec *server_conf;
0540a0b469147b52e858587270dba31c2aaa9e09wrowe apr_pool_t *pglobal;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_pool_t *pconf;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_pool_t *plog; /* Pool of log streams, reset _after_ each read of conf */
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_pool_t *ptemp; /* Pool for temporary config stuff, reset often */
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_pool_t *pcommands; /* Pool for -D, -C and -c switches */
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_getopt_t *opt;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe module **mod;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe const char *optarg;
0f6fdc73136a064819585afe03bc3503826ee592wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_initialize();
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe process = create_process(argc, argv);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe pglobal = process->pool;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe pconf = process->pconf;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe ap_server_argv0 = process->short_name;
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe#if APR_CHARSET_EBCDIC
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe if (ap_init_ebcdic(pglobal) != APR_SUCCESS) {
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe destroy_and_exit_process(process, 1);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe }
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe#endif
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe ap_util_uri_init();
c2cf53a40a9814eb91db2cdf820f97d943f21628coar
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_setup_prelinked_modules(process);
c2cf53a40a9814eb91db2cdf820f97d943f21628coar
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_create_pool(&pcommands, pglobal);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe ap_server_pre_read_config = apr_make_array(pcommands, 1, sizeof(char *));
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe ap_server_post_read_config = apr_make_array(pcommands, 1, sizeof(char *));
c2cf53a40a9814eb91db2cdf820f97d943f21628coar ap_server_config_defines = apr_make_array(pcommands, 1, sizeof(char *));
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe ap_run_rewrite_args(process);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
c2cf53a40a9814eb91db2cdf820f97d943f21628coar /* Maintain AP_SERVER_BASEARGS list in http_main.h to allow the MPM
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe * to safely pass on our args from its rewrite_args() handler.
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe */
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe apr_initopt(&opt, pcommands, process->argc, process->argv);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe while (apr_getopt(opt, AP_SERVER_BASEARGS, &c, &optarg)
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe == APR_SUCCESS) {
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe char **new;
c57336f883da78c094fdb20659be5b92a9431b15wrowe switch (c) {
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe case 'c':
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe new = (char **)apr_push_array(ap_server_post_read_config);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe *new = apr_pstrdup(pcommands, optarg);
cc9582e53aead2a044077c4a92f3dfc3605590b3wrowe break;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'C':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb new = (char **)apr_push_array(ap_server_pre_read_config);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *new = apr_pstrdup(pcommands, optarg);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb break;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'd':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb def_server_root = optarg;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb break;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'D':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb new = (char **)apr_push_array(ap_server_config_defines);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *new = apr_pstrdup(pcommands, optarg);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb break;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'f':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb confname = optarg;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb break;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'v':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server version: %s\n", ap_get_server_version());
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb printf("Server built: %s\n", ap_get_server_built());
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb destroy_and_exit_process(process, 0);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'V':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb show_compile_settings();
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb destroy_and_exit_process(process, 0);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'l':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb ap_show_modules();
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb destroy_and_exit_process(process, 0);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 'L':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb ap_show_directives();
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb destroy_and_exit_process(process, 0);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb case 't':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb configtestonly = 1;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb break;
c2cf53a40a9814eb91db2cdf820f97d943f21628coar case '?':
c2cf53a40a9814eb91db2cdf820f97d943f21628coar case 'h':
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb usage(process);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb }
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb }
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_create_pool(&plog, pglobal);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_create_pool(&ptemp, pconf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe /* Note that we preflight the config file once
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe before reading it _again_ in the main loop.
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe This allows things, log files configuration
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe for example, to settle down. */
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_server_root = def_server_root;
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_run_pre_config(pconf, plog, ptemp);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_fixup_virtual_hosts(pconf, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_fini_vhost_config(pconf, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_sort_hooks();
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe if (configtestonly) {
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n");
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe destroy_and_exit_process(process, 0);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar }
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_clear_pool(plog);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_run_open_logs(pconf, plog, ptemp, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_post_config_hook(pconf, plog, ptemp, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_destroy_pool(ptemp);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe for (;;) {
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_hook_deregister_all();
11fb2f3611e6ff9a541e10b13e3108934f828141gregames apr_clear_pool(pconf);
11fb2f3611e6ff9a541e10b13e3108934f828141gregames for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
11fb2f3611e6ff9a541e10b13e3108934f828141gregames ap_register_hooks(*mod);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe }
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe /* This is a hack until we finish the code so that it only reads
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe * the config file once and just operates on the tree already in
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe * memory. rbb
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe */
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_conftree = NULL;
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_create_pool(&ptemp, pconf);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_server_root = def_server_root;
2f1949bb0e3c209db94c8d521cba7380b9d11421trawick server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_run_pre_config(pconf, plog, ptemp);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_fixup_virtual_hosts(pconf, server_conf);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_fini_vhost_config(pconf, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_sort_hooks();
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar apr_clear_pool(plog);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe ap_run_open_logs(pconf, plog, ptemp, server_conf);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar ap_post_config_hook(pconf, plog, ptemp, server_conf);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe apr_destroy_pool(ptemp);
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe if (ap_mpm_run(pconf, plog, server_conf)) break;
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar }
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe destroy_and_exit_process(process, 0);
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe return 0; /* Supress compiler warning. */
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe}
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe
290ecc1ddceca1ed49bc1a5338921264b5c3e07cwrowe/* force Expat to be linked into the server executable */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#if defined(USE_EXPAT) && !defined(SHARED_CORE_BOOTSTRAP)
8aefbd756763807188d2e3ce336a8680e4893066wrowe#include "xmlparse.h"
8aefbd756763807188d2e3ce336a8680e4893066wroweconst XML_LChar *suck_in_expat(void);
8aefbd756763807188d2e3ce336a8680e4893066wroweconst XML_LChar *suck_in_expat(void)
8aefbd756763807188d2e3ce336a8680e4893066wrowe{
8aefbd756763807188d2e3ce336a8680e4893066wrowe return XML_ErrorString(XML_ERROR_NONE);
8aefbd756763807188d2e3ce336a8680e4893066wrowe}
8aefbd756763807188d2e3ce336a8680e4893066wrowe#endif /* USE_EXPAT */
8aefbd756763807188d2e3ce336a8680e4893066wrowe
8aefbd756763807188d2e3ce336a8680e4893066wrowe#ifndef SHARED_CORE_BOOTSTRAP
8aefbd756763807188d2e3ce336a8680e4893066wrowe/*
8aefbd756763807188d2e3ce336a8680e4893066wrowe * Force apr_validate_password() into the image so that modules like
8aefbd756763807188d2e3ce336a8680e4893066wrowe * mod_auth can use it even if they're dynamically loaded.
8aefbd756763807188d2e3ce336a8680e4893066wrowe */
8aefbd756763807188d2e3ce336a8680e4893066wrowevoid suck_in_apr_validate_password(void);
8aefbd756763807188d2e3ce336a8680e4893066wrowevoid suck_in_apr_validate_password(void)
8aefbd756763807188d2e3ce336a8680e4893066wrowe{
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe apr_validate_password("a", "b");
8aefbd756763807188d2e3ce336a8680e4893066wrowe}
e4a3f3c2f080cac75a15a6454cca429b8161c050wrowe#endif
8aefbd756763807188d2e3ce336a8680e4893066wrowe
8aefbd756763807188d2e3ce336a8680e4893066wrowe#ifdef AP_USING_AUTOCONF
2fa5b5878e7567e2875807c3e2a2b3b0d3ef74bewrowe/* This ugly little hack pulls any function referenced in exports.c into
2fa5b5878e7567e2875807c3e2a2b3b0d3ef74bewrowe * the web server. exports.c is generated during the build, and it
e4a3f3c2f080cac75a15a6454cca429b8161c050wrowe * has all of the APR functions specified by the apr/apr.exports and
e4a3f3c2f080cac75a15a6454cca429b8161c050wrowe * apr-util/aprutil.exports files.
8aefbd756763807188d2e3ce336a8680e4893066wrowe */
8aefbd756763807188d2e3ce336a8680e4893066wroweconst void *suck_in_APR(void);
dc8692c6c0ca616a09aa12dad005f2ef23baa1a0wroweconst void *suck_in_APR(void)
a8d11d78181478da6a672f7fbc58b8d523351f49wrowe{
8aa5ca8ff2a4d8e56f62ea3d461e2799136da085trawick extern const void *ap_ugly_hack;
dc8692c6c0ca616a09aa12dad005f2ef23baa1a0wrowe
dc8692c6c0ca616a09aa12dad005f2ef23baa1a0wrowe return ap_ugly_hack;
dc8692c6c0ca616a09aa12dad005f2ef23baa1a0wrowe}
8aefbd756763807188d2e3ce336a8680e4893066wrowe#endif
a8d11d78181478da6a672f7fbc58b8d523351f49wrowe