From: William A. Rowe Jr Date: Thu, 23 Aug 2007 05:55:11 +0000 (+0000) Subject: ap_available_mutexes_string and ap_add_available_mutexes_string X-Git-Tag: 2.3.0~1563 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d7fe950f21781900e44d42d7778b5d34d1cdd3d;p=apache ap_available_mutexes_string and ap_add_available_mutexes_string cannot be data symbols when mod_ssl is built as a loadable module; using an external string constant in a loadable module is not portable. Also reorganize file and sem to follow their explicit mechanisms, and ensured that the explicit mechansims are listed in order of preference. This raises a question, would [fcntl|file] be a clearer way of indiciating what the file/sem methods devolve to? git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@568833 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 319e66ce83..223c59e436 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -130,15 +130,17 @@ * 20060905.3 (2.3.0-dev) Added conn_rec::clogging_input_filters. * 20060905.4 (2.3.0-dev) Added proxy_balancer::sticky_path. * 20060905.5 (2.3.0-dev) Added ap_mpm_safe_kill() + * 20070823.0 (2.3.0-dev) Removed ap_all_available_mutexes_string, + * ap_available_mutexes_string for macros * */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20060905 +#define MODULE_MAGIC_NUMBER_MAJOR 20080823 #endif -#define MODULE_MAGIC_NUMBER_MINOR 5 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/util_mutex.h b/include/util_mutex.h index 69262af20c..7ed595efaa 100644 --- a/include/util_mutex.h +++ b/include/util_mutex.h @@ -29,13 +29,60 @@ #include "httpd.h" #include "apr_global_mutex.h" +#if APR_HAS_FLOCK_SERIALIZE +# define AP_LIST_FLOCK_SERIALIZE ", 'flock:/path/to/file'" +#else +# define AP_LIST_FLOCK_SERIALIZE +#endif +#if APR_HAS_FCNTL_SERIALIZE +# define AP_LIST_FCNTL_SERIALIZE ", 'fcntl:/path/to/file'" +#else +# define AP_LIST_FCNTL_SERIALIZE +#endif +#if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM) +# define AP_LIST_SYSVSEM_SERIALIZE ", 'sysvsem'" +#else +# define AP_LIST_SYSVSEM_SERIALIZE +#endif +#if APR_HAS_POSIXSEM_SERIALIZE +# define AP_LIST_POSIXSEM_SERIALIZE ", 'posixsem'" +#else +# define AP_LIST_POSIXSEM_SERIALIZE +#endif +#if APR_HAS_PROC_PTHREAD_SERIALIZE +# define AP_LIST_PTHREAD_SERIALIZE ", 'pthread'" +#else +# define AP_LIST_PTHREAD_SERIALIZE +#endif +#if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE +# define AP_LIST_FILE_SERIALIZE ", 'file:/path/to/file'" +#else +# define AP_LIST_FILE_SERIALIZE +#endif +#if (APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)) || APR_HAS_POSIXSEM_SERIALIZE +# define AP_LIST_SEM_SERIALIZE ", 'sem'" +#else +# define AP_LIST_SEM_SERIALIZE +#endif + +#define AP_ALL_AVAILABLE_MUTEXES_STRING \ + "Mutex mechanisms are: 'none', 'default'" \ + AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \ + AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \ + AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \ + AP_LIST_SEM_SERIALIZE + +#define AP_AVAILABLE_MUTEXES_STRING \ + "Mutex mechanisms are: 'default'" \ + AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \ + AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \ + AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \ + AP_LIST_SEM_SERIALIZE + #ifdef __cplusplus extern "C" { #endif -extern const char AP_DECLARE_DATA ap_available_mutexes_string[]; -extern const char AP_DECLARE_DATA ap_all_available_mutexes_string[]; - /** * Get Mutex config data and parse it * @param arg The mutex config string diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index edf2dfbf76..e16032258f 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -52,7 +52,7 @@ static const command_rec ssl_config_cmds[] = { /* * Global (main-server) context configuration directives */ - SSL_CMD_SRV(Mutex, TAKE1, ap_all_available_mutexes_string) + SSL_CMD_SRV(Mutex, TAKE1, AP_ALL_AVAILABLE_MUTEXES_STRING) SSL_CMD_SRV(PassPhraseDialog, TAKE1, "SSL dialog mechanism for the pass phrase query " "(`builtin', `|/path/to/pipe_program`, " diff --git a/modules/ssl/ssl_engine_config.c b/modules/ssl/ssl_engine_config.c index 1d4907c43c..206149ae84 100644 --- a/modules/ssl/ssl_engine_config.c +++ b/modules/ssl/ssl_engine_config.c @@ -358,7 +358,7 @@ const char *ssl_cmd_SSLMutex(cmd_parms *cmd, return NULL; } else if (rv == APR_ENOTIMPL) { return apr_pstrcat(cmd->pool, "Invalid SSLMutex argument ", arg_, - " (", ap_all_available_mutexes_string, ")", NULL); + " (" AP_ALL_AVAILABLE_MUTEXES_STRING ")", NULL); } else if (rv == APR_BADARG) { return apr_pstrcat(cmd->pool, "Invalid SSLMutex filepath ", arg_, NULL); diff --git a/server/core.c b/server/core.c index 2131cf95ee..84b58726fa 100644 --- a/server/core.c +++ b/server/core.c @@ -3368,7 +3368,7 @@ AP_INIT_TAKE1("CoreDumpDirectory", ap_mpm_set_coredumpdir, NULL, RSRC_CONF, #endif #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH AP_INIT_TAKE1("AcceptMutex", ap_mpm_set_accept_lock_mech, NULL, RSRC_CONF, - ap_available_mutexes_string), + AP_AVAILABLE_MUTEXES_STRING), #endif #ifdef AP_MPM_WANT_SET_MAX_MEM_FREE AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF, diff --git a/server/mpm_common.c b/server/mpm_common.c index b4550089ea..91a16cc451 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -886,7 +886,7 @@ AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd, if ((rv == APR_ENOTIMPL) || (rv == APR_ENOLOCK)) { return apr_pstrcat(cmd->pool, "Invalid AcceptMutex argument ", arg, - " (", ap_available_mutexes_string, ")", NULL); + " (" AP_AVAILABLE_MUTEXES_STRING ")", NULL); } else if (rv == APR_BADARG) { return apr_pstrcat(cmd->pool, "Invalid AcceptMutex filepath ", arg, NULL); @@ -900,7 +900,7 @@ AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd, #if defined(PERCHILD_MPM) if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { return apr_pstrcat(cmd->pool, "Invalid AcceptMutex argument ", arg, - " (", ap_available_mutexes_string, ")", NULL); + " (" AP_AVAILABLE_MUTEXES_STRING ")", NULL); } #endif if (lockfile && !ap_lock_fname) diff --git a/server/util_mutex.c b/server/util_mutex.c index c435d82ad2..f1f265c644 100644 --- a/server/util_mutex.c +++ b/server/util_mutex.c @@ -35,57 +35,6 @@ #include "http_config.h" #include "util_mutex.h" -const char AP_DECLARE_DATA ap_all_available_mutexes_string[] = - "Mutex mechanisms are: `none', `default'" -#if APR_HAS_FLOCK_SERIALIZE - ", `flock:/path/to/file'" -#endif -#if APR_HAS_FCNTL_SERIALIZE - ", `fcntl:/path/to/file'" -#endif -#if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM) - ", `sysvsem'" -#endif -#if APR_HAS_POSIXSEM_SERIALIZE - ", `posixsem'" -#endif -#if APR_HAS_PROC_PTHREAD_SERIALIZE - ", `pthread'" -#endif -#if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE - ", `file:/path/to/file'" -#endif -#if (APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)) || APR_HAS_POSIXSEM_SERIALIZE - ", `sem'" -#endif - " "; - -const char AP_DECLARE_DATA ap_available_mutexes_string[] = - "Mutex mechanisms are: `default'" -#if APR_HAS_FLOCK_SERIALIZE - ", `flock:/path/to/file'" -#endif -#if APR_HAS_FCNTL_SERIALIZE - ", `fcntl:/path/to/file'" -#endif -#if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM) - ", `sysvsem'" -#endif -#if APR_HAS_POSIXSEM_SERIALIZE - ", `posixsem'" -#endif -#if APR_HAS_PROC_PTHREAD_SERIALIZE - ", `pthread'" -#endif -#if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE - ", `file:/path/to/file'" -#endif -#if (APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)) || APR_HAS_POSIXSEM_SERIALIZE - ", `sem'" -#endif - " "; - - AP_DECLARE(apr_status_t) ap_parse_mutex(const char *arg, apr_pool_t *pool, apr_lockmech_e *mutexmech, const char **mutexfile)