ben 99/07/10 06:32:48
Modified: mpm/src/include ap_hooks.h mpm/src/main http_config.c http_main.c Log: Rudimentary debugging for hooks. Revision Changes Path 1.3 +4 -0 apache-2.0/mpm/src/include/ap_hooks.h Index: ap_hooks.h =================================================================== RCS file: /export/home/cvs/apache-2.0/mpm/src/include/ap_hooks.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ap_hooks.h 1999/07/06 21:32:08 1.2 +++ ap_hooks.h 1999/07/10 13:32:46 1.3 @@ -1,6 +1,8 @@ #ifndef APACHE_AP_HOOKS_H #define APACHE_AP_HOOKS_H +extern int g_bDebugHooks; + #define DECLARE_HOOK(ret,name,args) \ typedef ret HOOK_##name args; \ void ap_hook_##name(HOOK_##name *pf); \ @@ -24,6 +26,8 @@ pHook->pNext=_hooks.link_##name; \ pHook->pFunc=pf; \ _hooks.link_##name=pHook; \ + if(g_bDebugHooks) \ + puts(" Hooked " #name); \ } \ ret ap_run_##name args \ { \ 1.7 +16 -2 apache-2.0/mpm/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /export/home/cvs/apache-2.0/mpm/src/main/http_config.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- http_config.c 1999/07/06 21:32:10 1.6 +++ http_config.c 1999/07/10 13:32:47 1.7 @@ -529,6 +529,21 @@ return HTTP_INTERNAL_SERVER_ERROR; } +int g_bDebugHooks; + +static void register_hooks(module *m) + { + if(m->register_hooks) + { + if(ap_exists_config_define("SHOW_HOOKS")) + { + printf("Registering hooks for %s\n",m->name); + g_bDebugHooks=1; + } + m->register_hooks(); + } + } + /* One-time setup for precompiled modules --- NOT to be done on restart */ API_EXPORT(void) ap_add_module(module *m) @@ -582,8 +597,7 @@ #endif /*_OSD_POSIX*/ /* FIXME: is this the right place to call this? */ - if(m->register_hooks) - m->register_hooks(); + register_hooks(m); } /* 1.4 +15 -6 apache-2.0/mpm/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache-2.0/mpm/src/main/http_main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- http_main.c 1999/07/05 13:00:45 1.3 +++ http_main.c 1999/07/10 13:32:47 1.4 @@ -247,6 +247,7 @@ pool *ptemp; /* Pool for temporart config stuff */ pool *pcommands; /* Pool for -C and -c switches */ extern char *optarg; + extern int optind,optreset; /* TODO: PATHSEPARATOR should be one of the os defines */ @@ -264,14 +265,26 @@ pglobal = ap_init_alloc(); g_pHookPool=pglobal; - ap_setup_prelinked_modules(); - pcommands = ap_make_sub_pool(pglobal); ap_server_pre_read_config = ap_make_array(pcommands, 1, sizeof(char *)); ap_server_post_read_config = ap_make_array(pcommands, 1, sizeof(char *)); ap_server_config_defines = ap_make_array(pcommands, 1, sizeof(char *)); + + while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:th")) != -1) { + char **new; + switch (c) { + case 'D': + new = (char **)ap_push_array(ap_server_config_defines); + *new = ap_pstrdup(pcommands, optarg); + break; + } + } + + ap_setup_prelinked_modules(); + ap_pre_command_line_hook(pcommands); + optind=optreset=1; while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:th")) != -1) { char **new; switch (c) { @@ -281,10 +294,6 @@ break; case 'C': new = (char **)ap_push_array(ap_server_pre_read_config); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'D': - new = (char **)ap_push_array(ap_server_config_defines); *new = ap_pstrdup(pcommands, optarg); break; case 'd':