Apache HTTPD
Classes | Macros | Functions | Variables
mod_slotmem_shm.c File Reference
#include "ap_slotmem.h"
#include "httpd.h"
#include "http_main.h"
#include "ap_mpm.h"

Go to the source code of this file.

Classes

struct  sharedslotdesc_t
 
struct  ap_slotmem_instance_t
 

Macros

#define AP_SLOTMEM_IS_PREGRAB(t)   (t->desc->type & AP_SLOTMEM_TYPE_PREGRAB)
 
#define AP_SLOTMEM_IS_PERSIST(t)   (t->desc->type & AP_SLOTMEM_TYPE_PERSIST)
 
#define AP_SLOTMEM_IS_CLEARINUSE(t)   (t->desc->type & AP_SLOTMEM_TYPE_CLEARINUSE)
 
#define AP_SLOTMEM_OFFSET   (APR_ALIGN_DEFAULT(sizeof(sharedslotdesc_t)))
 
#define AP_UNSIGNEDINT_OFFSET   (APR_ALIGN_DEFAULT(sizeof(unsigned int)))
 
#define DEFAULT_SLOTMEM_PREFIX   "slotmem-shm-"
 
#define DEFAULT_SLOTMEM_SUFFIX   ".shm"
 
#define DEFAULT_SLOTMEM_PERSIST_SUFFIX   ".persist"
 

Functions

static int slotmem_filenames (apr_pool_t *pool, const char *slotname, const char **filename, const char **persistname)
 
static void slotmem_clearinuse (ap_slotmem_instance_t *slot)
 
static void store_slotmem (ap_slotmem_instance_t *slotmem)
 
static apr_status_t restore_slotmem (sharedslotdesc_t *desc, const char *storename, apr_size_t size, apr_pool_t *pool)
 
static APR_INLINE int is_child_process (void)
 
static apr_status_t cleanup_slotmem (void *param)
 
static apr_status_t slotmem_doall (ap_slotmem_instance_t *mem, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)
 
static apr_status_t slotmem_create (ap_slotmem_instance_t **new, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)
 
static apr_status_t slotmem_attach (ap_slotmem_instance_t **new, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)
 
static apr_status_t slotmem_dptr (ap_slotmem_instance_t *slot, unsigned int id, void **mem)
 
static apr_status_t slotmem_get (ap_slotmem_instance_t *slot, unsigned int id, unsigned char *dest, apr_size_t dest_len)
 
static apr_status_t slotmem_put (ap_slotmem_instance_t *slot, unsigned int id, unsigned char *src, apr_size_t src_len)
 
static unsigned int slotmem_num_slots (ap_slotmem_instance_t *slot)
 
static unsigned int slotmem_num_free_slots (ap_slotmem_instance_t *slot)
 
static apr_size_t slotmem_slot_size (ap_slotmem_instance_t *slot)
 
static apr_status_t slotmem_grab (ap_slotmem_instance_t *slot, unsigned int *id)
 
static apr_status_t slotmem_fgrab (ap_slotmem_instance_t *slot, unsigned int id)
 
static apr_status_t slotmem_release (ap_slotmem_instance_t *slot, unsigned int id)
 
static const ap_slotmem_provider_tslotmem_shm_getstorage (void)
 
static int post_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 
static int pre_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
 
static void ap_slotmem_shm_register_hook (apr_pool_t *p)
 

Variables

static struct ap_slotmem_instance_tgloballistmem = NULL
 
static apr_pool_tgpool = NULL
 
static const ap_slotmem_provider_t storage
 
static int *const aplog_module_index = &( slotmem_shm_module.module_index)
 

Macro Definition Documentation

◆ AP_SLOTMEM_IS_CLEARINUSE

#define AP_SLOTMEM_IS_CLEARINUSE (   t)    (t->desc->type & AP_SLOTMEM_TYPE_CLEARINUSE)

Definition at line 32 of file mod_slotmem_shm.c.

◆ AP_SLOTMEM_IS_PERSIST

#define AP_SLOTMEM_IS_PERSIST (   t)    (t->desc->type & AP_SLOTMEM_TYPE_PERSIST)

Definition at line 31 of file mod_slotmem_shm.c.

◆ AP_SLOTMEM_IS_PREGRAB

#define AP_SLOTMEM_IS_PREGRAB (   t)    (t->desc->type & AP_SLOTMEM_TYPE_PREGRAB)

