Loading server/mpm/simple/simple_api.c +22 −34 Changes for server/mpm/simple/simple_api.c: 22 added lines, 34 removed lines. Original line number Diff line number Diff line Loading @@ -33,18 +33,14 @@ ap_generation_t volatile ap_my_generation = 0; 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), (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(); Loading @@ -58,8 +54,7 @@ ap_mpm_run(apr_pool_t *pconf, 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(); Loading Loading @@ -125,9 +120,7 @@ ap_mpm_query(int query_code, int *result) static int simple_open_logs(apr_pool_t * p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s) { int nsock; Loading @@ -146,8 +139,7 @@ simple_open_logs(apr_pool_t *p, } static int simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) simple_pre_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp) { int run_debug; apr_status_t rv; Loading Loading @@ -185,8 +177,7 @@ simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog, return OK; } static void simple_process_start(process_rec *process) static void simple_process_start(process_rec * process) { apr_status_t rv; Loading Loading @@ -216,49 +207,49 @@ simple_check_config(apr_pool_t *p, apr_pool_t *plog, 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); "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); "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); "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); "simple_check_config: SimpleThreadCount must be more than %d", SIMPLE_MIN_THREADS); 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 }; 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) { Loading @@ -270,8 +261,8 @@ set_proccount(cmd_parms *cmd, void *baton, const char *arg) } 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); Loading Loading @@ -307,6 +298,3 @@ module AP_MODULE_DECLARE_DATA mpm_simple_module = { simple_cmds, /* command apr_table_t */ simple_hooks /* register_hooks */ }; server/mpm/simple/simple_api.h +4 −4 Changes for server/mpm/simple/simple_api.h: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -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 */ server/mpm/simple/simple_children.c +6 −17 Changes for server/mpm/simple/simple_children.c: 6 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -24,8 +24,7 @@ #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. */ Loading @@ -34,8 +33,7 @@ simple_kill_random_child(simple_core_t *sc) 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 Loading @@ -49,9 +47,7 @@ simple_spawn_child(simple_core_t *sc) 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; Loading @@ -59,8 +55,7 @@ simple_check_children_size(simple_core_t *sc, simple_register_timer(sc, simple_check_children_size, NULL, SPAWN_CHILDREN_INTERVAL); NULL, SPAWN_CHILDREN_INTERVAL); if (sc->run_single_process && sc->restart_num == 2) { static int run = 0; Loading @@ -83,20 +78,14 @@ simple_check_children_size(simple_core_t *sc, if (count > wanted) { /* kill some kids */ int to_kill = count - wanted; for (i = 0; i < to_kill; i++) { 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++) { for (i = 0; i < to_spawn; i++) { simple_spawn_child(sc); } } Loading server/mpm/simple/simple_children.h +2 −6 Changes for server/mpm/simple/simple_children.h: 2 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -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 */ server/mpm/simple/simple_core.c +5 −13 Changes for server/mpm/simple/simple_core.c: 5 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -30,14 +30,12 @@ static simple_core_t g_simple_core; #endif simple_core_t* simple_core_get() simple_core_t *simple_core_get() { 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; Loading @@ -55,9 +53,7 @@ simple_core_init(simple_core_t* sc, apr_pool_t* 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); rv = apr_thread_mutex_create(&sc->mtx, 0, sc->pool); if (rv) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, Loading @@ -65,10 +61,8 @@ simple_core_init(simple_core_t* sc, apr_pool_t* pool) return rv; } rv = apr_pollcb_create(&sc->pollcb, 512 /* pqXXXXX: make configrable */, sc->pool, 0); rv = apr_pollcb_create(&sc->pollcb, 512 /* pqXXXXX: make configrable */ , sc->pool, 0); if (rv) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, Loading @@ -78,5 +72,3 @@ simple_core_init(simple_core_t* sc, apr_pool_t* pool) return APR_SUCCESS; } Loading
server/mpm/simple/simple_api.c +22 −34 Changes for server/mpm/simple/simple_api.c: 22 added lines, 34 removed lines. Original line number Diff line number Diff line Loading @@ -33,18 +33,14 @@ ap_generation_t volatile ap_my_generation = 0; 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), (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(); Loading @@ -58,8 +54,7 @@ ap_mpm_run(apr_pool_t *pconf, 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(); Loading Loading @@ -125,9 +120,7 @@ ap_mpm_query(int query_code, int *result) static int simple_open_logs(apr_pool_t * p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s) { int nsock; Loading @@ -146,8 +139,7 @@ simple_open_logs(apr_pool_t *p, } static int simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) simple_pre_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp) { int run_debug; apr_status_t rv; Loading Loading @@ -185,8 +177,7 @@ simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog, return OK; } static void simple_process_start(process_rec *process) static void simple_process_start(process_rec * process) { apr_status_t rv; Loading Loading @@ -216,49 +207,49 @@ simple_check_config(apr_pool_t *p, apr_pool_t *plog, 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); "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); "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); "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); "simple_check_config: SimpleThreadCount must be more than %d", SIMPLE_MIN_THREADS); 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 }; 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) { Loading @@ -270,8 +261,8 @@ set_proccount(cmd_parms *cmd, void *baton, const char *arg) } 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); Loading Loading @@ -307,6 +298,3 @@ module AP_MODULE_DECLARE_DATA mpm_simple_module = { simple_cmds, /* command apr_table_t */ simple_hooks /* register_hooks */ };
server/mpm/simple/simple_api.h +4 −4 Changes for server/mpm/simple/simple_api.h: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -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 */
server/mpm/simple/simple_children.c +6 −17 Changes for server/mpm/simple/simple_children.c: 6 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -24,8 +24,7 @@ #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. */ Loading @@ -34,8 +33,7 @@ simple_kill_random_child(simple_core_t *sc) 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 Loading @@ -49,9 +47,7 @@ simple_spawn_child(simple_core_t *sc) 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; Loading @@ -59,8 +55,7 @@ simple_check_children_size(simple_core_t *sc, simple_register_timer(sc, simple_check_children_size, NULL, SPAWN_CHILDREN_INTERVAL); NULL, SPAWN_CHILDREN_INTERVAL); if (sc->run_single_process && sc->restart_num == 2) { static int run = 0; Loading @@ -83,20 +78,14 @@ simple_check_children_size(simple_core_t *sc, if (count > wanted) { /* kill some kids */ int to_kill = count - wanted; for (i = 0; i < to_kill; i++) { 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++) { for (i = 0; i < to_spawn; i++) { simple_spawn_child(sc); } } Loading
server/mpm/simple/simple_children.h +2 −6 Changes for server/mpm/simple/simple_children.h: 2 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -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 */
server/mpm/simple/simple_core.c +5 −13 Changes for server/mpm/simple/simple_core.c: 5 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -30,14 +30,12 @@ static simple_core_t g_simple_core; #endif simple_core_t* simple_core_get() simple_core_t *simple_core_get() { 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; Loading @@ -55,9 +53,7 @@ simple_core_init(simple_core_t* sc, apr_pool_t* 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); rv = apr_thread_mutex_create(&sc->mtx, 0, sc->pool); if (rv) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, Loading @@ -65,10 +61,8 @@ simple_core_init(simple_core_t* sc, apr_pool_t* pool) return rv; } rv = apr_pollcb_create(&sc->pollcb, 512 /* pqXXXXX: make configrable */, sc->pool, 0); rv = apr_pollcb_create(&sc->pollcb, 512 /* pqXXXXX: make configrable */ , sc->pool, 0); if (rv) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, Loading @@ -78,5 +72,3 @@ simple_core_init(simple_core_t* sc, apr_pool_t* pool) return APR_SUCCESS; }