main.c revision 18b197c6ba1d5b8bb5b2fb372ef752f87e56912a
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/* ====================================================================
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * The Apache Software License, Version 1.1
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * Copyright (c) 2000 The Apache Software Foundation. All rights
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * reserved.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * Redistribution and use in source and binary forms, with or without
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * modification, are permitted provided that the following conditions
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * are met:
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * 1. Redistributions of source code must retain the above copyright
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * notice, this list of conditions and the following disclaimer.
2e545ce2450a9953665f701bb05350f0d3f26275nd * 2. Redistributions in binary form must reproduce the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer in
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * the documentation and/or other materials provided with the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * distribution.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * 3. The end-user documentation included with the redistribution,
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * if any, must include the following acknowledgment:
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * "This product includes software developed by the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * Apache Software Foundation (http://www.apache.org/)."
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * Alternately, this acknowledgment may appear in the software itself,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * if and wherever such third-party acknowledgments normally appear.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * 4. The names "Apache" and "Apache Software Foundation" must
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * not be used to endorse or promote products derived from this
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * software without prior written permission. For written
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * permission, please contact apache@apache.org.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * 5. Products derived from this software may not be called "Apache",
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung * nor may "Apache" appear in their name, without prior written
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * permission of the Apache Software Foundation.
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * SUCH DAMAGE.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * ====================================================================
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * This software consists of voluntary contributions made by many
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * individuals on behalf of the Apache Software Foundation. For more
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * information on the Apache Software Foundation, please see
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * Portions of this software are based upon public domain software
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * originally written at the National Center for Supercomputing Applications,
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * University of Illinois, Urbana-Champaign.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * extern functions and global data in another appropriate module.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * Most significant main() global data can be found in http_config.c
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/* XXX - We should be able to grab the per-MPM settings here too */
a78048ccbdb6256da15e6b0e7e95355e480c2301ndstatic void show_compile_settings(void)
a78048ccbdb6256da15e6b0e7e95355e480c2301nd#endif /*APR_HAS_MMAP*/
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/* This list displays the compiled in default paths: */
a78048ccbdb6256da15e6b0e7e95355e480c2301nd printf(" -D DEFAULT_SCOREBOARD=\"" DEFAULT_SCOREBOARD "\"\n");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd printf(" -D DEFAULT_LOCKFILE=\"" DEFAULT_LOCKFILE "\"\n");
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen printf(" -D DEFAULT_ERRORLOG=\"" DEFAULT_ERRORLOG "\"\n");
727872d18412fc021f03969b8641810d8896820bhumbedooh printf(" -D TYPES_CONFIG_FILE=\"" TYPES_CONFIG_FILE "\"\n");
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh printf(" -D SERVER_CONFIG_FILE=\"" SERVER_CONFIG_FILE "\"\n");
0d0ba3a410038e179b695446bb149cce6264e0abndstatic void destroy_and_exit_process(process_rec *process, int process_exit_value)
0d0ba3a410038e179b695446bb149cce6264e0abnd apr_destroy_pool(process->pool); /* and destroy all descendent pools */
727872d18412fc021f03969b8641810d8896820bhumbedoohstatic process_rec *create_process(int argc, const char * const *argv)
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd /* XXX From the time that we took away the NULL pool->malloc mapping
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd * we have been unable to log here without segfaulting.
return process;
#ifdef SHARED_CORE
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,NULL , "Usage: %s [-R directory] [-D name] [-d directory] [-f file]", bin);
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Usage: %s [-D name] [-d directory] [-f file]", bin);
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-C \"directive\"] [-c \"directive\"]", pad);
#ifdef WIN32
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-k restart|shutdown|start]", pad);
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-t] [-T]", pad);
#ifdef SHARED_CORE
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -R directory : specify an alternate location for shared object files");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -D name : define a name for use in <IfDefine name> directives");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -d directory : specify an alternate initial ServerRoot");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -f file : specify an alternate ServerConfigFile");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -C \"directive\" : process directive before reading config files");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -c \"directive\" : process directive after reading config files");
#ifdef WIN32
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -n name : set service name and use its ServerConfigFile");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k shutdown : tell running Apache to shutdown");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k restart : tell running Apache to do a graceful restart");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k start : tell Apache to start");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -i : install an Apache service");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -u : uninstall an Apache service");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -L : list available configuration directives");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t : run syntax check for config files (with docroot check)");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -T : run syntax check for config files (without docroot check)");
int configtestonly = 0;
const char *optarg;
/* Maintain AP_SERVER_BASEARGS list in http_main.h to allow the MPM
== APR_SUCCESS) {
char **new;
if (configtestonly) {
#include "xmlparse.h"
#ifndef SHARED_CORE_BOOTSTRAP
void suck_in_apr_validate_password(void);
void suck_in_apr_validate_password(void)
#ifdef AP_USING_AUTOCONF
/* This ugly little hack pulls any function referenced in exports.c into
* the web server. exports.c is generated during the build, and it
* has all of the APR functions specified by the apr/apr.exports and
* apr-util/aprutil.exports files.
const void *suck_in_APR(void);
const void *suck_in_APR(void)
extern const void *ap_ugly_hack;
return ap_ugly_hack;