From: Guenter Knauf Date: Tue, 20 Mar 2012 23:15:05 +0000 (+0000) Subject: Revert r1294936 (Jeff's revert) and fix NetWare / Win32 build. X-Git-Tag: 2.5.0-alpha~7331 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e728d6ee5114cd18b74e935a0262f85e6cf77c6;p=apache Revert r1294936 (Jeff's revert) and fix NetWare / Win32 build. Added the missing AP_DECLARE* decorations for the function implementations and variables. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1303201 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3aa170ef2f..d61aca8c98 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,8 @@ Changes with Apache 2.5.0 *) core: Add filesystem paths to access denied / access failed messages AH00035 and AH00036. [Eric Covener] + *) Fix MPM DSO load failure on AIX. [Jeff Trawick] + *) core: Add the port number to the vhost's name in the scoreboard. [Stefan Fritsch] diff --git a/include/mpm_common.h b/include/mpm_common.h index df33d79e41..2a608f7b33 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -89,6 +89,7 @@ extern "C" { typedef void ap_reclaim_callback_fn_t(int childnum, pid_t pid, ap_generation_t gen); +#ifndef NETWARE /** * Make sure all child processes that have been spawned by the parent process * have died. This includes process registered as "other_children". @@ -102,8 +103,8 @@ typedef void ap_reclaim_callback_fn_t(int childnum, pid_t pid, * in the scoreboard as well as those currently registered via * ap_register_extra_mpm_process(). */ -void ap_reclaim_child_processes(int terminate, - ap_reclaim_callback_fn_t *mpm_callback); +AP_DECLARE(void) ap_reclaim_child_processes(int terminate, + ap_reclaim_callback_fn_t *mpm_callback); /** * Catch any child processes that have been spawned by the parent process @@ -115,7 +116,7 @@ void ap_reclaim_child_processes(int terminate, * in the scoreboard as well as those currently registered via * ap_register_extra_mpm_process(). */ -void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback); +AP_DECLARE(void) ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback); /** * Tell ap_reclaim_child_processes() and ap_relieve_child_processes() about @@ -128,7 +129,7 @@ void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback); * ap_reclaim_child_processes(), remove it from the list of such processes * by calling ap_unregister_extra_mpm_process(). */ -void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen); +AP_DECLARE(void) ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen); /** * Unregister an MPM child process which was previously registered by a @@ -138,12 +139,7 @@ void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen); * @param old_gen Set to the server generation of the process, if found. * @return 1 if the process was found and removed, 0 otherwise */ -int ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen); - -/** - * Pool cleanup for end-generation hook implementation - */ -apr_status_t ap_mpm_end_gen_helper(void *unused); +AP_DECLARE(int) ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen); /** * Safely signal an MPM child process, if the process is in the @@ -154,7 +150,27 @@ apr_status_t ap_mpm_end_gen_helper(void *unused); * APR_EINVAL is returned if passed either an invalid (< 1) pid, or if * the pid is not in the current process group */ -apr_status_t ap_mpm_safe_kill(pid_t pid, int sig); +AP_DECLARE(apr_status_t) ap_mpm_safe_kill(pid_t pid, int sig); + +/** + * Log why a child died to the error log, if the child died without the + * parent signalling it. + * @param pid The child that has died + * @param why The return code of the child process + * @param status The status returned from ap_wait_or_timeout + * @return 0 on success, APEXIT_CHILDFATAL if MPM should terminate + */ +AP_DECLARE(int) ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status); + +AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf); +AP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s); +#endif /* !NETWARE */ + +/** + * Pool cleanup for end-generation hook implementation + * (core httpd function) + */ +apr_status_t ap_mpm_end_gen_helper(void *unused); /** * Run the monitor hook (once every ten calls), determine if any child @@ -166,18 +182,9 @@ apr_status_t ap_mpm_safe_kill(pid_t pid, int sig); * @param p The pool to allocate out of * @param s The server_rec to pass */ -void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, - apr_pool_t *p, server_rec *s); - -/** - * Log why a child died to the error log, if the child died without the - * parent signalling it. - * @param pid The child that has died - * @param why The return code of the child process - * @param status The status returned from ap_wait_or_timeout - * @return 0 on success, APEXIT_CHILDFATAL if MPM should terminate - */ -int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status); +AP_DECLARE(void) ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, + apr_proc_t *ret, apr_pool_t *p, + server_rec *s); #if defined(TCP_NODELAY) /** @@ -289,14 +296,14 @@ AP_DECLARE(const char *) ap_check_mpm(void); * The maximum number of requests each child thread or * process handles before dying off */ -extern int ap_max_requests_per_child; +AP_DECLARE_DATA extern int ap_max_requests_per_child; const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy, const char *arg); /** * The filename used to store the process id. */ -extern const char *ap_pid_fname; +AP_DECLARE_DATA extern const char *ap_pid_fname; const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy, const char *arg); void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out); @@ -304,16 +311,16 @@ void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out); /* * The directory that the server changes directory to dump core. */ -extern char ap_coredump_dir[MAX_STRING_LEN]; -extern int ap_coredumpdir_configured; +AP_DECLARE_DATA extern char ap_coredump_dir[MAX_STRING_LEN]; +AP_DECLARE_DATA extern int ap_coredumpdir_configured; const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, const char *arg); /** * Set the timeout period for a graceful shutdown. */ -extern int ap_graceful_shutdown_timeout; -const char *ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy, +AP_DECLARE_DATA extern int ap_graceful_shutdown_timeout; +AP_DECLARE(const char *)ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy, const char *arg); #define AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND \ AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, \ @@ -324,17 +331,14 @@ AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, \ int ap_signal_server(int *, apr_pool_t *); void ap_mpm_rewrite_args(process_rec *); -extern AP_DECLARE_DATA apr_uint32_t ap_max_mem_free; +AP_DECLARE_DATA extern apr_uint32_t ap_max_mem_free; extern const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy, const char *arg); -extern apr_size_t ap_thread_stacksize; +AP_DECLARE_DATA extern apr_size_t ap_thread_stacksize; extern const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy, const char *arg); -extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf); -extern apr_status_t ap_fatal_signal_child_setup(server_rec *s); - /* core's implementation of child_status hook */ extern void ap_core_child_status(server_rec *s, pid_t pid, ap_generation_t gen, int slot, mpm_child_status status); diff --git a/include/scoreboard.h b/include/scoreboard.h index 3145005647..2fd2960e49 100644 --- a/include/scoreboard.h +++ b/include/scoreboard.h @@ -156,14 +156,21 @@ typedef struct { typedef struct ap_sb_handle_t ap_sb_handle_t; +/* + * Creation and deletion (internal) + */ +int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t); +apr_status_t ap_cleanup_scoreboard(void *d); + +/* + * APIs for MPMs and other modules + */ AP_DECLARE(int) ap_exists_scoreboard_image(void); AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r); -int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t); -apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached); -void ap_init_scoreboard(void *shared_score); +AP_DECLARE(apr_status_t) ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached); +AP_DECLARE(void) ap_init_scoreboard(void *shared_score); AP_DECLARE(int) ap_calc_scoreboard_size(void); -apr_status_t ap_cleanup_scoreboard(void *d); AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p, int child_num, int thread_num); diff --git a/server/mpm_common.c b/server/mpm_common.c index 0cd65e5c30..4448ec60dc 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -139,13 +139,13 @@ static struct mpm_gen_info_head_t *geninfo, *unused_geninfo; static int gen_head_init; /* yuck */ /* variables representing config directives implemented here */ -const char *ap_pid_fname; -int ap_max_requests_per_child; -char ap_coredump_dir[MAX_STRING_LEN]; -int ap_coredumpdir_configured; -int ap_graceful_shutdown_timeout; +AP_DECLARE_DATA const char *ap_pid_fname; +AP_DECLARE_DATA int ap_max_requests_per_child; +AP_DECLARE_DATA char ap_coredump_dir[MAX_STRING_LEN]; +AP_DECLARE_DATA int ap_coredumpdir_configured; +AP_DECLARE_DATA int ap_graceful_shutdown_timeout; AP_DECLARE_DATA apr_uint32_t ap_max_mem_free; -apr_size_t ap_thread_stacksize; +AP_DECLARE_DATA apr_size_t ap_thread_stacksize; #define ALLOCATOR_MAX_FREE_DEFAULT (2048*1024) @@ -170,8 +170,9 @@ void mpm_common_pre_config(apr_pool_t *pconf) #endif static int wait_or_timeout_counter; -void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, - apr_pool_t *p, server_rec *s) +AP_DECLARE(void) ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, + apr_proc_t *ret, apr_pool_t *p, + server_rec *s) { apr_status_t rv; @@ -356,8 +357,9 @@ const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, return NULL; } -const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy, - const char *arg) +AP_DECLARE(const char *)ap_mpm_set_graceful_shutdown(cmd_parms *cmd, + void *dummy, + const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { diff --git a/server/mpm_unix.c b/server/mpm_unix.c index 6c1606568e..4a0de7b944 100644 --- a/server/mpm_unix.c +++ b/server/mpm_unix.c @@ -73,7 +73,7 @@ typedef struct extra_process_t { static extra_process_t *extras; -void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen) +AP_DECLARE(void) ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen) { extra_process_t *p = (extra_process_t *)ap_malloc(sizeof(extra_process_t)); @@ -83,7 +83,7 @@ void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen) extras = p; } -int ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *gen) +AP_DECLARE(int) ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen) { extra_process_t *cur = extras; extra_process_t *prev = NULL; @@ -173,8 +173,8 @@ static int reclaim_one_pid(pid_t pid, action_t action) return 0; } -void ap_reclaim_child_processes(int terminate, - ap_reclaim_callback_fn_t *mpm_callback) +AP_DECLARE(void) ap_reclaim_child_processes(int terminate, + ap_reclaim_callback_fn_t *mpm_callback) { apr_time_t waittime = 1024 * 16; int i; @@ -270,7 +270,7 @@ void ap_reclaim_child_processes(int terminate, action_table[cur_action].action != GIVEUP); } -void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback) +AP_DECLARE(void) ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback) { int i; extra_process_t *cur_extra; @@ -313,7 +313,7 @@ void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback) * the pid is a member of the current process group; either using * apr_proc_wait(), where waitpid() guarantees to fail for non-child * processes; or by using getpgid() directly, if available. */ -apr_status_t ap_mpm_safe_kill(pid_t pid, int sig) +AP_DECLARE(apr_status_t) ap_mpm_safe_kill(pid_t pid, int sig) { #ifndef HAVE_GETPGID apr_proc_t proc; @@ -368,7 +368,8 @@ apr_status_t ap_mpm_safe_kill(pid_t pid, int sig) } -int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status) +AP_DECLARE(int) ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, + int status) { int signum = status; const char *sigdesc; @@ -869,13 +870,14 @@ static void sig_coredump(int sig) */ } -apr_status_t ap_fatal_signal_child_setup(server_rec *s) +AP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s) { my_pid = getpid(); return APR_SUCCESS; } -apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *in_pconf) +AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s, + apr_pool_t *pconf) { #ifndef NO_USE_SIGACTION struct sigaction sa; diff --git a/server/scoreboard.c b/server/scoreboard.c index 1a6a9844bc..bef2b90908 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -143,7 +143,7 @@ AP_DECLARE(int) ap_calc_scoreboard_size(void) return scoreboard_size; } -void ap_init_scoreboard(void *shared_score) +AP_DECLARE(void) ap_init_scoreboard(void *shared_score) { char *more_storage; int i; @@ -251,7 +251,8 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf) /* If detach is non-zero, this is a separate child process, * if zero, it is a forked child. */ -apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached) +AP_DECLARE(apr_status_t) ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, + int detached) { #if APR_HAS_SHARED_MEMORY if (!detached) {