Definition at line 30 of file mod_slotmem_shm.c.

◆ AP_SLOTMEM_OFFSET

#define AP_SLOTMEM_OFFSET   (APR_ALIGN_DEFAULT(sizeof(sharedslotdesc_t)))

Definition at line 41 of file mod_slotmem_shm.c.

◆ AP_UNSIGNEDINT_OFFSET

#define AP_UNSIGNEDINT_OFFSET   (APR_ALIGN_DEFAULT(sizeof(unsigned int)))

Definition at line 42 of file mod_slotmem_shm.c.

◆ DEFAULT_SLOTMEM_PERSIST_SUFFIX

#define DEFAULT_SLOTMEM_PERSIST_SUFFIX   ".persist"

Definition at line 77 of file mod_slotmem_shm.c.

◆ DEFAULT_SLOTMEM_PREFIX

#define DEFAULT_SLOTMEM_PREFIX   "slotmem-shm-"

Definition at line 75 of file mod_slotmem_shm.c.

◆ DEFAULT_SLOTMEM_SUFFIX

#define DEFAULT_SLOTMEM_SUFFIX   ".shm"

Definition at line 76 of file mod_slotmem_shm.c.

Function Documentation

◆ ap_slotmem_shm_register_hook()

static void ap_slotmem_shm_register_hook ( apr_pool_t p)
static

Definition at line 771 of file mod_slotmem_shm.c.

◆ cleanup_slotmem()

static apr_status_t cleanup_slotmem ( void *  param)
static

Definition at line 294 of file mod_slotmem_shm.c.

◆ is_child_process()

static APR_INLINE int is_child_process ( void  )
static

Definition at line 285 of file mod_slotmem_shm.c.

◆ post_config()

static int post_config ( apr_pool_t p,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)
static

< Module has handled this stage.

Definition at line 757 of file mod_slotmem_shm.c.

◆ pre_config()

static int pre_config ( apr_pool_t p,
apr_pool_t plog,
apr_pool_t ptemp 
)
static

< Module has handled this stage.

Definition at line 764 of file mod_slotmem_shm.c.

◆ restore_slotmem()

static apr_status_t restore_slotmem ( sharedslotdesc_t desc,
const char storename,
apr_size_t  size,
apr_pool_t pool 
)
static

< Open the file for reading

<

Deprecated:
See also
APR_FOPEN_READ

< Open the file for writing

<

Deprecated:
See also
APR_FOPEN_WRITE

< use OS's default permissions

<

Deprecated:
See also
APR_FPROT_OS_DEFAULT

Definition at line 196 of file mod_slotmem_shm.c.

◆ slotmem_attach()

static apr_status_t slotmem_attach ( ap_slotmem_instance_t **  new,
const char name,
apr_size_t item_size,
unsigned int item_num,
apr_pool_t pool 
)
static

Definition at line 476 of file mod_slotmem_shm.c.

◆ slotmem_clearinuse()

static void slotmem_clearinuse ( ap_slotmem_instance_t slot)
static

Definition at line 134 of file mod_slotmem_shm.c.

◆ slotmem_create()

static apr_status_t slotmem_create ( ap_slotmem_instance_t **  new,
const char name,
apr_size_t  item_size,
unsigned int  item_num,
ap_slotmem_type_t  type,
apr_pool_t pool 
)
static

Definition at line 338 of file mod_slotmem_shm.c.

◆ slotmem_doall()

static apr_status_t slotmem_doall ( ap_slotmem_instance_t mem,
ap_slotmem_callback_fn_t func,
void *  data,
apr_pool_t pool 
)
static

Definition at line 312 of file mod_slotmem_shm.c.

◆ slotmem_dptr()

static apr_status_t slotmem_dptr ( ap_slotmem_instance_t slot,
unsigned int  id,
void **  mem 
)
static

Definition at line 553 of file mod_slotmem_shm.c.

◆ slotmem_fgrab()

static apr_status_t slotmem_fgrab ( ap_slotmem_instance_t slot,
unsigned int  id 
)
static

Definition at line 681 of file mod_slotmem_shm.c.

◆ slotmem_filenames()

static int slotmem_filenames ( apr_pool_t pool,
const char slotname,
const char **  filename,
const char **  persistname 
)
static

Definition at line 87 of file mod_slotmem_shm.c.

◆ slotmem_get()

