httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1305127 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS docs/ modules/slotmem/mod_slotmem_shm.c
Date Sun, 25 Mar 2012 20:57:53 GMT
Author: minfrin
Date: Sun Mar 25 20:57:52 2012
New Revision: 1305127

URL: http://svn.apache.org/viewvc?rev=1305127&view=rev
Log:
Backport:
mod_slotmem_shm: Support DEFAULT_REL_RUNTIMEDIR for file-based shm.

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/docs/   (props changed)
    httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1297560

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1305127&r1=1305126&r2=1305127&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sun Mar 25 20:57:52 2012
@@ -6,6 +6,9 @@ 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: Support DEFAULT_REL_RUNTIMEDIR for file-based shm.
+     [Jim Jagielski]
+
   *) core: Fix merging of AllowOverrideList and ContentDigest.
      [Stefan Fritsch]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1305127&r1=1305126&r2=1305127&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sun Mar 25 20:57:52 2012
@@ -100,10 +100,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.4.x patch: Trunk patch works (skip docs/log-message-tags/next-number)
     +1: sf, covener, druggeri
 
-  * mod_slotmem_shm: Support DEFAULT_REL_RUNTIMEDIR for file-based shm.
-    Trunk patch: http://svn.apache.org/viewvc?rev=1297560&view=rev
-    2.4.x patch: Trunk patch works
-    +1:  jim, jorton, minfrin
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Propchange: httpd/httpd/branches/2.4.x/docs/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs:r1297560

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=1305127&r1=1305126&r2=1305127&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 Sun Mar 25 20:57:52 2012
@@ -124,14 +124,21 @@ static apr_status_t unixd_set_shm_perms(
  * /abs_name : $abs_name
  *
  */
-static const char *store_filename(apr_pool_t *pool, const char *slotmemname)
+
+#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;
-    if (strcasecmp(slotmemname, "none") == 0) {
+    if (!slotmemname || strcasecmp(slotmemname, "none") == 0) {
         return NULL;
     }
     else if (slotmemname[0] != '/') {
-        fname = ap_server_root_relative(pool, slotmemname);
+        const char *path = apr_pstrcat(pool, DEFAULT_SLOTMEM_PREFIX, slotmemname,
+                                       DEFAULT_SLOTMEM_SUFFIX, NULL);
+        fname = ap_server_root_relative(pool, path);
     }
     else {
         fname = slotmemname;
@@ -146,7 +153,7 @@ static void store_slotmem(ap_slotmem_ins
     apr_size_t nbytes;
     const char *storename;
 
-    storename = store_filename(slotmem->gpool, slotmem->name);
+    storename = slotmem_filename(slotmem->gpool, slotmem->name);
 
     if (storename) {
         rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE,
@@ -175,7 +182,7 @@ static void restore_slotmem(void *ptr, c
     apr_size_t nbytes = size;
     apr_status_t rv;
 
-    storename = store_filename(pool, name);
+    storename = slotmem_filename(pool, name);
 
     if (storename) {
         rv = apr_file_open(&fp, storename, APR_READ | APR_WRITE, APR_OS_DEFAULT,
@@ -252,7 +259,7 @@ static apr_status_t slotmem_create(ap_sl
                                    ap_slotmem_type_t type, apr_pool_t *pool)
 {
 /*    void *slotmem = NULL; */
-    int fbased;
+    int fbased = 1;
     char *ptr;
     sharedslotdesc_t desc;
     ap_slotmem_instance_t *res;
@@ -267,14 +274,8 @@ static apr_status_t slotmem_create(ap_sl
     if (gpool == NULL) {
         return APR_ENOSHMAVAIL;
     }
-    if (name) {
-        if (name[0] != '/') {
-            fname = ap_server_root_relative(pool, name);
-        }
-        else {
-            fname = name;
-        }
-
+    fname = slotmem_filename(pool, name);
+    if (fname) {
         /* first try to attach to existing slotmem */
         if (next) {
             for (;;) {
@@ -291,11 +292,11 @@ static apr_status_t slotmem_create(ap_sl
         }
     }
     else {
+        fbased = 0;
         fname = "none";
     }
 
     /* first try to attach to existing shared memory */
-    fbased = (name != NULL);
     if (fbased) {
         rv = apr_shm_attach(&shm, fname, gpool);
     }
@@ -395,15 +396,8 @@ static apr_status_t slotmem_attach(ap_sl
     if (gpool == NULL) {
         return APR_ENOSHMAVAIL;
     }
-    if (name) {
-        if (name[0] == ':') {
-            fname = name;
-        }
-        else {
-            fname = ap_server_root_relative(pool, name);
-        }
-    }
-    else {
+    fname = slotmem_filename(pool, name);
+    if (!fname) {
         return APR_ENOSHMAVAIL;
     }
 



Mime
View raw message