]> granicus.if.org Git - apache/commitdiff
Add a parameter for slotmem_create for the persistancy of the slotmem area.
authorJean-Frederic Clere <jfclere@apache.org>
Mon, 4 May 2009 12:22:36 +0000 (12:22 +0000)
committerJean-Frederic Clere <jfclere@apache.org>
Mon, 4 May 2009 12:22:36 +0000 (12:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@771286 13f79535-47bb-0310-9956-ffa450edef68

include/ap_slotmem.h
modules/mem/mod_sharedmem.c
server/slotmem.c

index a9578a18e003e4417e5a191ab339579d74b83a96..9de53fbcb1fcad214c244b099add2cc2224a7cfc 100644 (file)
@@ -50,6 +50,8 @@
 
 #define AP_SLOTMEM_STORAGE "slotmem"
 
+#define CREPER_SLOTMEM 2 /* create a persistent slotmem */
+
 typedef struct ap_slotmem_t ap_slotmem_t;
 
 /**
@@ -81,10 +83,11 @@ struct ap_slotmem_storage_method {
      * @param name is a key used for debugging and in mod_status output or allow another process to share this space.
      * @param item_size size of each item
      * @param item_num number of item to create.
+     * @param type type of slotmem.
      * @param pool is pool used
      * @return APR_SUCCESS if all went well
      */
-    apr_status_t (* slotmem_create)(ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, apr_pool_t *pool);
+    apr_status_t (* slotmem_create)(ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, int type, apr_pool_t *pool);
     /**
      * attach to an existing slotmem.
      * This would attach to  shared memory, basically.
@@ -163,10 +166,11 @@ AP_DECLARE(apr_status_t) ap_slotmem_do(ap_slotmem_storage_method *sm, ap_slotmem
  * @param name is a key used for debugging and in mod_status output or allow another process to share this space.
  * @param item_size size of each item
  * @param item_num number of item to create.
+ * @param type (persistent/allocatable/etc)
  * @param pool is pool used
  * @return APR_SUCCESS if all went well
  */
-AP_DECLARE(apr_status_t) ap_slotmem_create(ap_slotmem_storage_method *sm, ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, apr_pool_t *pool);
+AP_DECLARE(apr_status_t) ap_slotmem_create(ap_slotmem_storage_method *sm, ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, int type, apr_pool_t *pool);
 
 /**
  * attach to an existing slotmem.
index 600617308e8f4dd71acba9fe0cb47867dac03fde..259f46677366be3367de55c1eecace9bba6aca82 100644 (file)
@@ -207,7 +207,7 @@ static apr_status_t slotmem_do(ap_slotmem_t *mem, ap_slotmem_callback_fn_t *func
     return APR_SUCCESS;
 }
 
-static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, apr_pool_t *pool)
+static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_size_t item_size, unsigned int item_num, int type, apr_pool_t *pool)
 {
 /*    void *slotmem = NULL; */
     void *ptr;
@@ -292,7 +292,8 @@ static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_siz
         memcpy(ptr, &desc, sizeof(desc));
         ptr = ptr + sizeof(desc);
         memset(ptr, 0, item_size * item_num);
-        restore_slotmem(ptr, fname, item_size, item_num, pool);
+        if (type & CREPER_SLOTMEM)
+            restore_slotmem(ptr, fname, item_size, item_num, pool);
     }
 
     /* For the chained slotmem stuff */
index 8d4e31fd86f6522f602d08fa2a3a35af6589794a..63576c282597978b5b4b9851e7204d1439ea378f 100644 (file)
@@ -42,9 +42,10 @@ AP_DECLARE(apr_status_t) ap_slotmem_do(ap_slotmem_storage_method *sm,
 AP_DECLARE(apr_status_t) ap_slotmem_create(ap_slotmem_storage_method *sm,
                                            ap_slotmem_t **new, const char *name,
                                            apr_size_t item_size, unsigned int item_num,
+                                           int type,
                                            apr_pool_t *pool)
 {
-    return (sm->slotmem_create(new, name, item_size, item_num, pool));
+    return (sm->slotmem_create(new, name, item_size, item_num, type, pool));
 }
 
 AP_DECLARE(apr_status_t) ap_slotmem_attach(ap_slotmem_storage_method *sm,