Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-31 Thread Jim Jagielski


On Dec 23, 2008, at 3:56 PM, Ruediger Pluem wrote:


Style!
Why no stack approach, but a queue approach for the list?


Looking over, the orig impl had the list tucked away in
an APR array... not sure when/why it was changed. 


Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-24 Thread Jim Jagielski


On Dec 23, 2008, at 1:54 PM, Paul Querna wrote:


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...



A general question, why now?



As long as we are adding features to trunk, this is a useful
feature. Maybe not for the scoreboard, per se, but for
other modules...



You shouldn't need the .deps or Makefiles committed.





Yeah, these were added by mistake.


Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-24 Thread Jim Jagielski


On Dec 23, 2008, at 3:56 PM, Ruediger Pluem wrote:





The intent is to get this in trunk, and improve. I did not
do style changes or other performance improvements so that
the diffs between what was committed and what was in h-p were
minimal.


Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-24 Thread Jim Jagielski


On Dec 23, 2008, at 3:56 PM, Ruediger Pluem wrote:

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.



?? If other modules use this, then the module needs to be enabled
at which point -I is setup to find the required header files.

+static const char *store_filename(apr_pool_t *pool, const char  
*slotmemname)

+{
+const char *storename;
+const char *fname;
+if (strcmp(slotmemname, anonymous) == 0)
+fname = ap_server_root_relative(pool, logs/anonymous);


Hm. Hardcoded relative location? This looks ugly.


Yep




+
+static apr_status_t ap_slotmem_do(ap_slotmem_t *mem,  
ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)

+{
+int i;
+void *ptr;
+
+if (!mem) {
+return APR_ENOSHMAVAIL;
+}
+
+ptr = mem-base;
+for (i = 0; i  mem-num; i++) {
+ptr = ptr + mem-size;
+func((void *)ptr, data, pool);
+}
+return 0;


Why not APR_SUCCESS?



Fixed 729309




If item_size and item_num do not match with what is saved the caller  
gets not notified that something bad

happened.



Hmmm... yeah...


+}
+
+/* For the chained slotmem stuff */
+res-name = apr_pstrdup(globalpool, fname);
+res-base = ptr;
+res-size = item_size;
+res-num = item_num;
+res-globalpool = globalpool;
+res-next = NULL;
+if (globallistmem==NULL) {
+globallistmem = res;
+}
+else {
+next-next = res;
+}


Why no stack approach, but a queue approach for the list?



Let me profile both





Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-24 Thread Ruediger Pluem


On 12/24/2008 02:09 PM, Jim Jagielski wrote:
 
 On Dec 23, 2008, at 3:56 PM, Ruediger Pluem wrote:
 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.

 
 ?? If other modules use this, then the module needs to be enabled
 at which point -I is setup to find the required header files.

My point was that if other stock modules intent to use it the header files
maybe should be in includes (like httpd.h). Otherwise there might be a surprise 
that
headers from non 3rd party code is taken from more then the current dir
and includes. But I have no real strong feelings here.


Regards

RĂ¼diger


Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-23 Thread Paul Querna

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...



A general question, why now?

This branch:
https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard/

Was last changed 2 years, 4 months ago.

The last discussion on the dev list was 2 years ago:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200612.mbox/%3c1165841856.3167.70.ca...@jfcpc%3e



Added:
httpd/httpd/trunk/modules/mem/
httpd/httpd/trunk/modules/mem/.deps
httpd/httpd/trunk/modules/mem/Makefile   (with props)


You shouldn't need the .deps or Makefiles committed.


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/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

...

+/* Memory handler for a plain memory divided in slot.
+ * This one uses plain memory.
+ */
+#define CORE_PRIVATE


CORE_PRIVATE was removed from trunk.




Re: svn commit: r729059 - in /httpd/httpd/trunk/modules/mem: ./ .deps Makefile Makefile.in config5.m4 mod_plainmem.c mod_sharedmem.c modules.mk sharedmem_util.c sharedmem_util.h slotmem.h

2008-12-23 Thread Ruediger Pluem


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;
 +