You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/04/03 15:36:56 UTC

svn commit: r1308897 - in /httpd/httpd/branches/2.4.x: CHANGES STATUS docs/manual/mod/mod_slotmem_shm.xml modules/slotmem/mod_slotmem_shm.c

Author: jim
Date: Tue Apr  3 13:36:55 2012
New Revision: 1308897

URL: http://svn.apache.org/viewvc?rev=1308897&view=rev
Log:
Merge r1298433, r1305166 from trunk:

Use new ap_runtime_dir_relative() API

Document use of the DefaultRuntimeDir directive.

Submitted by: jim, minfrin
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml
    httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1308897&r1=1308896&r2=1308897&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Apr  3 13:36:55 2012
@@ -6,6 +6,8 @@ Changes with Apache 2.4.2
      envvars: Fix insecure handling of LD_LIBRARY_PATH that could lead to the
      current working directory to be searched for DSOs. [Stefan Fritsch]
 
+  *) mod_slotmem_shm: Honor DefaultRuntimeDir [Jim Jagielski]
+
   *) mod_ssl: Fix crash with threaded MPMs due to race condition when
      initializing EC temporary keys. [Stefan Fritsch]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1308897&r1=1308896&r2=1308897&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Apr  3 13:36:55 2012
@@ -88,12 +88,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_slotmem_shm: Use ap_runtime_dir_relative(). (Assumes r1297560)
-    Trunk patch: http://svn.apache.org/viewvc?rev=1298433&view=rev
-    2.4.x patch: Trunk patch works (skip docs/log-message-tags/next-number)
-    +1: jim, minfrin (with docs at http://svn.apache.org/viewvc?rev=1305166&view=rev)
-    +1: igalic
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml?rev=1308897&r1=1308896&r2=1308897&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml Tue Apr  3 13:36:55 2012
@@ -38,7 +38,9 @@
     restart, whether graceful or not. The data itself is
     stored and restored within a file noted by the <code>name</code>
     parameter in the <code>create</code> and <code>attach</code>
-    calls.
+    calls. If not specified with an absolute path, the file will be
+    created relative to the path specified by the
+    <directive module="core">DefaultRuntimeDir</directive> directive.
     </p>
 
     <p><code>mod_slotmem_shm</code> provides the following API functions:
@@ -55,9 +57,9 @@
          <dt><code>"none"</code></dt>
          <dd><code>Does not persist shared memory in file.</code></dd>
          <dt><code>"file-name"</code></dt>
-         <dd><code>$server_root/file-name</code></dd>
+         <dd><code>[DefaultRuntimeDir]/file-name</code></dd>
          <dt><code>"/absolute-file-name"</code></dt>
-         <dd><code>$absolute-file-name</code></dd>
+         <dd><code>Absolute file name</code></dd>
        </dl></dd>
 
       <dt>apr_status_t attach(ap_slotmem_instance_t **new, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)</dt>

Modified: httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c?rev=1308897&r1=1308896&r2=1308897&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c (original)
+++ httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c Tue Apr  3 13:36:55 2012
@@ -69,7 +69,6 @@ struct ap_slotmem_instance_t {
     struct ap_slotmem_instance_t  *next;       /* location of next allocated segment */
 };
 
-
 /*
  * Memory layout:
  *     sharedslotdesc_t | num_free | slots | isuse array |
@@ -82,6 +81,9 @@ struct ap_slotmem_instance_t {
 static struct ap_slotmem_instance_t *globallistmem = NULL;
 static apr_pool_t *gpool = NULL;
 
+#define DEFAULT_SLOTMEM_PREFIX "slotmem-shm-"
+#define DEFAULT_SLOTMEM_SUFFIX ".shm"
+
 /* apr:shmem/unix/shm.c */
 static apr_status_t unixd_set_shm_perms(const char *fname)
 {
@@ -125,10 +127,6 @@ static apr_status_t unixd_set_shm_perms(
  *
  */
 
-#define DEFAULT_SLOTMEM_PREFIX DEFAULT_REL_RUNTIMEDIR "/slotmem-shm-"
-
-#define DEFAULT_SLOTMEM_SUFFIX ".shm"
-
 static const char *slotmem_filename(apr_pool_t *pool, const char *slotmemname)
 {
     const char *fname;
@@ -136,9 +134,9 @@ static const char *slotmem_filename(apr_
         return NULL;
     }
     else if (slotmemname[0] != '/') {
-        const char *path = apr_pstrcat(pool, DEFAULT_SLOTMEM_PREFIX, slotmemname,
-                                       DEFAULT_SLOTMEM_SUFFIX, NULL);
-        fname = ap_server_root_relative(pool, path);
+        const char *filenm = apr_pstrcat(pool, DEFAULT_SLOTMEM_PREFIX,
+                                       slotmemname, DEFAULT_SLOTMEM_SUFFIX, NULL);
+        fname = ap_runtime_dir_relative(pool, filenm);
     }
     else {
         fname = slotmemname;
@@ -297,6 +295,9 @@ static apr_status_t slotmem_create(ap_sl
     }
 
     /* first try to attach to existing shared memory */
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02300)
+                 "create %s: %"APR_SIZE_T_FMT"/%u", fname, item_size,
+                 item_num);
     if (fbased) {
         rv = apr_shm_attach(&shm, fname, gpool);
     }
@@ -401,6 +402,9 @@ static apr_status_t slotmem_attach(ap_sl
         return APR_ENOSHMAVAIL;
     }
 
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02301)
+                 "attach looking for %s", fname);
+
     /* first try to attach to existing slotmem */
     if (next) {
         for (;;) {
@@ -409,6 +413,10 @@ static apr_status_t slotmem_attach(ap_sl
                 *new = next;
                 *item_size = next->desc.size;
                 *item_num = next->desc.num;
+                ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
+                             APLOGNO(02302)
+                             "attach found %s: %"APR_SIZE_T_FMT"/%u", fname,
+                             *item_size, *item_num);
                 return APR_SUCCESS;
             }
             if (!next->next) {
@@ -418,7 +426,7 @@ static apr_status_t slotmem_attach(ap_sl
         }
     }
 
-    /* first try to attach to existing shared memory */
+    /* next try to attach to existing shared memory */
     rv = apr_shm_attach(&shm, fname, gpool);
     if (rv != APR_SUCCESS) {
         return rv;
@@ -453,6 +461,10 @@ static apr_status_t slotmem_attach(ap_sl
     *new = res;
     *item_size = desc.size;
     *item_num = desc.num;
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
+                 APLOGNO(02303)
+                 "attach found %s: %"APR_SIZE_T_FMT"/%u", fname,
+                 *item_size, *item_num);
     return APR_SUCCESS;
 }