Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 45237 invoked from network); 30 Oct 2008 01:51:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2008 01:51:03 -0000 Received: (qmail 87711 invoked by uid 500); 30 Oct 2008 01:51:08 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 87637 invoked by uid 500); 30 Oct 2008 01:51:08 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 87628 invoked by uid 99); 30 Oct 2008 01:51:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Oct 2008 18:51:08 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Oct 2008 01:50:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 70C99238889D; Wed, 29 Oct 2008 18:50:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r709078 - in /httpd/httpd/trunk/server/mpm/simple: simple_api.c simple_api.h simple_children.c simple_children.h simple_core.c simple_event.c simple_event.h simple_io.c simple_io.h simple_run.c simple_run.h simple_types.h Date: Thu, 30 Oct 2008 01:50:10 -0000 To: cvs@httpd.apache.org From: pquerna@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081030015011.70C99238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pquerna Date: Wed Oct 29 18:50:09 2008 New Revision: 709078 URL: http://svn.apache.org/viewvc?rev=709078&view=rev Log: reindent according to our coding style: for i in `ls *.h *.c`; do indent -i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 -nut ${i}; done Modified: httpd/httpd/trunk/server/mpm/simple/simple_api.c httpd/httpd/trunk/server/mpm/simple/simple_api.h httpd/httpd/trunk/server/mpm/simple/simple_children.c httpd/httpd/trunk/server/mpm/simple/simple_children.h httpd/httpd/trunk/server/mpm/simple/simple_core.c httpd/httpd/trunk/server/mpm/simple/simple_event.c httpd/httpd/trunk/server/mpm/simple/simple_event.h httpd/httpd/trunk/server/mpm/simple/simple_io.c httpd/httpd/trunk/server/mpm/simple/simple_io.h httpd/httpd/trunk/server/mpm/simple/simple_run.c httpd/httpd/trunk/server/mpm/simple/simple_run.h httpd/httpd/trunk/server/mpm/simple/simple_types.h Modified: httpd/httpd/trunk/server/mpm/simple/simple_api.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_api.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_api.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_api.c Wed Oct 29 18:50:09 2008 @@ -33,173 +33,164 @@ server_rec *ap_server_conf = NULL; -APR_HOOK_STRUCT( - APR_HOOK_LINK(simple_drop_privileges) -) +APR_HOOK_STRUCT(APR_HOOK_LINK(simple_drop_privileges) + ) AP_IMPLEMENT_HOOK_RUN_ALL(int, simple_drop_privileges, - (apr_pool_t *pchild, server_rec *s), + (apr_pool_t * pchild, server_rec * s), (pchild, s), OK, DECLINED) -int -ap_mpm_run(apr_pool_t *pconf, - apr_pool_t *plog, - server_rec *s) + int ap_mpm_run(apr_pool_t * pconf, apr_pool_t * plog, server_rec * s) { - simple_core_t *sc = simple_core_get(); - - sc->mpm_state = AP_MPMQ_RUNNING; - - if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { - sc->mpm_state = AP_MPMQ_STOPPING; - return 1; - } + simple_core_t *sc = simple_core_get(); - return simple_main_loop(sc); + sc->mpm_state = AP_MPMQ_RUNNING; + + if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { + sc->mpm_state = AP_MPMQ_STOPPING; + return 1; + } + + return simple_main_loop(sc); } -apr_status_t -ap_mpm_query(int query_code, int *result) +apr_status_t ap_mpm_query(int query_code, int *result) { - simple_core_t* sc = simple_core_get(); + simple_core_t *sc = simple_core_get(); - switch (query_code) { + switch (query_code) { case AP_MPMQ_IS_THREADED: - *result = AP_MPMQ_STATIC; - return APR_SUCCESS; - break; + *result = AP_MPMQ_STATIC; + return APR_SUCCESS; + break; case AP_MPMQ_IS_FORKED: - *result = AP_MPMQ_DYNAMIC; - return APR_SUCCESS; - break; + *result = AP_MPMQ_DYNAMIC; + return APR_SUCCESS; + break; case AP_MPMQ_IS_ASYNC: - *result = 1; - return APR_SUCCESS; - break; + *result = 1; + return APR_SUCCESS; + break; case AP_MPMQ_MAX_DAEMON_USED: - *result = sc->procmgr.proc_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.proc_count; + return APR_SUCCESS; + break; case AP_MPMQ_HARD_LIMIT_DAEMONS: - *result = sc->procmgr.proc_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.proc_count; + return APR_SUCCESS; + break; case AP_MPMQ_HARD_LIMIT_THREADS: - *result = sc->procmgr.thread_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.thread_count; + return APR_SUCCESS; + break; case AP_MPMQ_MAX_THREADS: - *result = sc->procmgr.thread_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.thread_count; + return APR_SUCCESS; + break; case AP_MPMQ_MAX_SPARE_DAEMONS: - *result = sc->procmgr.proc_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.proc_count; + return APR_SUCCESS; + break; case AP_MPMQ_MIN_SPARE_DAEMONS: - *result = sc->procmgr.proc_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.proc_count; + return APR_SUCCESS; + break; case AP_MPMQ_MIN_SPARE_THREADS: case AP_MPMQ_MAX_SPARE_THREADS: - *result = sc->procmgr.thread_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.thread_count; + return APR_SUCCESS; + break; case AP_MPMQ_MAX_REQUESTS_DAEMON: - *result = sc->procmgr.max_requests_per_child; - return APR_SUCCESS; - break; + *result = sc->procmgr.max_requests_per_child; + return APR_SUCCESS; + break; case AP_MPMQ_MAX_DAEMONS: - *result = sc->procmgr.proc_count; - return APR_SUCCESS; - break; + *result = sc->procmgr.proc_count; + return APR_SUCCESS; + break; case AP_MPMQ_MPM_STATE: - *result = sc->mpm_state; - return APR_SUCCESS; + *result = sc->mpm_state; + return APR_SUCCESS; default: - break; - } + break; + } - return APR_ENOTIMPL; + return APR_ENOTIMPL; } static int -simple_open_logs(apr_pool_t *p, - apr_pool_t *plog, - apr_pool_t *ptemp, - server_rec *s) +simple_open_logs(apr_pool_t * p, + apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s) { - int nsock; + int nsock; - ap_server_conf = s; - - nsock = ap_setup_listeners(s); - - if (nsock < 1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, 0, - s, - "simple_open_logs: no listening sockets available, shutting down"); - return DONE; - } + ap_server_conf = s; - return OK; + nsock = ap_setup_listeners(s); + + if (nsock < 1) { + ap_log_error(APLOG_MARK, APLOG_ALERT, 0, + s, + "simple_open_logs: no listening sockets available, shutting down"); + return DONE; + } + + return OK; } -static int -simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog, - apr_pool_t *ptemp) +static int +simple_pre_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp) { - int run_debug; - apr_status_t rv; - simple_core_t* sc = simple_core_get(); - - sc->restart_num++; - - run_debug = ap_exists_config_define("DEBUG"); - - if (run_debug) { - sc->run_foreground = 1; - sc->run_single_process = 1; - } - else { - sc->run_foreground = ap_exists_config_define("FOREGROUND"); - } - - if (sc->restart_num == 2) { - - if (sc->run_foreground) { - rv = apr_proc_detach(APR_PROC_DETACH_FOREGROUND); + int run_debug; + apr_status_t rv; + simple_core_t *sc = simple_core_get(); + + sc->restart_num++; + + run_debug = ap_exists_config_define("DEBUG"); + + if (run_debug) { + sc->run_foreground = 1; + sc->run_single_process = 1; } else { - rv = apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + sc->run_foreground = ap_exists_config_define("FOREGROUND"); } - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_pre_config: apr_proc_detach(%s) failed", - sc->run_foreground ? "FOREGROUND" : "DAEMONIZE"); - return HTTP_INTERNAL_SERVER_ERROR; + if (sc->restart_num == 2) { + + if (sc->run_foreground) { + rv = apr_proc_detach(APR_PROC_DETACH_FOREGROUND); + } + else { + rv = apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + } + + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_pre_config: apr_proc_detach(%s) failed", + sc->run_foreground ? "FOREGROUND" : "DAEMONIZE"); + return HTTP_INTERNAL_SERVER_ERROR; + } } - } - return OK; + return OK; } -static void -simple_process_start(process_rec *process) +static void simple_process_start(process_rec * process) { - apr_status_t rv; + apr_status_t rv; - /* this is our first 'real' entry point, so setup everything here. */ - rv = simple_core_init(simple_core_get(), process->pool); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_core_init: Fatal Error Encountered"); - exit(EXIT_FAILURE); - } + /* this is our first 'real' entry point, so setup everything here. */ + rv = simple_core_init(simple_core_get(), process->pool); - ap_mpm_rewrite_args(process); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_core_init: Fatal Error Encountered"); + exit(EXIT_FAILURE); + } + + ap_mpm_rewrite_args(process); } #define SIMPLE_MAX_PROC (500000) @@ -209,104 +200,101 @@ #define SIMPLE_MIN_THREADS (1) static int -simple_check_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) +simple_check_config(apr_pool_t * p, apr_pool_t * plog, + apr_pool_t * ptemp, server_rec * s) { - simple_core_t* sc = simple_core_get(); + simple_core_t *sc = simple_core_get(); + + if (sc->procmgr.proc_count > SIMPLE_MAX_PROC) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, + "simple_check_config: SimpleProcCount must be less than %d", + SIMPLE_MAX_PROC); + return !OK; + } + + if (sc->procmgr.proc_count < SIMPLE_MIN_PROC) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, + "simple_check_config: SimpleProcCount must be more than %d", + SIMPLE_MIN_PROC); + return !OK; + } + + if (sc->procmgr.thread_count > SIMPLE_MAX_THREADS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, + "simple_check_config: SimpleThreadCount must be less than %d", + SIMPLE_MAX_THREADS); + return !OK; + } - if (sc->procmgr.proc_count > SIMPLE_MAX_PROC) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, - "simple_check_config: SimpleProcCount must be less than %d", SIMPLE_MAX_PROC); - return !OK; - } - - if (sc->procmgr.proc_count < SIMPLE_MIN_PROC) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, - "simple_check_config: SimpleProcCount must be more than %d", SIMPLE_MIN_PROC); - return !OK; - } - - if (sc->procmgr.thread_count > SIMPLE_MAX_THREADS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, - "simple_check_config: SimpleThreadCount must be less than %d", SIMPLE_MAX_THREADS); - return !OK; - } - - if (sc->procmgr.thread_count < SIMPLE_MIN_THREADS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, - "simple_check_config: SimpleThreadCount must be more than %d", SIMPLE_MIN_THREADS); - return !OK; - } + if (sc->procmgr.thread_count < SIMPLE_MIN_THREADS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, + "simple_check_config: SimpleThreadCount must be more than %d", + SIMPLE_MIN_THREADS); + return !OK; + } - return OK; + return OK; } - -static void -simple_hooks(apr_pool_t *p) + +static void simple_hooks(apr_pool_t * p) { - static const char *const aszSucc[] = {"core.c", NULL}; + static const char *const aszSucc[] = { "core.c", NULL }; - ap_hook_open_logs(simple_open_logs, NULL, - aszSucc, APR_HOOK_REALLY_FIRST); + ap_hook_open_logs(simple_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST); - ap_hook_pre_config(simple_pre_config, - NULL, NULL, APR_HOOK_REALLY_FIRST); + ap_hook_pre_config(simple_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); - ap_hook_check_config(simple_check_config, - NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_check_config(simple_check_config, NULL, NULL, APR_HOOK_MIDDLE); } -static const char* -set_proccount(cmd_parms *cmd, void *baton, const char *arg) +static const char *set_proccount(cmd_parms * cmd, void *baton, + const char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - simple_core_get()->procmgr.proc_count = atoi(arg); - return NULL; + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + if (err != NULL) { + return err; + } + + simple_core_get()->procmgr.proc_count = atoi(arg); + return NULL; } -static const char* -set_threadcount(cmd_parms *cmd, void *baton, const char *arg) +static const char *set_threadcount(cmd_parms * cmd, void *baton, + const char *arg) { - simple_core_t *sc = simple_core_get(); - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + simple_core_t *sc = simple_core_get(); + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } + if (err != NULL) { + return err; + } - sc->procmgr.thread_count = atoi(arg); + sc->procmgr.thread_count = atoi(arg); - return NULL; + return NULL; } static const command_rec simple_cmds[] = { - AP_INIT_TAKE1("SimpleProcCount", set_proccount, NULL, RSRC_CONF, - "Number of child processes launched at server startup"), - AP_INIT_TAKE1("SimpleThreadCount", set_threadcount, NULL, RSRC_CONF, - "Set the number of Worker Threads Per-Process"), - /* pqXXXXXXXXX: These do NOT belong in the MPM configuration commands. */ - LISTEN_COMMANDS, - { NULL } + AP_INIT_TAKE1("SimpleProcCount", set_proccount, NULL, RSRC_CONF, + "Number of child processes launched at server startup"), + AP_INIT_TAKE1("SimpleThreadCount", set_threadcount, NULL, RSRC_CONF, + "Set the number of Worker Threads Per-Process"), + /* pqXXXXXXXXX: These do NOT belong in the MPM configuration commands. */ + LISTEN_COMMANDS, + {NULL} }; module AP_MODULE_DECLARE_DATA mpm_simple_module = { - MPM20_MODULE_STUFF, - simple_process_start, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - simple_cmds, /* command apr_table_t */ - simple_hooks /* register_hooks */ + MPM20_MODULE_STUFF, + simple_process_start, /* hook to run before apache parses args */ + NULL, /* create per-directory config structure */ + NULL, /* merge per-directory config structures */ + NULL, /* create per-server config structure */ + NULL, /* merge per-server config structures */ + simple_cmds, /* command apr_table_t */ + simple_hooks /* register_hooks */ }; - - - Modified: httpd/httpd/trunk/server/mpm/simple/simple_api.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_api.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_api.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_api.h Wed Oct 29 18:50:09 2008 @@ -27,17 +27,17 @@ #define APACHE_MPM_SIMPLE_API_H #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /* Called after child as forked, before child_init, to be used by modules that * wish to chroot or change the processes running UserID before we begin serving requests. */ -AP_DECLARE_HOOK(int,simple_drop_privileges,(apr_pool_t *pchild, server_rec *s)) - + AP_DECLARE_HOOK(int, simple_drop_privileges, + (apr_pool_t * pchild, server_rec * s)) #ifdef __cplusplus } #endif -#endif /* APACHE_MPM_SIMPLE_API_H */ - +#endif /* APACHE_MPM_SIMPLE_API_H */ Modified: httpd/httpd/trunk/server/mpm/simple/simple_children.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_children.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_children.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_children.c Wed Oct 29 18:50:09 2008 @@ -24,83 +24,72 @@ #define SPAWN_CHILDREN_INTERVAL (apr_time_from_sec(5)) -static void -simple_kill_random_child(simple_core_t *sc) +static void simple_kill_random_child(simple_core_t * sc) { - apr_thread_mutex_lock(sc->mtx); - /* See comment in simple_spawn_child for why we check here. */ - if (!sc->run_single_process) { - } - apr_thread_mutex_unlock(sc->mtx); + apr_thread_mutex_lock(sc->mtx); + /* See comment in simple_spawn_child for why we check here. */ + if (!sc->run_single_process) { + } + apr_thread_mutex_unlock(sc->mtx); } -static void -simple_spawn_child(simple_core_t *sc) +static void simple_spawn_child(simple_core_t * sc) { - apr_thread_mutex_lock(sc->mtx); - /* Although we could cut this off 'earlier', and not even invoke this - * function, I would like to keep the functions invoked when in debug mode - * to be as close as possible to those when not in debug... So, we just skip - * the actual spawn itself, but go through all of the motions... - */ - if (!sc->run_single_process) { - - } - apr_thread_mutex_unlock(sc->mtx); + apr_thread_mutex_lock(sc->mtx); + /* Although we could cut this off 'earlier', and not even invoke this + * function, I would like to keep the functions invoked when in debug mode + * to be as close as possible to those when not in debug... So, we just skip + * the actual spawn itself, but go through all of the motions... + */ + if (!sc->run_single_process) { + + } + apr_thread_mutex_unlock(sc->mtx); } -void -simple_check_children_size(simple_core_t *sc, - void *baton) +void simple_check_children_size(simple_core_t * sc, void *baton) { - unsigned int count; - int wanted; - int i; - - simple_register_timer(sc, - simple_check_children_size, - NULL, - SPAWN_CHILDREN_INTERVAL); - - if (sc->run_single_process && sc->restart_num == 2) { - static int run = 0; - /* This is kinda of hack, but rather than spawning a child process, - * we register the normal IO handlers in the main event loop.... - */ - if (run == 0) { - simple_single_process_hack(sc); - run++; + unsigned int count; + int wanted; + int i; + + simple_register_timer(sc, + simple_check_children_size, + NULL, SPAWN_CHILDREN_INTERVAL); + + if (sc->run_single_process && sc->restart_num == 2) { + static int run = 0; + /* This is kinda of hack, but rather than spawning a child process, + * we register the normal IO handlers in the main event loop.... + */ + if (run == 0) { + simple_single_process_hack(sc); + run++; + } } - } - - { - apr_thread_mutex_lock(sc->mtx); - count = apr_hash_count(sc->children); - wanted = sc->procmgr.proc_count; - apr_thread_mutex_unlock(sc->mtx); - } - if (count > wanted) { - /* kill some kids */ - int to_kill = count - wanted; - for (i = 0; - i < to_kill; - i++) { - simple_kill_random_child(sc); + apr_thread_mutex_lock(sc->mtx); + count = apr_hash_count(sc->children); + wanted = sc->procmgr.proc_count; + apr_thread_mutex_unlock(sc->mtx); } - } - else if (count < wanted) { - /* spawn some kids */ - int to_spawn = wanted - count; - for (i = 0; - i < to_spawn; - i++) - { - simple_spawn_child(sc); + + if (count > wanted) { + /* kill some kids */ + int to_kill = count - wanted; + for (i = 0; i < to_kill; i++) { + simple_kill_random_child(sc); + } + } + else if (count < wanted) { + /* spawn some kids */ + int to_spawn = wanted - count; + for (i = 0; i < to_spawn; i++) { + simple_spawn_child(sc); + } + } + else { + /* juuuuust right. */ } - } - else { - /* juuuuust right. */ - } } Modified: httpd/httpd/trunk/server/mpm/simple/simple_children.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_children.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_children.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_children.h Wed Oct 29 18:50:09 2008 @@ -20,13 +20,9 @@ #ifndef APACHE_MPM_SIMPLE_CHILDREN_H #define APACHE_MPM_SIMPLE_CHILDREN_H -void -simple_check_children_size(simple_core_t *sc, - void *baton); +void simple_check_children_size(simple_core_t * sc, void *baton); -void -simple_check_children_status(simple_core_t *sc, - void *baton); +void simple_check_children_status(simple_core_t * sc, void *baton); #endif /* APACHE_MPM_SIMPLE_CHILDREN_H */ Modified: httpd/httpd/trunk/server/mpm/simple/simple_core.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_core.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_core.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_core.c Wed Oct 29 18:50:09 2008 @@ -16,7 +16,7 @@ /* Simple Core utility methods. */ - + #include "simple_types.h" #include "mpm.h" #include "ap_mpm.h" @@ -30,53 +30,45 @@ #endif -simple_core_t* -simple_core_get() +simple_core_t *simple_core_get() { - return &g_simple_core; + return &g_simple_core; } -apr_status_t -simple_core_init(simple_core_t* sc, apr_pool_t* pool) +apr_status_t simple_core_init(simple_core_t * sc, apr_pool_t * pool) { - apr_status_t rv; + apr_status_t rv; - memset(sc, 0, sizeof(simple_core_t)); - - apr_pool_create(&sc->pool, pool); - - apr_pool_tag(sc->pool, "simple-mpm-core"); - - sc->mpm_state = AP_MPMQ_STARTING; - sc->procmgr.max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - - sc->children = apr_hash_make(sc->pool); - - APR_RING_INIT(&sc->timer_ring, simple_timer_t, link); - APR_RING_INIT(&sc->dead_timer_ring, simple_timer_t, link); - - rv = apr_thread_mutex_create(&sc->mtx, - 0, - sc->pool); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_core_init: apr_thread_mutex_create failed."); - return rv; - } - - rv = apr_pollcb_create(&sc->pollcb, - 512 /* pqXXXXX: make configrable */, - sc->pool, - 0); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_core_init: apr_pollcb_create failed."); - return rv; - } + memset(sc, 0, sizeof(simple_core_t)); - return APR_SUCCESS; -} + apr_pool_create(&sc->pool, pool); + + apr_pool_tag(sc->pool, "simple-mpm-core"); + + sc->mpm_state = AP_MPMQ_STARTING; + sc->procmgr.max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; + + sc->children = apr_hash_make(sc->pool); + APR_RING_INIT(&sc->timer_ring, simple_timer_t, link); + APR_RING_INIT(&sc->dead_timer_ring, simple_timer_t, link); + rv = apr_thread_mutex_create(&sc->mtx, 0, sc->pool); + + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_core_init: apr_thread_mutex_create failed."); + return rv; + } + + rv = apr_pollcb_create(&sc->pollcb, 512 /* pqXXXXX: make configrable */ , + sc->pool, 0); + + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_core_init: apr_pollcb_create failed."); + return rv; + } + + return APR_SUCCESS; +} Modified: httpd/httpd/trunk/server/mpm/simple/simple_event.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_event.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_event.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_event.c Wed Oct 29 18:50:09 2008 @@ -19,63 +19,64 @@ #include "simple_types.h" #include "simple_event.h" -void -simple_register_timer(simple_core_t *sc, - simple_timer_cb cb, - void *baton, - apr_time_t relative_time) +void +simple_register_timer(simple_core_t * sc, + simple_timer_cb cb, + void *baton, apr_time_t relative_time) { - simple_timer_t *elem = NULL; - simple_timer_t *ep = NULL; - int inserted = 0; - apr_time_t t = apr_time_now() + relative_time; - - apr_thread_mutex_lock(sc->mtx); - - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - APR_RING_CHECK_CONSISTENCY(&sc->dead_timer_ring, simple_timer_t, link); - - if (!APR_RING_EMPTY(&sc->dead_timer_ring, simple_timer_t, link)) { - elem = APR_RING_FIRST(&sc->dead_timer_ring); - APR_RING_REMOVE(elem, link); + simple_timer_t *elem = NULL; + simple_timer_t *ep = NULL; + int inserted = 0; + apr_time_t t = apr_time_now() + relative_time; + + apr_thread_mutex_lock(sc->mtx); + + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); APR_RING_CHECK_CONSISTENCY(&sc->dead_timer_ring, simple_timer_t, link); - } - else { - elem = (simple_timer_t *) apr_pcalloc(sc->pool, sizeof(simple_timer_t)); - } - - APR_RING_ELEM_INIT(elem, link); - elem->expires = t; - elem->cb = cb; - elem->baton = baton; - - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - - /* pqXXXXXX: skiplist would be a nice optimization here. */ - if (!APR_RING_EMPTY(&sc->timer_ring, simple_timer_t, link)) { - ep = APR_RING_FIRST(&sc->timer_ring); - while (inserted == 0 && - ep != APR_RING_SENTINEL(&sc->timer_ring, simple_timer_t, link)) - { - if (ep->expires < elem->expires) { - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - APR_RING_INSERT_BEFORE(ep, elem, link); - inserted = 1; - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - } - ep = APR_RING_NEXT(ep, link); + + if (!APR_RING_EMPTY(&sc->dead_timer_ring, simple_timer_t, link)) { + elem = APR_RING_FIRST(&sc->dead_timer_ring); + APR_RING_REMOVE(elem, link); + APR_RING_CHECK_CONSISTENCY(&sc->dead_timer_ring, simple_timer_t, + link); + } + else { + elem = + (simple_timer_t *) apr_pcalloc(sc->pool, sizeof(simple_timer_t)); } - } - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); + APR_RING_ELEM_INIT(elem, link); + elem->expires = t; + elem->cb = cb; + elem->baton = baton; + + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); + + /* pqXXXXXX: skiplist would be a nice optimization here. */ + if (!APR_RING_EMPTY(&sc->timer_ring, simple_timer_t, link)) { + ep = APR_RING_FIRST(&sc->timer_ring); + while (inserted == 0 && + ep != APR_RING_SENTINEL(&sc->timer_ring, simple_timer_t, link)) + { + if (ep->expires < elem->expires) { + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, + link); + APR_RING_INSERT_BEFORE(ep, elem, link); + inserted = 1; + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, + link); + } + ep = APR_RING_NEXT(ep, link); + } + } + + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - if (!inserted) { - APR_RING_INSERT_TAIL(&sc->timer_ring, - elem, simple_timer_t, link); - } + if (!inserted) { + APR_RING_INSERT_TAIL(&sc->timer_ring, elem, simple_timer_t, link); + } - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - apr_thread_mutex_unlock(sc->mtx); + apr_thread_mutex_unlock(sc->mtx); } - Modified: httpd/httpd/trunk/server/mpm/simple/simple_event.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_event.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_event.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_event.h Wed Oct 29 18:50:09 2008 @@ -24,34 +24,30 @@ /* pqXXXXXX: Pool based cleanups */ -void -simple_register_timer(simple_core_t *sc, - simple_timer_cb cb, - void *baton, - apr_time_t relative_time); +void +simple_register_timer(simple_core_t * sc, + simple_timer_cb cb, + void *baton, apr_time_t relative_time); /** * @see apr_poll.h for watch_for values */ void -simple_register_sock_io(simple_core_t *sc, - simple_io_sock_cb cb, +simple_register_sock_io(simple_core_t * sc, + simple_io_sock_cb cb, void *baton, - apr_socket_t *sock, - int watch_for, - apr_time_t relative_timeout); + apr_socket_t * sock, + int watch_for, apr_time_t relative_timeout); /** * @see apr_poll.h for watch_for values */ void -simple_register_file_io(simple_core_t *sc, - simple_io_file_cb cb, +simple_register_file_io(simple_core_t * sc, + simple_io_file_cb cb, void *baton, - apr_file_t *file, - int watch_for, - apr_time_t relative_timeout); + apr_file_t * file, + int watch_for, apr_time_t relative_timeout); #endif /* APACHE_MPM_SIMPLE_EVENT_H */ - Modified: httpd/httpd/trunk/server/mpm/simple/simple_io.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_io.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_io.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_io.c Wed Oct 29 18:50:09 2008 @@ -28,257 +28,252 @@ #include "scoreboard.h" #include "http_vhost.h" -static void -simple_io_timeout_cb(simple_core_t *sc, - void *baton) +static void simple_io_timeout_cb(simple_core_t * sc, void *baton) { - simple_conn_t *scon = (simple_conn_t *)baton; - /* pqXXXXX: handle timeouts. */ - conn_rec *c = scon->c; - conn_state_t *cs = c->cs; + simple_conn_t *scon = (simple_conn_t *) baton; + /* pqXXXXX: handle timeouts. */ + conn_rec *c = scon->c; + conn_state_t *cs = c->cs; - cs = NULL; + cs = NULL; - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, - "io timeout hit (?)"); + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, + "io timeout hit (?)"); } -static apr_status_t -simple_io_process(simple_conn_t *scon) +static apr_status_t simple_io_process(simple_conn_t * scon) { - apr_status_t rv; - simple_core_t *sc; - conn_rec *c; - conn_state_t *cs; - - if (scon->c->clogging_input_filters && !scon->c->aborted) { - /* Since we have an input filter which 'cloggs' the input stream, - * like mod_ssl, lets just do the normal read from input filters, - * like the Worker MPM does. - */ - ap_run_process_connection(scon->c); - if (scon->c->cs->state != CONN_STATE_SUSPENDED) { - scon->c->cs->state = CONN_STATE_LINGER; - } - } + apr_status_t rv; + simple_core_t *sc; + conn_rec *c; + conn_state_t *cs; - sc = scon->sc; - c = scon->c; - cs = c->cs; - - while (!c->aborted) { - if (cs->state == CONN_STATE_READ_REQUEST_LINE) { - if (!c->aborted) { - ap_run_process_connection(c); - /* state will be updated upon return - * fall thru to either wait for readability/timeout or - * do lingering close + if (scon->c->clogging_input_filters && !scon->c->aborted) { + /* Since we have an input filter which 'cloggs' the input stream, + * like mod_ssl, lets just do the normal read from input filters, + * like the Worker MPM does. */ - } - else { - cs->state = CONN_STATE_LINGER; - } + ap_run_process_connection(scon->c); + if (scon->c->cs->state != CONN_STATE_SUSPENDED) { + scon->c->cs->state = CONN_STATE_LINGER; + } } - if (cs->state == CONN_STATE_WRITE_COMPLETION) { - ap_filter_t *output_filter = c->output_filters; - while (output_filter->next != NULL) { - output_filter = output_filter->next; - } - - rv = output_filter->frec->filter_func.out_func(output_filter, NULL); - - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "network write failure in core output filter"); - cs->state = CONN_STATE_LINGER; - } - else if (c->data_in_output_filters) { - /* Still in WRITE_COMPLETION_STATE: - * Set a write timeout for this connection, and let the - * event thread poll for writeability. - */ + sc = scon->sc; + c = scon->c; + cs = c->cs; + + while (!c->aborted) { + if (cs->state == CONN_STATE_READ_REQUEST_LINE) { + if (!c->aborted) { + ap_run_process_connection(c); + /* state will be updated upon return + * fall thru to either wait for readability/timeout or + * do lingering close + */ + } + else { + cs->state = CONN_STATE_LINGER; + } + } - simple_register_timer(scon->sc, - simple_io_timeout_cb, - scon, - scon->c->base_server != NULL ? scon->c->base_server->timeout : ap_server_conf->timeout); - - cs->pfd.reqevents = APR_POLLOUT | APR_POLLHUP | APR_POLLERR; - - rv = apr_pollcb_add(sc->pollcb, &cs->pfd); - - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "apr_pollcb_add: failed in write completion"); - AP_DEBUG_ASSERT(rv == APR_SUCCESS); + if (cs->state == CONN_STATE_WRITE_COMPLETION) { + ap_filter_t *output_filter = c->output_filters; + while (output_filter->next != NULL) { + output_filter = output_filter->next; + } + + rv = output_filter->frec->filter_func.out_func(output_filter, + NULL); + + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, + "network write failure in core output filter"); + cs->state = CONN_STATE_LINGER; + } + else if (c->data_in_output_filters) { + /* Still in WRITE_COMPLETION_STATE: + * Set a write timeout for this connection, and let the + * event thread poll for writeability. + */ + + simple_register_timer(scon->sc, + simple_io_timeout_cb, + scon, + scon->c->base_server != + NULL ? scon->c->base_server-> + timeout : ap_server_conf->timeout); + + cs->pfd.reqevents = APR_POLLOUT | APR_POLLHUP | APR_POLLERR; + + rv = apr_pollcb_add(sc->pollcb, &cs->pfd); + + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_WARNING, rv, + ap_server_conf, + "apr_pollcb_add: failed in write completion"); + AP_DEBUG_ASSERT(rv == APR_SUCCESS); + } + return APR_SUCCESS; + } + else if (c->keepalive != AP_CONN_KEEPALIVE || c->aborted) { + c->cs->state = CONN_STATE_LINGER; + } + else if (c->data_in_input_filters) { + cs->state = CONN_STATE_READ_REQUEST_LINE; + } + else { + cs->state = CONN_STATE_CHECK_REQUEST_LINE_READABLE; + } } - return APR_SUCCESS; - } - else if (c->keepalive != AP_CONN_KEEPALIVE || c->aborted) { - c->cs->state = CONN_STATE_LINGER; - } - else if (c->data_in_input_filters) { - cs->state = CONN_STATE_READ_REQUEST_LINE; - } - else { - cs->state = CONN_STATE_CHECK_REQUEST_LINE_READABLE; - } - } - if (cs->state == CONN_STATE_LINGER) { - ap_lingering_close(c); - apr_pool_destroy(scon->pool); - return APR_SUCCESS; - } + if (cs->state == CONN_STATE_LINGER) { + ap_lingering_close(c); + apr_pool_destroy(scon->pool); + return APR_SUCCESS; + } - if (cs->state == CONN_STATE_CHECK_REQUEST_LINE_READABLE) { - simple_register_timer(scon->sc, - simple_io_timeout_cb, - scon, - scon->c->base_server != NULL ? scon->c->base_server->timeout : ap_server_conf->timeout); - - cs->pfd.reqevents = APR_POLLIN; - - rv = apr_pollcb_add(sc->pollcb, &cs->pfd); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "process_socket: apr_pollset_add failure in read request line"); - AP_DEBUG_ASSERT(rv == APR_SUCCESS); - } + if (cs->state == CONN_STATE_CHECK_REQUEST_LINE_READABLE) { + simple_register_timer(scon->sc, + simple_io_timeout_cb, + scon, + scon->c->base_server != + NULL ? scon->c->base_server-> + timeout : ap_server_conf->timeout); + + cs->pfd.reqevents = APR_POLLIN; + + rv = apr_pollcb_add(sc->pollcb, &cs->pfd); + + if (rv) { + ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, + "process_socket: apr_pollset_add failure in read request line"); + AP_DEBUG_ASSERT(rv == APR_SUCCESS); + } - return APR_SUCCESS; + return APR_SUCCESS; + } } - } - ap_lingering_close(c); - apr_pool_destroy(scon->pool); - return APR_SUCCESS; + ap_lingering_close(c); + apr_pool_destroy(scon->pool); + return APR_SUCCESS; } -static void * -simple_io_invoke(apr_thread_t* thread, void *baton) +static void *simple_io_invoke(apr_thread_t * thread, void *baton) { - simple_sb_t *sb = (simple_sb_t *)baton; - simple_conn_t *scon = (simple_conn_t *)sb->baton; - apr_status_t rv; - - rv = simple_io_process(scon); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, - "simple_io_invoke: simple_io_process failed (?)"); - } + simple_sb_t *sb = (simple_sb_t *) baton; + simple_conn_t *scon = (simple_conn_t *) sb->baton; + apr_status_t rv; + + rv = simple_io_process(scon); - return NULL; + if (rv) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, + "simple_io_invoke: simple_io_process failed (?)"); + } + + return NULL; } -static void * -simple_io_setup_conn(apr_thread_t* thread, void *baton) +static void *simple_io_setup_conn(apr_thread_t * thread, void *baton) { - apr_status_t rv; - ap_sb_handle_t *sbh; - conn_state_t *cs; - long conn_id = 0; - simple_sb_t *sb; - simple_conn_t *scon = (simple_conn_t *)baton; + apr_status_t rv; + ap_sb_handle_t *sbh; + conn_state_t *cs; + long conn_id = 0; + simple_sb_t *sb; + simple_conn_t *scon = (simple_conn_t *) baton; - /* pqXXXXX: remove this. */ - ap_create_sb_handle(&sbh, scon->pool, 0, 0); + /* pqXXXXX: remove this. */ + ap_create_sb_handle(&sbh, scon->pool, 0, 0); - scon->ba = apr_bucket_alloc_create(scon->pool); + scon->ba = apr_bucket_alloc_create(scon->pool); - scon->c = ap_run_create_connection(scon->pool, ap_server_conf, scon->sock, - conn_id, sbh, scon->ba); + scon->c = ap_run_create_connection(scon->pool, ap_server_conf, scon->sock, + conn_id, sbh, scon->ba); - scon->c->cs = apr_pcalloc(scon->pool, sizeof(conn_state_t)); - cs = scon->c->cs; - sb = apr_pcalloc(scon->pool, sizeof(simple_sb_t)); + scon->c->cs = apr_pcalloc(scon->pool, sizeof(conn_state_t)); + cs = scon->c->cs; + sb = apr_pcalloc(scon->pool, sizeof(simple_sb_t)); - cs->pfd.p = scon->pool; - cs->pfd.desc_type = APR_POLL_SOCKET; - cs->pfd.desc.s = scon->sock; - cs->pfd.reqevents = APR_POLLIN; + cs->pfd.p = scon->pool; + cs->pfd.desc_type = APR_POLL_SOCKET; + cs->pfd.desc.s = scon->sock; + cs->pfd.reqevents = APR_POLLIN; - sb->type = SIMPLE_PT_CORE_IO; - sb->baton = scon; - cs->pfd.client_data = sb; + sb->type = SIMPLE_PT_CORE_IO; + sb->baton = scon; + cs->pfd.client_data = sb; - ap_update_vhost_given_ip(scon->c); + ap_update_vhost_given_ip(scon->c); - rv = ap_run_pre_connection(scon->c, scon->sock); - if (rv != OK && rv != DONE) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, - "simple_io_setup_conn: connection aborted"); - scon->c->aborted = 1; - } + rv = ap_run_pre_connection(scon->c, scon->sock); + if (rv != OK && rv != DONE) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, + "simple_io_setup_conn: connection aborted"); + scon->c->aborted = 1; + } - scon->c->cs->state = CONN_STATE_READ_REQUEST_LINE; + scon->c->cs->state = CONN_STATE_READ_REQUEST_LINE; - rv = simple_io_process(scon); + rv = simple_io_process(scon); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, - "simple_io_setup_conn: simple_io_process failed (?)"); - } + if (rv) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, + "simple_io_setup_conn: simple_io_process failed (?)"); + } - return NULL; + return NULL; } -apr_status_t -simple_io_accept(simple_core_t *sc, simple_sb_t *sb) +apr_status_t simple_io_accept(simple_core_t * sc, simple_sb_t * sb) { - apr_status_t rv; - apr_pool_t *ptrans; - apr_socket_t *socket; - ap_listen_rec *lr = (ap_listen_rec *)sb->baton; - - /* pqXXXXXX: Consider doing pool recycling like the event/worker MPMs do. */ - apr_pool_create(&ptrans, NULL); - - apr_pool_tag(ptrans, "transaction"); - - rv = apr_socket_accept(&socket, lr->sd, ptrans); - if (rv) { - /* pqXXXXXX: unixd.c has _tons_ of custom handling on return values - * from accept, but it seems really crazy, it either worked, or didn't, - * but taking this approach of swallowing the error it is possible we have a - * fatal error on our listening socket, but we don't notice. - * - * Need to discuss this on dev@ - */ - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_io_accept: apr_socket_accept failed"); - return APR_SUCCESS; - } - else { - simple_conn_t *scon = apr_pcalloc(ptrans, sizeof(simple_conn_t)); - scon->pool = ptrans; - scon->sock = socket; - scon->sc = sc; + apr_status_t rv; + apr_pool_t *ptrans; + apr_socket_t *socket; + ap_listen_rec *lr = (ap_listen_rec *) sb->baton; - return apr_thread_pool_push(sc->workers, - simple_io_setup_conn, - scon, - APR_THREAD_TASK_PRIORITY_NORMAL, - NULL); - } + /* pqXXXXXX: Consider doing pool recycling like the event/worker MPMs do. */ + apr_pool_create(&ptrans, NULL); + + apr_pool_tag(ptrans, "transaction"); + + rv = apr_socket_accept(&socket, lr->sd, ptrans); + if (rv) { + /* pqXXXXXX: unixd.c has _tons_ of custom handling on return values + * from accept, but it seems really crazy, it either worked, or didn't, + * but taking this approach of swallowing the error it is possible we have a + * fatal error on our listening socket, but we don't notice. + * + * Need to discuss this on dev@ + */ + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_io_accept: apr_socket_accept failed"); + return APR_SUCCESS; + } + else { + simple_conn_t *scon = apr_pcalloc(ptrans, sizeof(simple_conn_t)); + scon->pool = ptrans; + scon->sock = socket; + scon->sc = sc; + + return apr_thread_pool_push(sc->workers, + simple_io_setup_conn, + scon, + APR_THREAD_TASK_PRIORITY_NORMAL, NULL); + } - return APR_SUCCESS; + return APR_SUCCESS; } -apr_status_t -simple_io_event_process(simple_core_t *sc, simple_sb_t *sb) +apr_status_t simple_io_event_process(simple_core_t * sc, simple_sb_t * sb) { - /* pqXXXXX: In theory, if we have non-blocking operations on the connection - * we can do them here, before pushing to another thread, thats just - * not implemented right now. - */ - return apr_thread_pool_push(sc->workers, - simple_io_invoke, - sb, - APR_THREAD_TASK_PRIORITY_NORMAL, - NULL); + /* pqXXXXX: In theory, if we have non-blocking operations on the connection + * we can do them here, before pushing to another thread, thats just + * not implemented right now. + */ + return apr_thread_pool_push(sc->workers, + simple_io_invoke, + sb, APR_THREAD_TASK_PRIORITY_NORMAL, NULL); } - Modified: httpd/httpd/trunk/server/mpm/simple/simple_io.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_io.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_io.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_io.h Wed Oct 29 18:50:09 2008 @@ -19,10 +19,8 @@ #ifndef APACHE_MPM_SIMPLE_IO_H #define APACHE_MPM_SIMPLE_IO_H -apr_status_t -simple_io_accept(simple_core_t *sc, simple_sb_t *sb); +apr_status_t simple_io_accept(simple_core_t * sc, simple_sb_t * sb); -apr_status_t -simple_io_event_process(simple_core_t *sc, simple_sb_t *sb); +apr_status_t simple_io_event_process(simple_core_t * sc, simple_sb_t * sb); #endif Modified: httpd/httpd/trunk/server/mpm/simple/simple_run.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_run.c?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_run.c (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_run.c Wed Oct 29 18:50:09 2008 @@ -33,303 +33,287 @@ /** * Create Timers. */ -static apr_status_t -simple_main_setup_timers(simple_core_t *sc) +static apr_status_t simple_main_setup_timers(simple_core_t * sc) { - simple_register_timer(sc, - simple_check_children_size, - NULL, - 0); + simple_register_timer(sc, simple_check_children_size, NULL, 0); - return APR_SUCCESS; + return APR_SUCCESS; } /** * Create worker thread pool. */ -static apr_status_t -simple_setup_workers(simple_core_t *sc) +static apr_status_t simple_setup_workers(simple_core_t * sc) { - apr_status_t rv; + apr_status_t rv; - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, - "simple_setup_workers: spawning %d threads", sc->procmgr.thread_count); + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, + "simple_setup_workers: spawning %d threads", + sc->procmgr.thread_count); + + rv = apr_thread_pool_create(&sc->workers, + sc->procmgr.thread_count, + sc->procmgr.thread_count, sc->pool); - rv = apr_thread_pool_create(&sc->workers, - sc->procmgr.thread_count, - sc->procmgr.thread_count, - sc->pool); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_setup_workers: apr_thread_pool_create with %d threads failed", sc->procmgr.thread_count); - return rv; - } + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_setup_workers: apr_thread_pool_create with %d threads failed", + sc->procmgr.thread_count); + return rv; + } - return APR_SUCCESS; + return APR_SUCCESS; } -static apr_status_t -simple_setup_listeners(simple_core_t *sc) +static apr_status_t simple_setup_listeners(simple_core_t * sc) { - ap_listen_rec *lr; - apr_status_t rv; - - for (lr = ap_listeners; lr != NULL; lr = lr->next) { - apr_pollfd_t *pfd = apr_palloc(sc->pool, sizeof(apr_pollfd_t)); - simple_sb_t *sb = apr_pcalloc(sc->pool, sizeof(simple_sb_t)); - - pfd->p = sc->pool; - pfd->desc_type = APR_POLL_SOCKET; - pfd->desc.s = lr->sd; - pfd->reqevents = APR_POLLIN; - - sb->type = SIMPLE_PT_CORE_ACCEPT; - sb->baton = lr; + ap_listen_rec *lr; + apr_status_t rv; - pfd->client_data = sb; + for (lr = ap_listeners; lr != NULL; lr = lr->next) { + apr_pollfd_t *pfd = apr_palloc(sc->pool, sizeof(apr_pollfd_t)); + simple_sb_t *sb = apr_pcalloc(sc->pool, sizeof(simple_sb_t)); + + pfd->p = sc->pool; + pfd->desc_type = APR_POLL_SOCKET; + pfd->desc.s = lr->sd; + pfd->reqevents = APR_POLLIN; + + sb->type = SIMPLE_PT_CORE_ACCEPT; + sb->baton = lr; + + pfd->client_data = sb; + + rv = apr_socket_opt_set(pfd->desc.s, APR_SO_NONBLOCK, 1); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_setup_workers: apr_socket_opt_set(APR_SO_NONBLOCK = 1) failed on %pI", + lr->bind_addr); + return rv; + } - rv = apr_socket_opt_set(pfd->desc.s, APR_SO_NONBLOCK, 1); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_setup_workers: apr_socket_opt_set(APR_SO_NONBLOCK = 1) failed on %pI", lr->bind_addr); - return rv; - } - - rv = apr_pollcb_add(sc->pollcb, pfd); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_setup_workers: apr_pollcb_add failed on %pI", lr->bind_addr); - return rv; + rv = apr_pollcb_add(sc->pollcb, pfd); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_setup_workers: apr_pollcb_add failed on %pI", + lr->bind_addr); + return rv; + } } - } - return APR_SUCCESS; + return APR_SUCCESS; } -static apr_status_t -simple_io_callback(void *baton, apr_pollfd_t *pfd) +static apr_status_t simple_io_callback(void *baton, apr_pollfd_t * pfd) { - apr_status_t rv = APR_SUCCESS; - simple_core_t *sc = (simple_core_t *)baton; - simple_sb_t *sb = pfd->client_data; - - - if (sb->type == SIMPLE_PT_CORE_ACCEPT) { - rv = simple_io_accept(sc, sb); - } - else if (sb->type == SIMPLE_PT_CORE_IO) { - rv = simple_io_event_process(sc, sb); - } - else if (sb->type == SIMPLE_PT_USER) { - /* TODO: */ - abort(); - } - else { - abort(); - } + apr_status_t rv = APR_SUCCESS; + simple_core_t *sc = (simple_core_t *) baton; + simple_sb_t *sb = pfd->client_data; + + + if (sb->type == SIMPLE_PT_CORE_ACCEPT) { + rv = simple_io_accept(sc, sb); + } + else if (sb->type == SIMPLE_PT_CORE_IO) { + rv = simple_io_event_process(sc, sb); + } + else if (sb->type == SIMPLE_PT_USER) { + /* TODO: */ + abort(); + } + else { + abort(); + } - return rv; + return rv; } -static void * -simple_timer_invoke(apr_thread_t* thread, void *baton) +static void *simple_timer_invoke(apr_thread_t * thread, void *baton) { - simple_timer_t *ep = (simple_timer_t *)baton; - simple_core_t *sc = simple_core_get(); + simple_timer_t *ep = (simple_timer_t *) baton; + simple_core_t *sc = simple_core_get(); - ep->cb(sc, ep->baton); - - apr_thread_mutex_lock(sc->mtx); - APR_RING_INSERT_TAIL(&sc->dead_timer_ring, ep, simple_timer_t, link); - apr_thread_mutex_unlock(sc->mtx); + ep->cb(sc, ep->baton); - return NULL; + apr_thread_mutex_lock(sc->mtx); + APR_RING_INSERT_TAIL(&sc->dead_timer_ring, ep, simple_timer_t, link); + apr_thread_mutex_unlock(sc->mtx); + + return NULL; } #ifndef apr_time_from_msec #define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000) #endif -static int -simple_run_loop(simple_core_t *sc) +static int simple_run_loop(simple_core_t * sc) { - apr_status_t rv; - simple_timer_t *ep = NULL; - - while (sc->mpm_state == AP_MPMQ_RUNNING) { - apr_time_t tnow = apr_time_now(); - simple_timer_t *head; - apr_interval_time_t timeout = apr_time_from_msec(500); - APR_RING_HEAD(simple_temp_timer_ring_t, simple_timer_t) tmp_ring; + apr_status_t rv; + simple_timer_t *ep = NULL; - apr_thread_mutex_lock(sc->mtx); - head = APR_RING_FIRST(&sc->timer_ring); - - if (head != APR_RING_SENTINEL(&sc->timer_ring, simple_timer_t, link)) { - if (tnow < head->expires) { - timeout = (head->expires - tnow); - if (timeout > apr_time_from_msec(500)) { - /* pqXXXXX: I'm 95% sure that the Linux Powertop guys will slap me for this. */ - timeout = apr_time_from_msec(500); + while (sc->mpm_state == AP_MPMQ_RUNNING) { + apr_time_t tnow = apr_time_now(); + simple_timer_t *head; + apr_interval_time_t timeout = apr_time_from_msec(500); + APR_RING_HEAD(simple_temp_timer_ring_t, simple_timer_t) tmp_ring; + + apr_thread_mutex_lock(sc->mtx); + head = APR_RING_FIRST(&sc->timer_ring); + + if (head != APR_RING_SENTINEL(&sc->timer_ring, simple_timer_t, link)) { + if (tnow < head->expires) { + timeout = (head->expires - tnow); + if (timeout > apr_time_from_msec(500)) { + /* pqXXXXX: I'm 95% sure that the Linux Powertop guys will slap me for this. */ + timeout = apr_time_from_msec(500); + } + } + else { + /* We have already expired timers in the queue. */ + timeout = 0; + } } - } - else { - /* We have already expired timers in the queue. */ - timeout = 0; - } - } - apr_thread_mutex_unlock(sc->mtx); + apr_thread_mutex_unlock(sc->mtx); - rv = apr_pollcb_poll(sc->pollcb, - timeout, - simple_io_callback, - sc); + rv = apr_pollcb_poll(sc->pollcb, timeout, simple_io_callback, sc); - tnow = apr_time_now(); + tnow = apr_time_now(); - if (rv) { - if (!APR_STATUS_IS_EINTR(rv) && !APR_STATUS_IS_TIMEUP(rv)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_main_loop: apr_pollcb_poll failed"); - return !OK; - } - } - - APR_RING_INIT(&tmp_ring, simple_timer_t, link); + if (rv) { + if (!APR_STATUS_IS_EINTR(rv) && !APR_STATUS_IS_TIMEUP(rv)) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_main_loop: apr_pollcb_poll failed"); + return !OK; + } + } - apr_thread_mutex_lock(sc->mtx); + APR_RING_INIT(&tmp_ring, simple_timer_t, link); + + apr_thread_mutex_lock(sc->mtx); - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - - /* now iterate any timers */ - if (!APR_RING_EMPTY(&sc->timer_ring, simple_timer_t, link)) { - for (ep = APR_RING_FIRST(&sc->timer_ring); - ep != APR_RING_SENTINEL(&sc->timer_ring, - simple_timer_t, link); - ep = APR_RING_NEXT(ep, link)) - { - if (ep->expires < tnow) { - simple_timer_t *next = APR_RING_PREV(ep, link); - /* push this task */ - APR_RING_REMOVE(ep, link); - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - APR_RING_INSERT_TAIL(&tmp_ring, ep, simple_timer_t, link); - ep = next; + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); + + /* now iterate any timers */ + if (!APR_RING_EMPTY(&sc->timer_ring, simple_timer_t, link)) { + for (ep = APR_RING_FIRST(&sc->timer_ring); + ep != APR_RING_SENTINEL(&sc->timer_ring, + simple_timer_t, link); + ep = APR_RING_NEXT(ep, link)) { + if (ep->expires < tnow) { + simple_timer_t *next = APR_RING_PREV(ep, link); + /* push this task */ + APR_RING_REMOVE(ep, link); + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, + simple_timer_t, link); + APR_RING_INSERT_TAIL(&tmp_ring, ep, simple_timer_t, link); + ep = next; + } + else { + break; + } + } } - else { - break; + + APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); + + apr_thread_mutex_unlock(sc->mtx); + + if (!APR_RING_EMPTY(&tmp_ring, simple_timer_t, link)) { + for (ep = APR_RING_FIRST(&tmp_ring); + ep != APR_RING_SENTINEL(&tmp_ring, + simple_timer_t, link); + ep = APR_RING_NEXT(ep, link)) { + apr_thread_pool_push(sc->workers, + simple_timer_invoke, + ep, + APR_THREAD_TASK_PRIORITY_NORMAL, NULL); + } } - } } - APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - - apr_thread_mutex_unlock(sc->mtx); - - if (!APR_RING_EMPTY(&tmp_ring, simple_timer_t, link)) { - for (ep = APR_RING_FIRST(&tmp_ring); - ep != APR_RING_SENTINEL(&tmp_ring, - simple_timer_t, link); - ep = APR_RING_NEXT(ep, link)) - { - apr_thread_pool_push(sc->workers, - simple_timer_invoke, - ep, - APR_THREAD_TASK_PRIORITY_NORMAL, - NULL); - } - } - } - - return 0; + return 0; } -void -simple_single_process_hack(simple_core_t *sc) +void simple_single_process_hack(simple_core_t * sc) { - apr_status_t rv; - /* Normally this is only ran in the child processes, but we want to do it here too...*/ - rv = simple_setup_listeners(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_single_child_hack: simple_setup_listeners failed"); - } + apr_status_t rv; + /* Normally this is only ran in the child processes, but we want to do it here too... */ + rv = simple_setup_listeners(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_single_child_hack: simple_setup_listeners failed"); + } } -static int -simple_setup_privs(simple_core_t *sc) +static int simple_setup_privs(simple_core_t * sc) { - /* TODO: These should be a series of hooks, chroot, drop user, SELinux support, etc. */ - /* TODO: chroot support */ - /* TODO: drop to configured user */ - - /* TODO: none of the above. Just a child_init hook, which can be - * instantianted in a module - */ - int rv = ap_run_simple_drop_privileges(sc->pool, ap_server_conf); - - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_setup_privs: ap_run_simple_drop_privileges failed"); - return rv; - } + /* TODO: These should be a series of hooks, chroot, drop user, SELinux support, etc. */ + /* TODO: chroot support */ + /* TODO: drop to configured user */ + + /* TODO: none of the above. Just a child_init hook, which can be + * instantianted in a module + */ + int rv = ap_run_simple_drop_privileges(sc->pool, ap_server_conf); - return 0; + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_setup_privs: ap_run_simple_drop_privileges failed"); + return rv; + } + + return 0; } -int -simple_child_loop(simple_core_t *sc) +int simple_child_loop(simple_core_t * sc) { - apr_status_t rv; + apr_status_t rv; + + rv = simple_setup_workers(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_child_loop: simple_setup_workers failed"); + return !OK; + } + + rv = simple_setup_listeners(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_child_loop: simple_setup_sockets failed"); + return !OK; + } - rv = simple_setup_workers(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_child_loop: simple_setup_workers failed"); - return !OK; - } - - rv = simple_setup_listeners(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_child_loop: simple_setup_sockets failed"); - return !OK; - } - - rv = simple_setup_privs(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_child_loop: simple_drop_privs failed"); - return !OK; - } + rv = simple_setup_privs(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_child_loop: simple_drop_privs failed"); + return !OK; + } - ap_run_child_init(sc->pool, ap_server_conf); + ap_run_child_init(sc->pool, ap_server_conf); - return simple_run_loop(sc); + return simple_run_loop(sc); } -int -simple_main_loop(simple_core_t *sc) +int simple_main_loop(simple_core_t * sc) { - apr_status_t rv; + apr_status_t rv; - rv = simple_setup_workers(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_main_loop: simple_setup_workers failed"); - return !OK; - } - - rv = simple_main_setup_timers(sc); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "simple_main_loop: simple_setup_timers failed"); - return !OK; - } + rv = simple_setup_workers(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_main_loop: simple_setup_workers failed"); + return !OK; + } - return simple_run_loop(sc); -} + rv = simple_main_setup_timers(sc); + if (rv) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "simple_main_loop: simple_setup_timers failed"); + return !OK; + } + return simple_run_loop(sc); +} Modified: httpd/httpd/trunk/server/mpm/simple/simple_run.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_run.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_run.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_run.h Wed Oct 29 18:50:09 2008 @@ -19,15 +19,11 @@ #ifndef APACHE_MPM_SIMPLE_RUN_H #define APACHE_MPM_SIMPLE_RUN_H -void -simple_single_process_hack(simple_core_t *sc); +void simple_single_process_hack(simple_core_t * sc); -int -simple_child_loop(simple_core_t* sc); +int simple_child_loop(simple_core_t * sc); -int -simple_main_loop(simple_core_t* sc); +int simple_main_loop(simple_core_t * sc); #endif - Modified: httpd/httpd/trunk/server/mpm/simple/simple_types.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_types.h?rev=709078&r1=709077&r2=709078&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/simple/simple_types.h (original) +++ httpd/httpd/trunk/server/mpm/simple/simple_types.h Wed Oct 29 18:50:09 2008 @@ -28,88 +28,98 @@ typedef struct simple_core_t simple_core_t; -typedef struct { - int proc_count; - int thread_count; - int max_requests_per_child; +typedef struct +{ + int proc_count; + int thread_count; + int max_requests_per_child; } simple_proc_mgr_t; -typedef struct { - int pid; +typedef struct +{ + int pid; } simple_child_t; -typedef void(*simple_timer_cb)(simple_core_t *sc, void *baton); -typedef void(*simple_io_sock_cb)(simple_core_t *sc, apr_socket_t *sock, - int flags, void *baton); -typedef void(*simple_io_file_cb)(simple_core_t *sc, apr_socket_t *sock, - int flags, void *baton); +typedef void (*simple_timer_cb) (simple_core_t * sc, void *baton); +typedef void (*simple_io_sock_cb) (simple_core_t * sc, apr_socket_t * sock, + int flags, void *baton); +typedef void (*simple_io_file_cb) (simple_core_t * sc, apr_socket_t * sock, + int flags, void *baton); typedef struct simple_sb_t simple_sb_t; typedef enum { - SIMPLE_PT_CORE_ACCEPT, - SIMPLE_PT_CORE_IO, - /* pqXXXXXX: User IO not defined yet. */ - SIMPLE_PT_USER + SIMPLE_PT_CORE_ACCEPT, + SIMPLE_PT_CORE_IO, + /* pqXXXXXX: User IO not defined yet. */ + SIMPLE_PT_USER } simple_poll_type_e; -struct simple_sb_t { - simple_poll_type_e type; - void *baton; +struct simple_sb_t +{ + simple_poll_type_e type; + void *baton; }; typedef struct simple_timer_t simple_timer_t; -struct simple_timer_t { - APR_RING_ENTRY(simple_timer_t) link; - apr_time_t expires; - simple_timer_cb cb; - void *baton; +struct simple_timer_t +{ + APR_RING_ENTRY(simple_timer_t) link; + apr_time_t expires; + simple_timer_cb cb; + void *baton; }; -struct simple_core_t { - apr_pool_t *pool; - apr_thread_mutex_t *mtx; - - int mpm_state; - int restart_num; - - int run_single_process; - int run_foreground; - - simple_proc_mgr_t procmgr; - - /* PID -> simple_child_t map */ - apr_hash_t *children; - - apr_pollcb_t *pollcb; - - /* List of upcoming timers, sorted by nearest first. - */ - APR_RING_HEAD(simple_timer_ring_t, simple_timer_t) timer_ring; - - /* used to recycle simple_timer_t structs, since we allocate them out of - * the global pool. - */ - APR_RING_HEAD(simple_dead_timer_ring_t, simple_timer_t) dead_timer_ring; - - apr_thread_pool_t *workers; +struct simple_core_t +{ + apr_pool_t *pool; + apr_thread_mutex_t *mtx; + + int mpm_state; + int restart_num; + + int run_single_process; + int run_foreground; + + simple_proc_mgr_t procmgr; + + /* PID -> simple_child_t map */ + apr_hash_t *children; + + apr_pollcb_t *pollcb; + + /* List of upcoming timers, sorted by nearest first. + */ + + APR_RING_HEAD(simple_timer_ring_t, simple_timer_t) timer_ring; + + /* used to recycle simple_timer_t structs, since we allocate them out of + * the global pool. + */ + + + + + APR_RING_HEAD(simple_dead_timer_ring_t, + simple_timer_t) dead_timer_ring; + + apr_thread_pool_t *workers; }; typedef struct simple_conn_t simple_conn_t; -struct simple_conn_t { - apr_pool_t *pool; - simple_core_t *sc; - apr_socket_t *sock; - apr_bucket_alloc_t *ba; - conn_rec *c; +struct simple_conn_t +{ + apr_pool_t *pool; + simple_core_t *sc; + apr_socket_t *sock; + apr_bucket_alloc_t *ba; + conn_rec *c; }; -simple_core_t* simple_core_get(); +simple_core_t *simple_core_get(); /* Resets all variables to 0 for a simple_core_t */ -apr_status_t simple_core_init(simple_core_t* sc, - apr_pool_t* pool); +apr_status_t simple_core_init(simple_core_t * sc, apr_pool_t * pool); #endif /* APACHE_MPM_SIMPLE_TYPES_H */ -