static apr_status_t slotmem_get ( ap_slotmem_instance_t slot,
unsigned int  id,
unsigned char dest,
apr_size_t  dest_len 
)
static

Definition at line 573 of file mod_slotmem_shm.c.

◆ slotmem_grab()

static apr_status_t slotmem_grab ( ap_slotmem_instance_t slot,
unsigned int id 
)
static

Definition at line 652 of file mod_slotmem_shm.c.

◆ slotmem_num_free_slots()

static unsigned int slotmem_num_free_slots ( ap_slotmem_instance_t slot)
static

Definition at line 632 of file mod_slotmem_shm.c.

◆ slotmem_num_slots()

static unsigned int slotmem_num_slots ( ap_slotmem_instance_t slot)
static

Definition at line 627 of file mod_slotmem_shm.c.

◆ slotmem_put()

static apr_status_t slotmem_put ( ap_slotmem_instance_t slot,
unsigned int  id,
unsigned char src,
apr_size_t  src_len 
)
static

Definition at line 600 of file mod_slotmem_shm.c.

◆ slotmem_release()

static apr_status_t slotmem_release ( ap_slotmem_instance_t slot,
unsigned int  id 
)
static

Definition at line 705 of file mod_slotmem_shm.c.

◆ slotmem_shm_getstorage()

static const ap_slotmem_provider_t * slotmem_shm_getstorage ( void  )
static

Definition at line 749 of file mod_slotmem_shm.c.

◆ slotmem_slot_size()

static apr_size_t slotmem_slot_size ( ap_slotmem_instance_t slot)
static

Definition at line 647 of file mod_slotmem_shm.c.

◆ store_slotmem()

static void store_slotmem ( ap_slotmem_instance_t slotmem)
static

< Create the file if not there

<

Deprecated:
See also
APR_FOPEN_CREATE

< Open the file for reading

<

Deprecated:
See also
APR_FOPEN_READ

< Open the file for writing

<

Deprecated:
See also
APR_FOPEN_WRITE

< use OS's default permissions

<

Deprecated:
See also
APR_FPROT_OS_DEFAULT

< Create the file if not there

<

Deprecated:
See also
APR_FOPEN_CREATE

< Open the file for reading

<

Deprecated:
See also
APR_FOPEN_READ

< Open the file for writing

<

Deprecated:
See also
APR_FOPEN_WRITE

< use OS's default permissions

<

Deprecated:
See also
APR_FPROT_OS_DEFAULT

Definition at line 153 of file mod_slotmem_shm.c.

Variable Documentation

◆ aplog_module_index

int* const aplog_module_index = &( slotmem_shm_module.module_index)
static

Definition at line 780 of file mod_slotmem_shm.c.

◆ globallistmem

struct ap_slotmem_instance_t* globallistmem = NULL
static

Definition at line 72 of file mod_slotmem_shm.c.

◆ gpool

apr_pool_t* gpool = NULL
static

Definition at line 73 of file mod_slotmem_shm.c.

◆ storage

const ap_slotmem_provider_t storage
static
Initial value:
= {
"sharedmem",
}
static apr_size_t slotmem_slot_size(ap_slotmem_instance_t *slot)
static unsigned int slotmem_num_free_slots(ap_slotmem_instance_t *slot)
static apr_status_t slotmem_create(ap_slotmem_instance_t **new, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)
static apr_status_t slotmem_attach(ap_slotmem_instance_t **new, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)
static apr_status_t slotmem_put(ap_slotmem_instance_t *slot, unsigned int id, unsigned char *src, apr_size_t src_len)
static apr_status_t slotmem_doall(ap_slotmem_instance_t *mem, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)
static apr_status_t slotmem_get(ap_slotmem_instance_t *slot, unsigned int id, unsigned char *dest, apr_size_t dest_len)
static unsigned int slotmem_num_slots(ap_slotmem_instance_t *slot)
static apr_status_t slotmem_dptr(ap_slotmem_instance_t *slot, unsigned int id, void **mem)
static apr_status_t slotmem_release(ap_slotmem_instance_t *slot, unsigned int id)
static apr_status_t slotmem_grab(ap_slotmem_instance_t *slot, unsigned int *id)
static apr_status_t slotmem_fgrab(ap_slotmem_instance_t *slot, unsigned int id)

Definition at line 732 of file mod_slotmem_shm.c.