1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "apr_strings.h"
19 #include "apr_getopt.h"
20 #include "apr_general.h"
24 #include "apr_version.h"
25 #include "apu_version.h"
27 #define APR_WANT_STDIO
28 #define APR_WANT_STRFUNC
31 #include "ap_config.h"
33 #include "http_main.h"
35 #include "http_config.h"
36 #include "http_core.h"
37 #include "http_request.h"
38 #include "http_vhost.h"
40 #include "util_ebcdic.h"
47 /* WARNING: Win32 binds http_main.c dynamically to the server. Please place
48 * extern functions and global data in another appropriate module.
50 * Most significant main() global data can be found in http_config.c
53 static void show_mpm_settings(void)
58 printf("Server MPM: %s\n", ap_show_mpm());
60 retval = ap_mpm_query(AP_MPMQ_IS_THREADED, &mpm_query_info);
62 if (retval == APR_SUCCESS) {
63 printf(" threaded: ");
65 if (mpm_query_info == AP_MPMQ_DYNAMIC) {
66 printf("yes (variable thread count)\n");
68 else if (mpm_query_info == AP_MPMQ_STATIC) {
69 printf("yes (fixed thread count)\n");
76 retval = ap_mpm_query(AP_MPMQ_IS_FORKED, &mpm_query_info);
78 if (retval == APR_SUCCESS) {
81 if (mpm_query_info == AP_MPMQ_DYNAMIC) {
82 printf("yes (variable process count)\n");
84 else if (mpm_query_info == AP_MPMQ_STATIC) {
85 printf("yes (fixed process count)\n");
93 static void show_compile_settings(void)
95 printf("Server version: %s\n", ap_get_server_description());
96 printf("Server built: %s\n", ap_get_server_built());
97 printf("Server's Module Magic Number: %u:%u\n",
98 MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR);
99 #if APR_MAJOR_VERSION >= 2
100 printf("Server loaded: APR %s\n", apr_version_string());
101 printf("Compiled using: APR %s\n", APR_VERSION_STRING);
103 printf("Server loaded: APR %s, APR-UTIL %s\n",
104 apr_version_string(), apu_version_string());
105 printf("Compiled using: APR %s, APR-UTIL %s\n",
106 APR_VERSION_STRING, APU_VERSION_STRING);
108 /* sizeof(foo) is long on some platforms so we might as well
109 * make it long everywhere to keep the printf format
112 printf("Architecture: %ld-bit\n", 8 * (long)sizeof(void *));
116 printf("Server compiled with....\n");
117 #ifdef BIG_SECURITY_HOLE
118 printf(" -D BIG_SECURITY_HOLE\n");
121 #ifdef SECURITY_HOLE_PASS_AUTHORIZATION
122 printf(" -D SECURITY_HOLE_PASS_AUTHORIZATION\n");
126 printf(" -D OS=\"" OS "\"\n");
130 printf(" -D HAVE_SHMGET\n");
133 #if APR_FILE_BASED_SHM
134 printf(" -D APR_FILE_BASED_SHM\n");
138 printf(" -D APR_HAS_SENDFILE\n");
142 printf(" -D APR_HAS_MMAP\n");
146 printf(" -D NO_WRITEV\n");
150 printf(" -D NO_LINGCLOSE\n");
154 printf(" -D APR_HAVE_IPV6 (IPv4-mapped addresses ");
155 #ifdef AP_ENABLE_V4_MAPPED
156 printf("enabled)\n");
158 printf("disabled)\n");
162 #if APR_USE_FLOCK_SERIALIZE
163 printf(" -D APR_USE_FLOCK_SERIALIZE\n");
166 #if APR_USE_SYSVSEM_SERIALIZE
167 printf(" -D APR_USE_SYSVSEM_SERIALIZE\n");
170 #if APR_USE_POSIXSEM_SERIALIZE
171 printf(" -D APR_USE_POSIXSEM_SERIALIZE\n");
174 #if APR_USE_FCNTL_SERIALIZE
175 printf(" -D APR_USE_FCNTL_SERIALIZE\n");
178 #if APR_USE_PROC_PTHREAD_SERIALIZE
179 printf(" -D APR_USE_PROC_PTHREAD_SERIALIZE\n");
182 #if APR_USE_PTHREAD_SERIALIZE
183 printf(" -D APR_USE_PTHREAD_SERIALIZE\n");
186 #if APR_PROCESS_LOCK_IS_GLOBAL
187 printf(" -D APR_PROCESS_LOCK_IS_GLOBAL\n");
190 #ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
191 printf(" -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\n");
194 #if APR_HAS_OTHER_CHILD
195 printf(" -D APR_HAS_OTHER_CHILD\n");
198 #ifdef AP_HAVE_RELIABLE_PIPED_LOGS
199 printf(" -D AP_HAVE_RELIABLE_PIPED_LOGS\n");
203 printf(" -D BUFFERED_LOGS\n");
205 printf(" -D PIPE_BUF=%ld\n",(long)PIPE_BUF);
209 printf(" -D DYNAMIC_MODULE_LIMIT=%ld\n",(long)DYNAMIC_MODULE_LIMIT);
211 #if APR_CHARSET_EBCDIC
212 printf(" -D APR_CHARSET_EBCDIC\n");
215 #ifdef NEED_HASHBANG_EMUL
216 printf(" -D NEED_HASHBANG_EMUL\n");
219 /* This list displays the compiled in default paths: */
221 printf(" -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n");
225 printf(" -D SUEXEC_BIN=\"" SUEXEC_BIN "\"\n");
228 #ifdef DEFAULT_PIDLOG
229 printf(" -D DEFAULT_PIDLOG=\"" DEFAULT_PIDLOG "\"\n");
232 #ifdef DEFAULT_SCOREBOARD
233 printf(" -D DEFAULT_SCOREBOARD=\"" DEFAULT_SCOREBOARD "\"\n");
236 #ifdef DEFAULT_ERRORLOG
237 printf(" -D DEFAULT_ERRORLOG=\"" DEFAULT_ERRORLOG "\"\n");
240 #ifdef AP_TYPES_CONFIG_FILE
241 printf(" -D AP_TYPES_CONFIG_FILE=\"" AP_TYPES_CONFIG_FILE "\"\n");
244 #ifdef SERVER_CONFIG_FILE
245 printf(" -D SERVER_CONFIG_FILE=\"" SERVER_CONFIG_FILE "\"\n");
249 #define TASK_SWITCH_SLEEP 10000
251 static void destroy_and_exit_process(process_rec *process,
252 int process_exit_value)
255 * Sleep for TASK_SWITCH_SLEEP micro seconds to cause a task switch on
256 * OS layer and thus give possibly started piped loggers a chance to
257 * process their input. Otherwise it is possible that they get killed
258 * by us before they can do so. In this case maybe valueable log messages
261 apr_sleep(TASK_SWITCH_SLEEP);
262 ap_main_state = AP_SQ_MS_EXITING;
263 apr_pool_destroy(process->pool); /* and destroy all descendent pools */
265 exit(process_exit_value);
268 #define OOM_MESSAGE "[crit] Memory allocation failed, " \
269 "aborting process." APR_EOL_STR
271 /* APR callback invoked if allocation fails. */
272 static int abort_on_oom(int retcode)
274 write(STDERR_FILENO, OOM_MESSAGE, strlen(OOM_MESSAGE));
276 return retcode; /* unreachable, hopefully. */
279 static process_rec *init_process(int *argc, const char * const * *argv)
281 process_rec *process;
284 const char *failed = "apr_app_initialize()";
286 stat = apr_app_initialize(argc, argv, NULL);
287 if (stat == APR_SUCCESS) {
288 failed = "apr_pool_create()";
289 stat = apr_pool_create(&cntx, NULL);
292 if (stat != APR_SUCCESS) {
293 /* For all intents and purposes, this is impossibly unlikely,
294 * but APR doesn't exist yet, we can't use it for reporting
295 * these earliest two failures;
297 * XXX: Note the apr_ctime() and apr_time_now() calls. These
298 * work, today, against an uninitialized APR, but in the future
299 * (if they relied on global pools or mutexes, for example) then
300 * the datestamp logic will need to be replaced.
302 char ctimebuff[APR_CTIME_LEN];
303 apr_ctime(ctimebuff, apr_time_now());
304 fprintf(stderr, "[%s] [crit] (%d) %s: %s failed "
305 "to initial context, exiting\n",
306 ctimebuff, stat, (*argv)[0], failed);
311 apr_pool_abort_set(abort_on_oom, cntx);
312 apr_pool_tag(cntx, "process");
313 ap_open_stderr_log(cntx);
315 /* Now we have initialized apr and our logger, no more
316 * exceptional error reporting required for the lifetime
317 * of this server process.
320 process = apr_palloc(cntx, sizeof(process_rec));
321 process->pool = cntx;
323 apr_pool_create(&process->pconf, process->pool);
324 apr_pool_tag(process->pconf, "pconf");
325 process->argc = *argc;
326 process->argv = *argv;
327 process->short_name = apr_filepath_name_get((*argv)[0]);
331 static void usage(process_rec *process)
333 const char *bin = process->argv[0];
334 int pad_len = strlen(bin);
336 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
337 "Usage: %s [-D name] [-d directory] [-f file]", bin);
339 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
340 " %*s [-C \"directive\"] [-c \"directive\"]", pad_len, " ");
343 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
344 " %*s [-w] [-k start|restart|stop|shutdown] [-n service_name]",
346 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
347 " %*s [-k install|config|uninstall] [-n service_name]",
350 /* XXX not all MPMs support signalling the server in general or graceful-stop
353 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
354 " %*s [-k start|restart|graceful|graceful-stop|stop]",
357 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
358 " %*s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]",
360 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
363 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
364 " -D name : define a name for use in "
365 "<IfDefine name> directives");
366 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
367 " -d directory : specify an alternate initial "
369 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
370 " -f file : specify an alternate ServerConfigFile");
371 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
372 " -C \"directive\" : process directive before reading "
374 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
375 " -c \"directive\" : process directive after reading "
379 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
380 " -n name : set screen name");
383 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
384 " -n name : set service name and use its "
385 "ServerConfigFile and ServerRoot");
386 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
387 " -k start : tell Apache to start");
388 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
389 " -k restart : tell running Apache to do a graceful "
391 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
392 " -k stop|shutdown : tell running Apache to shutdown");
393 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
394 " -k install : install an Apache service");
395 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
396 " -k config : change startup Options of an Apache "
398 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
399 " -k uninstall : uninstall an Apache service");
400 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
401 " -w : hold open the console window on error");
404 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
405 " -e level : show startup errors of level "
407 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
408 " -E file : log startup errors to file");
409 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
410 " -v : show version number");
411 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
412 " -V : show compile settings");
413 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
414 " -h : list available command line options "
416 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
417 " -l : list compiled in modules");
418 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
419 " -L : list available configuration "
421 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
422 " -t -D DUMP_VHOSTS : show parsed settings (currently only "
424 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
425 " -S : a synonym for -t -D DUMP_VHOSTS");
426 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
427 " -t -D DUMP_MODULES : show all loaded modules ");
428 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
429 " -M : a synonym for -t -D DUMP_MODULES");
430 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
431 " -t : run syntax check for config files");
432 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
433 " -T : start without DocumentRoot(s) check");
434 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
435 " -X : debug mode (only one worker, do not detach)");
437 destroy_and_exit_process(process, 1);
440 int main(int argc, const char * const argv[])
444 const char *confname = SERVER_CONFIG_FILE;
445 const char *def_server_root = HTTPD_ROOT;
446 const char *temp_error_log = NULL;
448 process_rec *process;
450 apr_pool_t *plog; /* Pool of log streams, reset _after_ each read of conf */
451 apr_pool_t *ptemp; /* Pool for temporary config stuff, reset often */
452 apr_pool_t *pcommands; /* Pool for -D, -C and -c switches */
457 APR_OPTIONAL_FN_TYPE(ap_signal_server) *signal_server;
459 AP_MONCONTROL(0); /* turn off profiling of startup */
461 process = init_process(&argc, &argv);
462 ap_pglobal = process->pool;
463 pconf = process->pconf;
464 ap_server_argv0 = process->short_name;
466 /* Set up the OOM callback in the global pool, so all pools should
467 * by default inherit it. */
468 apr_pool_abort_set(abort_on_oom, apr_pool_parent_get(process->pool));
470 #if APR_CHARSET_EBCDIC
471 if (ap_init_ebcdic(ap_pglobal) != APR_SUCCESS) {
472 destroy_and_exit_process(process, 1);
476 apr_pool_create(&pcommands, ap_pglobal);
477 apr_pool_tag(pcommands, "pcommands");
478 ap_server_pre_read_config = apr_array_make(pcommands, 1, sizeof(char *));
479 ap_server_post_read_config = apr_array_make(pcommands, 1, sizeof(char *));
480 ap_server_config_defines = apr_array_make(pcommands, 1, sizeof(char *));
482 error = ap_setup_prelinked_modules(process);
484 ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_EMERG, 0, NULL, "%s: %s",
485 ap_server_argv0, error);
486 destroy_and_exit_process(process, 1);
489 ap_run_rewrite_args(process);
491 /* Maintain AP_SERVER_BASEARGS list in http_main.h to allow the MPM
492 * to safely pass on our args from its rewrite_args() handler.
494 apr_getopt_init(&opt, pcommands, process->argc, process->argv);
496 while ((rv = apr_getopt(opt, AP_SERVER_BASEARGS, &c, &opt_arg))
502 new = (char **)apr_array_push(ap_server_post_read_config);
503 *new = apr_pstrdup(pcommands, opt_arg);
507 new = (char **)apr_array_push(ap_server_pre_read_config);
508 *new = apr_pstrdup(pcommands, opt_arg);
512 def_server_root = opt_arg;
516 new = (char **)apr_array_push(ap_server_config_defines);
517 *new = apr_pstrdup(pcommands, opt_arg);
518 /* Setting -D DUMP_VHOSTS is equivalent to setting -S */
519 if (strcmp(opt_arg, "DUMP_VHOSTS") == 0)
520 ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
521 /* Setting -D DUMP_MODULES is equivalent to setting -M */
522 if (strcmp(opt_arg, "DUMP_MODULES") == 0)
523 ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
527 if (ap_parse_log_level(opt_arg, &ap_default_loglevel) != NULL)
532 temp_error_log = apr_pstrdup(process->pool, opt_arg);
536 new = (char **)apr_array_push(ap_server_config_defines);
545 printf("Server version: %s\n", ap_get_server_description());
546 printf("Server built: %s\n", ap_get_server_built());
547 destroy_and_exit_process(process, 0);
551 destroy_and_exit_process(process, 0);
554 ap_show_directives();
555 destroy_and_exit_process(process, 0);
558 if (ap_run_mode == AP_SQ_RM_UNKNOWN)
559 ap_run_mode = AP_SQ_RM_CONFIG_TEST;
563 ap_document_root_check = 0;
567 ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
568 new = (char **)apr_array_push(ap_server_config_defines);
569 *new = "DUMP_VHOSTS";
573 ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
574 new = (char **)apr_array_push(ap_server_config_defines);
575 *new = "DUMP_MODULES";
579 if (strcmp(ap_show_mpm(), "")) { /* MPM built-in? */
580 show_compile_settings();
581 destroy_and_exit_process(process, 0);
585 ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
595 if (ap_run_mode == AP_SQ_RM_UNKNOWN)
596 ap_run_mode = AP_SQ_RM_NORMAL;
598 /* bad cmdline option? then we die */
599 if (rv != APR_EOF || opt->ind < opt->argc) {
603 ap_main_state = AP_SQ_MS_CREATE_PRE_CONFIG;
604 apr_pool_create(&plog, ap_pglobal);
605 apr_pool_tag(plog, "plog");
606 apr_pool_create(&ptemp, pconf);
607 apr_pool_tag(ptemp, "ptemp");
609 /* Note that we preflight the config file once
610 * before reading it _again_ in the main loop.
611 * This allows things, log files configuration
612 * for example, to settle down.
615 ap_server_root = def_server_root;
616 if (temp_error_log) {
617 ap_replace_stderr_log(process->pool, temp_error_log);
619 ap_server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
620 if (!ap_server_conf) {
621 destroy_and_exit_process(process, 1);
625 if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
626 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
627 NULL, "Pre-configuration failed");
628 destroy_and_exit_process(process, 1);
631 rv = ap_process_config_tree(ap_server_conf, ap_conftree,
632 process->pconf, ptemp);
634 ap_fixup_virtual_hosts(pconf, ap_server_conf);
635 ap_fini_vhost_config(pconf, ap_server_conf);
637 if (ap_run_check_config(pconf, plog, ptemp, ap_server_conf) != OK) {
638 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
639 NULL, "Configuration check failed");
640 destroy_and_exit_process(process, 1);
643 if (ap_run_mode != AP_SQ_RM_NORMAL) {
644 if (showcompile) { /* deferred due to dynamically loaded MPM */
645 show_compile_settings();
648 ap_run_test_config(pconf, ap_server_conf);
649 if (ap_run_mode == AP_SQ_RM_CONFIG_TEST)
650 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK");
652 destroy_and_exit_process(process, 0);
656 signal_server = APR_RETRIEVE_OPTIONAL_FN(ap_signal_server);
660 if (signal_server(&exit_status, pconf) != 0) {
661 destroy_and_exit_process(process, exit_status);
665 /* If our config failed, deal with that here. */
667 destroy_and_exit_process(process, 1);
670 apr_pool_clear(plog);
672 if ( ap_run_open_logs(pconf, plog, ptemp, ap_server_conf) != OK) {
673 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
674 0, NULL, "Unable to open logs");
675 destroy_and_exit_process(process, 1);
678 if ( ap_run_post_config(pconf, plog, ptemp, ap_server_conf) != OK) {
679 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
680 NULL, "Configuration Failed");
681 destroy_and_exit_process(process, 1);
684 apr_pool_destroy(ptemp);
687 ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
688 apr_hook_deregister_all();
689 apr_pool_clear(pconf);
690 ap_clear_auth_internal();
692 ap_main_state = AP_SQ_MS_CREATE_CONFIG;
693 for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
694 ap_register_hooks(*mod, pconf);
697 /* This is a hack until we finish the code so that it only reads
698 * the config file once and just operates on the tree already in
702 apr_pool_create(&ptemp, pconf);
703 apr_pool_tag(ptemp, "ptemp");
704 ap_server_root = def_server_root;
705 ap_server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
706 if (!ap_server_conf) {
707 destroy_and_exit_process(process, 1);
711 if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
712 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
713 0, NULL, "Pre-configuration failed");
714 destroy_and_exit_process(process, 1);
717 if (ap_process_config_tree(ap_server_conf, ap_conftree, process->pconf,
719 destroy_and_exit_process(process, 1);
721 ap_fixup_virtual_hosts(pconf, ap_server_conf);
722 ap_fini_vhost_config(pconf, ap_server_conf);
724 if (ap_run_check_config(pconf, plog, ptemp, ap_server_conf) != OK) {
725 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
726 NULL, "Configuration check failed");
727 destroy_and_exit_process(process, 1);
730 apr_pool_clear(plog);
731 if (ap_run_open_logs(pconf, plog, ptemp, ap_server_conf) != OK) {
732 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
733 0, NULL, "Unable to open logs");
734 destroy_and_exit_process(process, 1);
737 if (ap_run_post_config(pconf, plog, ptemp, ap_server_conf) != OK) {
738 ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
739 0, NULL, "Configuration Failed");
740 destroy_and_exit_process(process, 1);
743 apr_pool_destroy(ptemp);
744 apr_pool_lock(pconf, 1);
746 ap_run_optional_fn_retrieve();
748 ap_main_state = AP_SQ_MS_RUN_MPM;
749 if (ap_run_mpm(pconf, plog, ap_server_conf) != OK)
752 apr_pool_lock(pconf, 0);
755 apr_pool_lock(pconf, 0);
756 destroy_and_exit_process(process, 0);
758 return 0; /* Termination 'ok' */
761 #ifdef AP_USING_AUTOCONF
762 /* This ugly little hack pulls any function referenced in exports.c into
763 * the web server. exports.c is generated during the build, and it
764 * has all of the APR functions specified by the apr/apr.exports and
765 * apr-util/aprutil.exports files.
767 const void *ap_suck_in_APR(void);
768 const void *ap_suck_in_APR(void)
770 extern const void *ap_ugly_hack;