Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

event_init.c File Reference


Detailed Description

For internal use only.

This file contains the implementation of the event_init() function, used to initialize the event library.

Definition in file event_init.c.

#include "engines_int.h"
#include <ltdl.h>
#include <stdio.h>
#include <string.h>

Include dependency graph for event_init.c:

Go to the source code of this file.

Defines

#define FNAME_BUF
 File name buffer length.
#define MODULE_INIT
 Module initialization function name.
#define MODULE_ENGINE
 Module engine variable name.
#define VAR_MODULES
 Module configuration subtree name.
#define VAR_LIBPATH
 Library path configuration variable name.
#define VAR_MODLIST
 Module list configuration variable name.
#define confdir(fname)
 Construct system configuration file name.
#define homedir(fname)
 Construct home directory configuration file name.

Functions

static int new_modvar (treeconf_ctx_t *ctx, treeconf_node_t *parent, treeconf_str_t *name, int elements)
 Module nochange callback.
static ev_err_t engine_load (ev_ctx_t *ctx, treeconf_str_t *path, int path_cnt, treeconf_str_t *module, ev_flags_t *flag_p)
 Module search and load routine.
ev_err_t event_init (ev_ctx_t *ctx, const ev_attr_t *attr, ev_flags_t flags, const char *prog, const char *envpath)
 Initialize events library.

Variables

static _ev_attr_t const _ev__defattr
 Default library attributes.
const _ev_attr_t const * _ev_defattr
 Default library attributes.


Define Documentation

#define confdir fname   ) 
 

For internal use only.

This helper macro constructs the absolute pathname to a configuration file located in the system-wide configuration directory.

Parameters:
[in] fname The base name of the configuration file, minus any extension.
Returns:
A string containing the configuration file path.

Definition at line 94 of file event_init.c.

#define FNAME_BUF
 

For internal use only.

This macro specifies the size of a buffer to contain file names.

Definition at line 40 of file event_init.c.

Referenced by engine_load().

#define homedir fname   ) 
 

For internal use only.

This helper macro constructs the pathname to a configuration file located in the user's home directory.

Parameters:
[in] fname The base name of the configuration file, minus any extension.
Returns:
A string containing the configuration file path.

Definition at line 107 of file event_init.c.

#define MODULE_ENGINE
 

For internal use only.

This macro simply contains the name of the engine variable searched for by engine_load() if MODULE_INIT is not found.

Definition at line 56 of file event_init.c.

Referenced by engine_load().

#define MODULE_INIT
 

For internal use only.

This macro simply contains the name of the module initialization function searched for by engine_load().

Definition at line 48 of file event_init.c.

Referenced by engine_load().

#define VAR_LIBPATH
 

For internal use only.

This macro simply contains the name of the library search path configuration variable.

Definition at line 72 of file event_init.c.

Referenced by event_init().

#define VAR_MODLIST
 

For internal use only.

This macro simply contains the name of the module list configuration variable.

Definition at line 80 of file event_init.c.

Referenced by event_init().

#define VAR_MODULES
 

For internal use only.

This macro simply contains the name of the modules configuration subtree.

Definition at line 64 of file event_init.c.

Referenced by event_init().


Function Documentation

static ev_err_t engine_load ev_ctx_t ctx,
treeconf_str_t path,
int  path_cnt,
treeconf_str_t module,
ev_flags_t flag_p
[static]
 

For internal use only.

The purpose of this function is to search a path for a given module. It will attempt to register the module, either by calling a module init function named engine_mod_init(), if present, or by passing engine_module to engine_register(), if that variable is present and valid. After registering the engine, it will attempt to initialize the engine. If any of these attempts fails, engine_load() will lt_dlclose() the module (if any) and return to the caller.

Parameters:
[in] ctx A pointer to the ev_ctx_t being initialized.
[in] path The path to search for engine modules, represented as a treeconf_str_t array.
[in] path_cnt The number of elements in the path array.
[in] module The name of a module to load, optionally followed by a colon and a set of control flags.
[in,out] flag_p A pointer to the initialization flags.
Returns:
Zero on success, non-zero if an assertion failure occurs.

Definition at line 189 of file event_init.c.

References _ev_debug(), _gca_func, _ev_ctx_s::ec_engine, _ev_englink_s::el_next, _ev_englink_s::el_prev, _ev_engine_s::eng_flags, _ev_engine_s::eng_handle, eng_init, _ev_engine_s::eng_list, _ev_engine_s::eng_name, _ev_engine_s::eng_runfl, engine_register(), ev_assert, EV_ENGINE_COMPMASK, EV_ENGINE_REGISTERED, EV_ENGINE_RUNNING, EV_ENGINE_SIGNAL, EV_ENGINE_SOCKET, EV_ENGINE_TIMER, ev_return, ev_trace, EVAS_LOG, FNAME_BUF, MODULE_ENGINE, MODULE_INIT, ts_length, and ts_string.

Referenced by event_init().

Here is the call graph for this function:

static int new_modvar treeconf_ctx_t ctx,
treeconf_node_t parent,
treeconf_str_t name,
int  elements
[static]
 

For internal use only.

This function is a treeconf callback function, used for approving implicit creation of treeconf variables under the event.modules hierarchy.

Parameters:
[in] ctx A pointer to a treeconf_ctx_t.
[in] parent A pointer to the closest treeconf_node_t for the node.
[in] name A treeconf_str_t containing the remaining name elements.
[in] elements An int containing the number of remaining name elements.
Returns:
Boolean true if the node is to be created, or Boolean false otherwise.

Definition at line 152 of file event_init.c.

References TC_NODETYPE_IMPLICIT, and tn_type.

Referenced by event_init().


Variable Documentation

_ev_attr_t const _ev__defattr [static]
 

For internal use only.

This variable contains the default set of attributes for the event library.

Definition at line 115 of file event_init.c.

const _ev_attr_t const* _ev_defattr
 

For internal use only.

This variable contains a pointer to the default attribute set. It is primarily useful for event_init() and event_attr_init().

Definition at line 130 of file event_init.c.

Referenced by event_attr_init(), and main().


Generated on Wed Dec 28 23:37:18 2005 for event by  doxygen 1.4.4