You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2007/08/23 07:55:12 UTC

svn commit: r568833 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_mutex.h modules/ssl/mod_ssl.c modules/ssl/ssl_engine_config.c server/core.c server/mpm_common.c server/util_mutex.c

Author: wrowe
Date: Wed Aug 22 22:55:11 2007
New Revision: 568833

URL: http://svn.apache.org/viewvc?rev=568833&view=rev
Log:
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?

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/util_mutex.h
    httpd/httpd/trunk/modules/ssl/mod_ssl.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/mpm_common.c
    httpd/httpd/trunk/server/util_mutex.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Aug 22 22:55:11 2007
@@ -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

Modified: httpd/httpd/trunk/include/util_mutex.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_mutex.h?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_mutex.h (original)
+++ httpd/httpd/trunk/include/util_mutex.h Wed Aug 22 22:55:11 2007
@@ -29,12 +29,59 @@
 #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

Modified: httpd/httpd/trunk/modules/ssl/mod_ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/mod_ssl.c?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/mod_ssl.c (original)
+++ httpd/httpd/trunk/modules/ssl/mod_ssl.c Wed Aug 22 22:55:11 2007
@@ -52,7 +52,7 @@
     /*
      * 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`, "

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_config.c?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_config.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_config.c Wed Aug 22 22:55:11 2007
@@ -358,7 +358,7 @@
         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);

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Aug 22 22:55:11 2007
@@ -3368,7 +3368,7 @@
 #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,

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Wed Aug 22 22:55:11 2007
@@ -886,7 +886,7 @@
 
     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 @@
 #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)

Modified: httpd/httpd/trunk/server/util_mutex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_mutex.c?rev=568833&r1=568832&r2=568833&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_mutex.c (original)
+++ httpd/httpd/trunk/server/util_mutex.c Wed Aug 22 22:55:11 2007
@@ -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)



Re: svn commit: r568833 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_mutex.h modules/ssl/mod_ssl.c modules/ssl/ssl_engine_config.c server/core.c server/mpm_common.c server/util_mutex.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Jim Jagielski wrote:
> 
> On Aug 23, 2007, at 1:55 AM, wrowe@apache.org wrote:
> 
>> 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.
> 
> Wow... that's v. interesting...

Well, when you consider these are PIC or similar binaries, even where it
is implemented, you end up with

const cmd_rec ssl_commands {
  "SSLMutex", ..., char *[external]
}

where the dl runtime needs to resolve this external string description
to a [lib]httpd core *relocatable* data address.

For code entry points this is trivial; worst case, the linker and dl
runtime simply use a pointer to a stub entry point, which is fixed up
at either load or run time.  Data pointers don't enjoy the luxury of
being able to fix themselves up ;-)

Bill

Re: svn commit: r568833 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_mutex.h modules/ssl/mod_ssl.c modules/ssl/ssl_engine_config.c server/core.c server/mpm_common.c server/util_mutex.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Jim Jagielski wrote:
> 
> On Aug 23, 2007, at 1:55 AM, wrowe@apache.org wrote:
> 
>> 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.
> 
> Wow... that's v. interesting...

Well, when you consider these are PIC or similar binaries, even where it
is implemented, you end up with

const cmd_rec ssl_commands {
  "SSLMutex", ..., char *[external]
}

where the dl runtime needs to resolve this external string description
to a [lib]httpd core *relocatable* data address.

For code entry points this is trivial; worst case, the linker and dl
runtime simply use a pointer to a stub entry point, which is fixed up
at either load or run time.  Data pointers don't enjoy the luxury of
being able to fix themselves up ;-)

Bill

Re: svn commit: r568833 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_mutex.h modules/ssl/mod_ssl.c modules/ssl/ssl_engine_config.c server/core.c server/mpm_common.c server/util_mutex.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Aug 23, 2007, at 1:55 AM, wrowe@apache.org wrote:

> 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.
>

Wow... that's v. interesting...

Re: svn commit: r568833 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_mutex.h modules/ssl/mod_ssl.c modules/ssl/ssl_engine_config.c server/core.c server/mpm_common.c server/util_mutex.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Aug 23, 2007, at 1:55 AM, wrowe@apache.org wrote:

> 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.
>

Wow... that's v. interesting...