]> granicus.if.org Git - apache/commitdiff
Move to an enum, instead of bitmaps... no functional
authorJim Jagielski <jim@apache.org>
Tue, 5 May 2009 12:38:15 +0000 (12:38 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 5 May 2009 12:38:15 +0000 (12:38 +0000)
change

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@771697 13f79535-47bb-0310-9956-ffa450edef68

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

index 9de53fbcb1fcad214c244b099add2cc2224a7cfc..cdd2677ee59d7b6e00dbe835857bb787ae0b0efd 100644 (file)
@@ -50,7 +50,9 @@
 
 #define AP_SLOTMEM_STORAGE "slotmem"
 
-#define CREPER_SLOTMEM 2 /* create a persistent slotmem */
+typedef enum {
+    SLOTMEM_PERSIST      /* create a persistent slotmem */
+} apslotmem_type;
 
 typedef struct ap_slotmem_t ap_slotmem_t;
 
@@ -87,7 +89,7 @@ struct ap_slotmem_storage_method {
      * @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, int type, 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, apslotmem_type type, apr_pool_t *pool);
     /**
      * attach to an existing slotmem.
      * This would attach to  shared memory, basically.
@@ -170,7 +172,7 @@ AP_DECLARE(apr_status_t) ap_slotmem_do(ap_slotmem_storage_method *sm, ap_slotmem
  * @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, int type, 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, apslotmem_type type, apr_pool_t *pool);
 
 /**
  * attach to an existing slotmem.
index 29e35992c404ae885abe8d7167dc55939bb4fbae..608b75ef71618f24d4183547ec79715f169fb2ee 100644 (file)
@@ -51,7 +51,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, int type, 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, apslotmem_type type, apr_pool_t *pool)
 {
     ap_slotmem_t *res;
     ap_slotmem_t *next = globallistmem;
index 8d1dc7469d7ab42e41adea370bb32e3c2692a080..f0d7bae88e6bf5ac4c86ef5017f19ea3019090be 100644 (file)
@@ -63,6 +63,7 @@ static apr_pool_t *gpool = NULL;
 static apr_global_mutex_t *smutex;
 static const char *mutex_fname;
 
+/* apr:shmem/unix/shm.c */
 static apr_status_t unixd_set_shm_perms(const char *fname)
 {
 #ifdef AP_NEED_SET_MUTEX_PERMS
@@ -207,7 +208,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, int type, 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, apslotmem_type type, apr_pool_t *pool)
 {
 /*    void *slotmem = NULL; */
     void *ptr;
@@ -283,6 +284,8 @@ static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_siz
             /* Set permissions to shared memory
              * so it can be attached by child process
              * having different user credentials
+             *
+             * See apr:shmem/unix/shm.c
              */
             unixd_set_shm_perms(fname);
         }
@@ -292,7 +295,7 @@ 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);
-        if (type & CREPER_SLOTMEM)
+        if (type == SLOTMEM_PERSIST)
             restore_slotmem(ptr, fname, item_size, item_num, pool);
     }
 
index 63576c282597978b5b4b9851e7204d1439ea378f..f3fc561d42efb06e173e3013f3aa4932e0299f0a 100644 (file)
@@ -42,7 +42,7 @@ 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,
+                                           apslotmem_type type,
                                            apr_pool_t *pool)
 {
     return (sm->slotmem_create(new, name, item_size, item_num, type, pool));