Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mod_watchdog
Collaboration diagram for mod_watchdog:

Macros

#define AP_WATCHDOG_SINGLETON   "_singleton_"
 
#define AP_WATCHDOG_DEFAULT   "_default_"
 
#define AP_WD_TM_INTERVAL   APR_TIME_C(1000000) /* 1 second */
 
#define AP_WD_TM_SLICE   APR_TIME_C(100000) /* 100 ms */
 
#define AP_WATCHDOG_STATE_STARTING   1
 
#define AP_WATCHDOG_STATE_RUNNING   2
 
#define AP_WATCHDOG_STATE_STOPPING   3
 
#define AP_WD_DECLARE(type)   type
 
#define AP_WD_DECLARE_NONSTD(type)   type
 
#define AP_WD_DECLARE_DATA
 

Typedefs

typedef struct ap_watchdog_t ap_watchdog_t
 
typedef apr_status_t ap_watchdog_callback_fn_t (int state, void *data, apr_pool_t *pool)
 

Functions

apr_status_t ap_watchdog_get_instance (ap_watchdog_t **watchdog, const char *name, int parent, int singleton, apr_pool_t *p)
 
apr_status_t ap_watchdog_register_callback (ap_watchdog_t *watchdog, apr_interval_time_t interval, const void *data, ap_watchdog_callback_fn_t *callback)
 
apr_status_t ap_watchdog_set_callback_interval (ap_watchdog_t *w, apr_interval_time_t interval, const void *data, ap_watchdog_callback_fn_t *callback)
 
int ap_hook_watchdog_need (server_rec *s, const char *name, int parent, int singleton)
 
int ap_hook_watchdog_init (server_rec *s, const char *name, apr_pool_t *pool)
 
int ap_hook_watchdog_exit (server_rec *s, const char *name, apr_pool_t *pool)
 
int ap_hook_watchdog_step (server_rec *s, const char *name, apr_pool_t *pool)
 

Detailed Description

Macro Definition Documentation

#define AP_WATCHDOG_DEFAULT   "_default_"

Default watchdog instance name

#define AP_WATCHDOG_SINGLETON   "_singleton_"

Default singleton watchdog instance name. Singleton watchdog is protected by mutex and guaranteed to be run inside a single child process at any time.

#define AP_WATCHDOG_STATE_RUNNING   2
#define AP_WATCHDOG_STATE_STARTING   1
#define AP_WATCHDOG_STATE_STOPPING   3
#define AP_WD_DECLARE (   type)    type
#define AP_WD_DECLARE_DATA
#define AP_WD_DECLARE_NONSTD (   type)    type
#define AP_WD_TM_INTERVAL   APR_TIME_C(1000000) /* 1 second */

Default Watchdog interval

#define AP_WD_TM_SLICE   APR_TIME_C(100000) /* 100 ms */

Watchdog thread timer resolution

Typedef Documentation

typedef apr_status_t ap_watchdog_callback_fn_t(int state, void *data, apr_pool_t *pool)

Callback function used for watchdog.

Parameters
stateWatchdog state function. See AP_WATCHDOG_STATE_ .
datais what was passed to ap_watchdog_register_callback function.
poolTemporary callback pool destroyed after the call.
Returns
APR_SUCCESS to continue calling this callback.
typedef struct ap_watchdog_t ap_watchdog_t

Function Documentation

int ap_hook_watchdog_exit ( server_rec s,
const char *  name,
apr_pool_t pool 
)

Watchdog terminate hook. It is called when the watchdog thread is terminated.

Parameters
sThe server record
nameWatchdog name.
poolThe pool used to create the watchdog.
int ap_hook_watchdog_init ( server_rec s,
const char *  name,
apr_pool_t pool 
)

Watchdog initialize hook. It is called after the watchdog thread is initialized.

Parameters
sThe server record
nameWatchdog name.
poolThe pool used to create the watchdog.
int ap_hook_watchdog_need ( server_rec s,
const char *  name,
int  parent,
int  singleton 
)

Watchdog require hook.

Parameters
sThe server record
nameWatchdog name.
parentNon-zero to indicate the parent process watchdog mode.
singletonNon-zero to indicate the singleton watchdog mode.
Returns
OK to enable notifications from this watchdog, DECLINED otherwise.
Remarks
This is called in post config phase for all watchdog instances that have no callbacks registered. Modules using this hook should ensure that their post_config hook is called after watchdog post_config.
int ap_hook_watchdog_step ( server_rec s,
const char *  name,
apr_pool_t pool 
)

Fixed interval watchdog hook. It is called regularly on AP_WD_TM_INTERVAL interval.

Parameters
sThe server record
nameWatchdog name.
poolTemporary pool destroyed after the call.
apr_status_t ap_watchdog_get_instance ( ap_watchdog_t **  watchdog,
const char *  name,
int  parent,
int  singleton,
apr_pool_t p 
)

Get watchdog instance.

Parameters
watchdogStorage for watchdog instance.
nameWatchdog name.
parentNon-zero to get the parent process watchdog instance.
singletonNon-zero to get the singleton watchdog instance.
pThe pool to use.
Returns
APR_SUCCESS if all went well
Remarks
Use AP_WATCHDOG_DEFAULT to get default watchdog instance. If separate watchdog thread is needed provide unique name and function will create a new watchdog instance. Note that default client process watchdog works in singleton mode.
apr_status_t ap_watchdog_register_callback ( ap_watchdog_t watchdog,
apr_interval_time_t  interval,
const void data,
ap_watchdog_callback_fn_t callback 
)

Register watchdog callback.

Parameters
watchdogWatchdog to use
intervalInterval on which the callback function will execute.
callbackThe function to call on watchdog event.
dataThe data to pass to the callback function.
Returns
APR_SUCCESS if all went well. APR_EEXIST if already registered.
apr_status_t ap_watchdog_set_callback_interval ( ap_watchdog_t w,
apr_interval_time_t  interval,
const void data,
ap_watchdog_callback_fn_t callback 
)

Update registered watchdog callback interval.

Parameters
wWatchdog to use
intervalNew interval on which the callback function will execute.
callbackThe function to call on watchdog event.
dataThe data to pass to the callback function.
Returns
APR_SUCCESS if all went well. APR_EOF if callback was not found.