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