From 137ace1c41b5e8f4b8fd66777a8a469d8402550c Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Mon, 12 Dec 2011 20:05:52 +0000 Subject: [PATCH] Merge r1210261 from trunk: mod_slotmem_shm: Remove the colon syntax to indicate a relative path, and make the relative path default behaviour. Remove the word "anonymous" as a filename for special treatment, what used to be "anonymous" is now "none". Submitted by: minfrin Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1213401 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_slotmem_shm.xml | 10 ++++----- modules/slotmem/mod_slotmem_shm.c | 32 +++++++++++++---------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/docs/manual/mod/mod_slotmem_shm.xml b/docs/manual/mod/mod_slotmem_shm.xml index 0e475794d2..7a6ed8099e 100644 --- a/docs/manual/mod/mod_slotmem_shm.xml +++ b/docs/manual/mod/mod_slotmem_shm.xml @@ -54,12 +54,10 @@
"none"
Does not persist shared memory in file.
-
"anonymous"
-
$server_root/logs/anonymous.slotmem
-
":file-name"
-
$server_root/logs/file-name.slotmem
-
"absolute-file-name"
-
$absolute-file-name.slotmem
+
"file-name"
+
$server_root/file-name
+
"/absolute-file-name"
+
$absolute-file-name
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)
diff --git a/modules/slotmem/mod_slotmem_shm.c b/modules/slotmem/mod_slotmem_shm.c index 2faed759d4..c14093dc46 100644 --- a/modules/slotmem/mod_slotmem_shm.c +++ b/modules/slotmem/mod_slotmem_shm.c @@ -119,29 +119,24 @@ static apr_status_t unixd_set_shm_perms(const char *fname) * Persist the slotmem in a file * slotmem name and file name. * none : no persistent data - * anonymous : $server_root/logs/anonymous.slotmem - * :rel_name : $server_root/logs/rel_name.slotmem - * abs_name : $abs_name.slotmem + * rel_name : $server_root/rel_name + * /abs_name : $abs_name * */ static const char *store_filename(apr_pool_t *pool, const char *slotmemname) { const char *storename; const char *fname; - if (strcasecmp(slotmemname, "none") == 0) + if (strcasecmp(slotmemname, "none") == 0) { return NULL; - else if (strcasecmp(slotmemname, "anonymous") == 0) - fname = ap_server_root_relative(pool, "logs/anonymous"); - else if (slotmemname[0] == ':') { - const char *tmpname; - tmpname = apr_pstrcat(pool, "logs/", &slotmemname[1], NULL); - fname = ap_server_root_relative(pool, tmpname); + } + else if (slotmemname[0] != '/') { + fname = ap_server_root_relative(pool, slotmemname); } else { fname = slotmemname; } - storename = apr_pstrcat(pool, fname, ".slotmem", NULL); - return storename; + return fname; } static void store_slotmem(ap_slotmem_instance_t *slotmem) @@ -269,14 +264,15 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, (item_num * sizeof(char)) + basesize; apr_status_t rv; - if (gpool == NULL) + if (gpool == NULL) { return APR_ENOSHMAVAIL; + } if (name) { - if (name[0] == ':') { - fname = name; + if (name[0] != '/') { + fname = ap_server_root_relative(pool, name); } else { - fname = ap_server_root_relative(pool, name); + fname = name; } /* first try to attach to existing slotmem */ @@ -295,11 +291,11 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, } } else { - fname = "anonymous"; + fname = "none"; } /* first try to attach to existing shared memory */ - fbased = (name && name[0] != ':'); + fbased = (name != NULL); if (fbased) { rv = apr_shm_attach(&shm, fname, gpool); } -- 2.40.0