You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2012/12/16 15:13:50 UTC
svn commit: r1422580 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS
docs/manual/mod/mod_slotmem_plain.xml docs/manual/mod/mod_slotmem_shm.xml
include/ap_mmn.h include/ap_slotmem.h modules/slotmem/mod_slotmem_plain.c
modules/slotmem/mod_slotmem_shm.c
Author: minfrin
Date: Sun Dec 16 14:13:49 2012
New Revision: 1422580
URL: http://svn.apache.org/viewvc?rev=1422580&view=rev
Log:
mod_slotmem_*: Add in new fgrab() function which forces a grab and
slot allocation on a specified slot. Allow for clearing of inuse
array.
trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1386880
http://svn.apache.org/viewvc?view=revision&revision=1387389
http://svn.apache.org/viewvc?view=revision&revision=1388445
http://svn.apache.org/viewvc?view=revision&revision=1394079
Submitted by: jim
Reviewed by: rjung, minfrin
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/manual/mod/mod_slotmem_plain.xml
httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_shm.xml
httpd/httpd/branches/2.4.x/include/ap_mmn.h
httpd/httpd/branches/2.4.x/include/ap_slotmem.h
httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_plain.c
httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1386880,1387389,1388445,1394079
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sun Dec 16 14:13:49 2012
@@ -2,6 +2,10 @@
Changes with Apache 2.4.4
+ *) mod_slotmem_*: Add in new fgrab() function which forces a grab and
+ slot allocation on a specified slot. Allow for clearing of inuse
+ array. [Jim Jagielski]
+
*) mod_proxy_ftp: Fix segfaults on IPv4 requests to hosts with DNS
AAAA records. PR 40841. [Andrew Rucker Jones <arjones simultan
dyndns org>, <ast domdv de>, Jim Jagielski]
Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sun Dec 16 14:13:49 2012
@@ -91,17 +91,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_slotmem_*: Add in new fgrab() function which forces a grab and
- slot allocation on a specified slot. Allow for clearing of inuse
- array.
- trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1386880
- http://svn.apache.org/viewvc?view=revision&revision=1387389
- http://svn.apache.org/viewvc?view=revision&revision=1388445
- http://svn.apache.org/viewvc?view=revision&revision=1394079
- 2.4.x patch: trunk patch works
- +1: jim, rjung
- +1: minfrin (with MMN bump)
-
* ap_expr: Add req_novary function that allows HTTP header lookups
without adding the name to the Vary header
Not critical for 2.4.4.
Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_plain.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_plain.xml?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_plain.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_slotmem_plain.xml Sun Dec 16 14:13:49 2012
@@ -67,10 +67,13 @@
<dt>apr_size_t slot_size(ap_slotmem_instance_t *s)</dt>
<dd>return the total data size, in bytes, of a slot in the segment</dd>
- <dt>apr_status_t grab(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
- <dd>grab or allocate a slot and mark as in-use (does not do any data copying)</dd>
+ <dt>apr_status_t grab(ap_slotmem_instance_t *s, unsigned int *item_id);</dt>
+ <dd>grab or allocate the first free slot and mark as in-use (does not do any data copying)</dd>
- <dt>apr_status_t release(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
+ <dt>apr_status_t fgrab(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
+ <dd>forced grab or allocate the specified slot and mark as in-use (does not do any data copying)</dd>
+
+ <dt>apr_status_t release(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
<dd>release or free a slot and mark as not in-use (does not do any data copying)</dd>
</dl>
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=1422580&r1=1422579&r2=1422580&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 Sun Dec 16 14:13:49 2012
@@ -80,8 +80,11 @@
<dt>apr_size_t slot_size(ap_slotmem_instance_t *s)</dt>
<dd>return the total data size, in bytes, of a slot in the segment</dd>
- <dt>apr_status_t grab(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
- <dd>grab or allocate a slot and mark as in-use (does not do any data copying)</dd>
+ <dt>apr_status_t grab(ap_slotmem_instance_t *s, unsigned int *item_id);</dt>
+ <dd>grab or allocate the first free slot and mark as in-use (does not do any data copying)</dd>
+
+ <dt>apr_status_t fgrab(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
+ <dd>forced grab or allocate the specified slot and mark as in-use (does not do any data copying)</dd>
<dt>apr_status_t release(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
<dd>release or free a slot and mark as not in-use (does not do any data copying)</dd>
Modified: httpd/httpd/branches/2.4.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_mmn.h?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_mmn.h Sun Dec 16 14:13:49 2012
@@ -398,6 +398,7 @@
* 20120211.6 (2.4.3-dev) Add ap_proxy_checkproxyblock2.
* 20120211.7 (2.4.3-dev) Add ap_get_loadavg()
* 20120211.8 (2.4.3-dev) Add sticky_separator to proxy_balancer_shared struct.
+ * 20120211.9 (2.4.3-dev) Add fgrab() to ap_slotmem_provider_t.
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -405,7 +406,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 8 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 9 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/branches/2.4.x/include/ap_slotmem.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_slotmem.h?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_slotmem.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_slotmem.h Sun Dec 16 14:13:49 2012
@@ -179,6 +179,13 @@ struct ap_slotmem_provider_t {
* @return APR_SUCCESS if all went well
*/
apr_status_t (* release)(ap_slotmem_instance_t *s, unsigned int item_id);
+ /**
+ * forced grab (or alloc) a slot associated with this item_id
+ * @param s ap_slotmem_instance_t to use.
+ * @param item_id to the specified slot id and marked as in-use
+ * @return APR_SUCCESS if all went well
+ */
+ apr_status_t (* fgrab)(ap_slotmem_instance_t *s, unsigned int item_id);
};
typedef struct ap_slotmem_provider_t ap_slotmem_provider_t;
Modified: httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_plain.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_plain.c?rev=1422580&r1=1422579&r2=1422580&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_plain.c (original)
+++ httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_plain.c Sun Dec 16 14:13:49 2012
@@ -154,7 +154,7 @@ static apr_status_t slotmem_dptr(ap_slot
if (!score)
return APR_ENOSHMAVAIL;
if (id >= score->num)
- return APR_ENOSHMAVAIL;
+ return APR_EINVAL;
ptr = (char *)score->base + score->size * id;
if (!ptr)
@@ -174,7 +174,10 @@ static apr_status_t slotmem_get(ap_slotm
}
inuse = slot->inuse + id;
- if (id >= slot->num || (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse)) {
+ if (id >= slot->num) {
+ return APR_EINVAL;
+ }
+ if (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse) {
return APR_NOTFOUND;
}
ret = slotmem_dptr(slot, id, &ptr);
@@ -197,7 +200,10 @@ static apr_status_t slotmem_put(ap_slotm
}
inuse = slot->inuse + id;
- if (id >= slot->num || (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse)) {
+ if (id >= slot->num) {
+ return APR_EINVAL;
+ }
+ if (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse) {
return APR_NOTFOUND;
}
ret = slotmem_dptr(slot, id, &ptr);
@@ -251,13 +257,29 @@ static apr_status_t slotmem_grab(ap_slot
}
}
if (i >= slot->num) {
- return APR_ENOSHMAVAIL;
+ return APR_EINVAL;
}
*inuse = 1;
*id = i;
return APR_SUCCESS;
}
+static apr_status_t slotmem_fgrab(ap_slotmem_instance_t *slot, unsigned int id)
+{
+ char *inuse;
+
+ if (!slot) {
+ return APR_ENOSHMAVAIL;
+ }
+
+ if (id >= slot->num) {
+ return APR_EINVAL;
+ }
+ inuse = slot->inuse + id;
+ *inuse = 1;
+ return APR_SUCCESS;
+}
+
static apr_status_t slotmem_release(ap_slotmem_instance_t *slot, unsigned int id)
{
char *inuse;
@@ -268,7 +290,10 @@ static apr_status_t slotmem_release(ap_s
inuse = slot->inuse;
- if (id >= slot->num || !inuse[id] ) {
+ if (id >= slot->num) {
+ return APR_EINVAL;
+ }
+ if (!inuse[id] ) {
return APR_NOTFOUND;
}
inuse[id] = 0;
@@ -287,7 +312,8 @@ static const ap_slotmem_provider_t stora
&slotmem_num_free_slots,
&slotmem_slot_size,
&slotmem_grab,
- &slotmem_release
+ &slotmem_release,
+ &slotmem_fgrab
};
static int pre_config(apr_pool_t *p, apr_pool_t *plog,
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=1422580&r1=1422579&r2=1422580&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 Dec 16 14:13:49 2012
@@ -634,6 +634,30 @@ static apr_status_t slotmem_grab(ap_slot
return APR_SUCCESS;
}
+static apr_status_t slotmem_fgrab(ap_slotmem_instance_t *slot, unsigned int id)
+{
+ char *inuse;
+
+ if (!slot) {
+ return APR_ENOSHMAVAIL;
+ }
+
+ if (id >= slot->desc.num) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02236)
+ "slotmem(%s) fgrab failed. Num %u/num_free %u",
+ slot->name, slotmem_num_slots(slot),
+ slotmem_num_free_slots(slot));
+ return APR_EINVAL;
+ }
+ inuse = slot->inuse + id;
+
+ if (!*inuse) {
+ *inuse = 1;
+ (*slot->num_free)--;
+ }
+ return APR_SUCCESS;
+}
+
static apr_status_t slotmem_release(ap_slotmem_instance_t *slot,
unsigned int id)
{
@@ -673,7 +697,8 @@ static const ap_slotmem_provider_t stora
&slotmem_num_free_slots,
&slotmem_slot_size,
&slotmem_grab,
- &slotmem_release
+ &slotmem_release,
+ &slotmem_fgrab
};
/* make the storage usuable from outside */