#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;
* @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.
* @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.
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;
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
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;
/* 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);
}
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);
}
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));