On 12/23/2008 07:39 PM, j...@apache.org wrote:
Author: jim
Date: Tue Dec 23 10:39:56 2008
New Revision: 729059
URL: http://svn.apache.org/viewvc?rev=729059view=rev
Log:
Add in the useful slotmem memory module, from httpd-scoreboard.
Cleaned up...
Added:
httpd/httpd/trunk/modules/mem/
httpd/httpd/trunk/modules/mem/.deps
httpd/httpd/trunk/modules/mem/Makefile (with props)
httpd/httpd/trunk/modules/mem/Makefile.in (with props)
httpd/httpd/trunk/modules/mem/config5.m4 (with props)
httpd/httpd/trunk/modules/mem/mod_plainmem.c (with props)
httpd/httpd/trunk/modules/mem/mod_sharedmem.c (with props)
httpd/httpd/trunk/modules/mem/modules.mk
httpd/httpd/trunk/modules/mem/sharedmem_util.c (with props)
httpd/httpd/trunk/modules/mem/sharedmem_util.h (with props)
httpd/httpd/trunk/modules/mem/slotmem.h (with props)
Added: httpd/httpd/trunk/modules/mem/.deps
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/.deps?rev=729059view=auto
==
(empty)
Added: httpd/httpd/trunk/modules/mem/Makefile
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/Makefile?rev=729059view=auto
==
--- httpd/httpd/trunk/modules/mem/Makefile (added)
+++ httpd/httpd/trunk/modules/mem/Makefile Tue Dec 23 10:39:56 2008
@@ -0,0 +1,7 @@
+top_srcdir = /Users/jim/src/asf/code/dev/httpd-trunk
+top_builddir = /Users/jim/src/asf/code/dev/httpd-trunk
+srcdir = /Users/jim/src/asf/code/dev/httpd-trunk/modules/mem
+builddir = /Users/jim/src/asf/code/dev/httpd-trunk/modules/mem
+VPATH= /Users/jim/src/asf/code/dev/httpd-trunk/modules/mem
+
+include $(top_srcdir)/build/special.mk
Propchange: httpd/httpd/trunk/modules/mem/Makefile
--
svn:eol-style = native
I deleted the above two files / dirs in r729080 as they get generated during
build.
Added: httpd/httpd/trunk/modules/mem/config5.m4
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/config5.m4?rev=729059view=auto
==
--- httpd/httpd/trunk/modules/mem/config5.m4 (added)
+++ httpd/httpd/trunk/modules/mem/config5.m4 Tue Dec 23 10:39:56 2008
@@ -0,0 +1,14 @@
+dnl modules enabled in this directory by default
+
+dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[,
config)
+
+APACHE_MODPATH_INIT(mem)
+
+sharedmem_objs=mod_sharedmem.lo sharedmem_util.lo
+APACHE_MODULE(sharedmem, memslot provider that uses shared memory,
$sharedmem_objs, , most)
+APACHE_MODULE(plainmem, memslot provider that uses plain memory, , , no)
+
+# Ensure that other modules can pick up slotmem.h
+APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current])
Hm. I think this should be in includes if it is intended to be used by other
stock modules
and at least it needs to be copied to includes during installation.
+
+APACHE_MODPATH_FINISH
Propchange: httpd/httpd/trunk/modules/mem/config5.m4
--
svn:eol-style = native
Added: httpd/httpd/trunk/modules/mem/mod_plainmem.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/mod_plainmem.c?rev=729059view=auto
==
--- httpd/httpd/trunk/modules/mem/mod_plainmem.c (added)
+++ httpd/httpd/trunk/modules/mem/mod_plainmem.c Tue Dec 23 10:39:56 2008
+static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name,
apr_size_t item_size, int item_num, apr_pool_t *pool)
+{
+void *slotmem = NULL;
+ap_slotmem_t *res;
+ap_slotmem_t *next = globallistmem;
+const char *fname;
+apr_status_t rv;
+
+if (name) {
+if (name[0] == ':')
+fname = name;
+else
+fname = ap_server_root_relative(pool, name);
+
+/* first try to attach to existing slotmem */
+if (next) {
+for (;;) {
+if (strcmp(next-name, fname) == 0) {
+/* we already have it */
+*new = next;
+return APR_SUCCESS;
+}
+if (!next-next)
+break;
+next = next-next;
+}
+}
+} else
+fname = anonymous;
+
+/* create the memory using the globalpool */
+res = (ap_slotmem_t *) apr_pcalloc(globalpool, sizeof(ap_slotmem_t));
+res-base = apr_pcalloc(globalpool, item_size * item_num);
+if (!res-base)
+return APR_ENOSHMAVAIL;
+
+/* For the chained slotmem stuff */
+res-name = apr_pstrdup(globalpool, fname);
+res-size = item_size;
+