For internal use only.
This file contains the structures, #define's, and function declarations used internally by the library.
Definition in file event_int.h.
#include "config.h"
#include "_stdint.h"
#include "event_err.h"
#include "event_version.h"
#include "gcc-attrs.h"
#include "event.h"
#include "sock.h"
#include "sig.h"
#include "tim.h"
#include <stdlib.h>
#include <sys/types.h>
#include <treeconf/treeconf.h>
Include dependency graph for event_int.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | _ev_varlist_s |
Event attributes application variable structure. More... | |
struct | _ev_overvars_s |
Event attributes overridden variable list. More... | |
struct | _ev_attr_s |
Event attributes structure. More... | |
struct | _ev_genlist_s |
Event generator list structure. More... | |
struct | _ev_gendesc_s |
Event generator descriptor structure. More... | |
struct | _ev_gens_s |
Event generators structure. More... | |
Defines | |
#define | __EVENT_LIBRARY__ |
Library sentinel. | |
#define | __builtin_expect(expr, expect) |
GCC optimization hint. | |
#define | _gca_format(archetype, index, first) |
Format attribute. | |
#define | _gca_func |
Function name. | |
#define | _gca_have_func |
Have function name. | |
#define | RCSTAG(tag) |
Embed RCS revision information. | |
#define | EV_CTX_LTDLINIT |
LTDL library initialization flag. | |
#define | EV_ATTR_MAGIC |
Event attributes magic number. | |
#define | _ea(attr, field) |
Event attributes helper macro. | |
#define | ea_verify(attr) |
Event attributes verification macro. | |
#define | ea_confpath(attr) |
Event attributes configuration path. | |
#define | ea_libpath(attr) |
Event attributes library path. | |
#define | ea_modlist(attr) |
Event attributes module list. | |
#define | ea_varlist(attr) |
Event attributes variable list. | |
#define | ea_ovars(attr) |
Event attributes overridden variables. | |
#define | ea_engines(attr) |
Event attributes engines. | |
#define | EVAS_LOG |
Library logging enabled. | |
#define | EVAS_ABORT |
Library aborts enabled. | |
#define | EVAS_LOOP |
Library assertion loop flag. | |
#define | EVAS_TRACE |
Library function call tracing. | |
#define | ev_log(flag, msg) |
Library logging macro. | |
#define | ev_abort() |
Library abort macro. | |
#define | ev_assert(expr) |
Library assertion macro. | |
#define | ev_trace() |
Function entry trace macro. | |
#define | ev_init() |
Function initialization macro. | |
#define | ev_return(val) |
Function return macro. | |
#define | ev_gen_init(ctx, gen, gd) |
Initialize a generator header. | |
#define | tv_comp(tv1, tv2) |
Compare struct timeval values. | |
#define | tt_node_fix(tim) |
Repair timer node linking. | |
#define | tt_node_init(tim, parent, prev) |
Initialize a timer node. | |
#define | ti_expire_comp(tim) |
Compute timer's expiration time. | |
#define | so_uevents_set(sock, flags) |
Set user socket event flags. | |
#define | so_uevents_clr(sock, flags) |
Clear user socket event flags. | |
#define | so_blocked_set(sock, flags) |
Set socket blocked flags. | |
#define | so_blocked_clr(sock, flags) |
Clear socket blocked flags. | |
#define | so_closed_set(sock, flags) |
Set socket closed flags. | |
#define | so_closed_clr(sock, flags) |
Clear socket closed flags. | |
Typedefs | |
typedef _ev_varlist_s | ev_varlist_t |
Event attributes application variable list. | |
typedef _ev_overvars_s | ev_overvars_t |
Event attributes overridden variable list. | |
typedef _ev_attr_s | _ev_attr_t |
Event attributes structure type. | |
typedef _ev_genlist_s | ev_genlist_t |
Event generator list. | |
typedef _ev_gendesc_s | ev_gendesc_t |
Event generator descriptor. | |
typedef _ev_gens_s | ev_gens_t |
Event generators. | |
Functions | |
void | _ev_debug (ev_flags_t flags, const char *file, int line, const char *func, const char *fmt,...) |
Log debugging messages. | |
ev_err_t | _ev_gen_lookup (ev_ctx_t *ctx, unsigned int gentype, ev_gendesc_t **gen) |
Look up an ev_gendesc_t for a given generator. | |
ev_err_t | _timer_insert (ev_ctx_t *ctx, ev_tim_t *tim) |
Insert a timer into the timer tree. | |
ev_err_t | _timer_heapify_up (ev_ctx_t *ctx, ev_tim_t *tim) |
Restore timer tree heap property by shifting up. | |
ev_err_t | _timer_heapify_down (ev_ctx_t *ctx, ev_tim_t *tim) |
Restore timer tree heap property by shifting down. | |
ev_err_t | _timer_untree (ev_ctx_t *ctx, ev_tim_t *tim) |
Remove a timer from the timer tree. | |
Variables | |
const _ev_attr_t const * | _ev_defattr |
Default library attributes. | |
ev_flags_t | _ev_asflags |
Library logging flags. | |
ev_log_t | _ev_debuglog |
Library logging function callback. |
|
For internal use only. GCC has a built-in that hints to the compiler that a given expression is expected to have a certain value. GCC may then be able to perform some optimizations. This macro is only defined if the compiler is *not* GCC, and simplifies the expression for the benefit of such foreign compilers.
Definition at line 70 of file event_int.h. |
|
For internal use only. This macro signals to the public header files that they are being used by the library itself. This is mostly used to control inclusions. Definition at line 38 of file event_int.h. |
|
For internal use only.
The event attributes structure is rather complicated to access. This macro helps simplify access to particular fields. The
Definition at line 263 of file event_int.h. |
|
For internal use only.
This attribute is used to inform GCC that a function uses a printf-style format string, allowing GCC to check the function's arguments against the format string. For more information, see the GCC documentation for the
Definition at line 97 of file event_int.h. |
|
For internal use only. This macro simply expands to whatever magic symbol will obtain the current function name. If this is not possible with the current compiler, it will be NULL. Definition at line 124 of file event_int.h. Referenced by engine_load(), event_destroy(), and main(). |
|
For internal use only. This macro is defined to 1 if it is possible to retrieve the function name from the current compiler. Definition at line 125 of file event_int.h. |
|
For internal use only. This macro is used to retrieve the configuration path from an event attributes object.
Definition at line 294 of file event_int.h. Referenced by event_attr_confpath(), event_init(), and main(). |
|
For internal use only. This macro is used to register application-provided engines with the attributes object.
Definition at line 369 of file event_int.h. Referenced by event_attr_engine(), and event_init(). |
|
For internal use only. This macro is used to retrieve the library search path from an event attributes object.
Definition at line 309 of file event_int.h. Referenced by event_attr_libpath(), event_init(), and main(). |
|
For internal use only. This macro is used to retrieve the module list from an event attributes object.
Definition at line 324 of file event_int.h. Referenced by event_attr_modlist(), event_init(), and main(). |
|
For internal use only. This macro is used to retrieve the list of application-overridden variables from an event attributes object.
Definition at line 354 of file event_int.h. Referenced by event_attr_confvar(), event_attr_destroy(), event_init(), and main(). |
|
For internal use only. This macro is used to retrieve the list of application-registered variables from an event atttributes object.
Definition at line 339 of file event_int.h. Referenced by event_attr_confreg(), event_attr_destroy(), event_init(), and main(). |
|
For internal use only.
This macro verifies that
Definition at line 278 of file event_int.h. Referenced by event_attr_confpath(), event_attr_confreg(), event_attr_confvar(), event_attr_destroy(), event_attr_engine(), event_attr_libpath(), event_attr_modlist(), event_init(), and main(). |
|
For internal use only. Libraries really shouldn't abort, so a library assert() macro should just return some kind of error--in this case, EV_ERR_ASSERT. But if the application permits, we may be permitted to go ahead and abort(), in which case we should, just to stop the application in its tracks.
Definition at line 502 of file event_int.h. Referenced by _ev_abort(). |
|
For internal use only. It is possible that there will be some catastrophic library assertion failure. Normally, libraries should not call the assert() macro, as it's rather bad manners to abort in a library, and the application may need to do some critical clean-up. Nevertheless, assertions are very useful debugging tools. Therefore, we provide our own assert() macro, using ev_abort() to either call abort() (if permitted) or to just return the failure code EV_ERR_ASSERT. This macro may also optionally log a message, if the application has provided a logging function and permits logging to be done.
Definition at line 528 of file event_int.h. Referenced by _ev_assert(), _timer_insert(), _timer_untree(), engine_load(), event_destroy(), event_gen_alloc(), event_gen_register(), gens_extend(), gens_merge(), node_swap(), and sockaddr_import(). |
|
For internal use only. This is the magic number used for the event attributes structure. Definition at line 246 of file event_int.h. |
|
For internal use only. This flag, if set, indicates that the LTDL library has been initialized with a call to lt_dlinit(). It is only used by event_destroy() to signal that it must call lt_dlexit(). Definition at line 144 of file event_int.h. Referenced by event_destroy(), and event_init(). |
|
For internal use only. This macro is used to initialize a generator header given a descriptor for the generator.
Definition at line 602 of file event_int.h. Referenced by event_gen_alloc(). |
|
For internal use only. There are a couple of tasks every library function needs to begin with. This macro simply performs all the initialization tasks: making certain the error table has been registered and making certain a library assertion hasn't been raised. The application may also turn on function tracing, which will cause a log message indicating function entry to be written to the application-provided logging function (assuming one is defined). (Even if _gca_func cannot be provided, the file and line number information can help determine which function it was, particularly given that most functions are in files by themselves.)
Definition at line 566 of file event_int.h. Referenced by _ev_gen_lookup(), _ev_init(), engine_activate(), engine_register(), event_attr_confpath(), event_attr_confreg(), event_attr_confvar(), event_attr_destroy(), event_attr_engine(), event_attr_init(), event_attr_libpath(), event_attr_modlist(), event_destroy(), event_gen_alloc(), event_gen_register(), event_gen_release(), event_init(), event_log_abort(), event_log_debug(), event_log_reset(), event_log_set(), event_log_trace(), sa_ipaddrbuf_set(), sa_ipaddrport_set(), sa_localaddr_set(), sa_type_set(), signal_create(), signal_destroy(), sockaddr_atop(), sockaddr_export(), sockaddr_import(), sockaddr_ptoa(), timer_create(), timer_destroy(), and timer_resched(). |
|
For internal use only. Some debugging data may be desired; this macro just helps with logging that data.
Definition at line 485 of file event_int.h. Referenced by _ev_log(). |
|
|
For internal use only. This macro is used to log function entry. It is separate from ev_init() so that it can be used by internal functions that don't need to call ev_init().
Definition at line 548 of file event_int.h. Referenced by _timer_heapify_down(), _timer_heapify_up(), _timer_insert(), _timer_untree(), atop_v4(), atop_v6(), engine_load(), gens_construct(), gens_extend(), gens_merge(), and node_swap(). |
|
For internal use only. If this flag is set in _ev_asflags, ev_abort() will call the system abort() function, terminating program execution. Definition at line 442 of file event_int.h. Referenced by event_log_abort(), and main(). |
|
For internal use only.
If this flag is set in _ev_asflags, library logging is enabled (assuming _ev_debuglog is non- Definition at line 434 of file event_int.h. Referenced by engine_load(), event_destroy(), event_log_debug(), event_log_reset(), event_log_set(), and main(). |
|
For internal use only. If this flag is set in _ev_asflags, then an ev_assert() has failed. Although program execution is not stopped, the library may not be called again after an assertion failure; the program should clean up and exit. Definition at line 452 of file event_int.h. Referenced by main(). |
|
For internal use only. If this flag is set in _ev_asflags, then function tracing is enabled. All function entries will result in a log message. Definition at line 460 of file event_int.h. Referenced by event_log_reset(), event_log_trace(), and main(). |
|
For internal use only.
Embeds the Definition at line 135 of file event_int.h. |
|
For internal use only. This macro is used to clear the blocked flags on a socket.
Definition at line 752 of file event_int.h. |
|
For internal use only. This macro is used to set the blocked flags on a socket.
Definition at line 740 of file event_int.h. |
|
For internal use only. This macro is used to clear the closed flags on a socket. This macro is prvided solely for completeness; the closed flags should probably never be cleared.
Definition at line 778 of file event_int.h. |
|
For internal use only. This macro is used to set the closed flags on a socket.
Definition at line 764 of file event_int.h. |
|
For internal use only. This macro is used to clear the user event flags on a socket.
Definition at line 728 of file event_int.h. |
|
For internal use only. This macro is used to set the user event flags on a socket.
Definition at line 716 of file event_int.h. |
|
For internal use only. This macro is used to compute and set the expiration time for the given timer.
Definition at line 694 of file event_int.h. Referenced by timer_create(), and timer_resched(). |
|
For internal use only. This macro is used to repair the links to a given timer node.
Definition at line 648 of file event_int.h. Referenced by _timer_untree(), and node_swap(). |
|
For internal use only. This macro is used to initialize the timer node structure within a timer descriptor.
Definition at line 673 of file event_int.h. Referenced by _timer_insert(), and _timer_untree(). |
|
For internal use only.
This macro returns a 0 value if the two struct timeval values are equivalent; otherwise, it returns a positive value if
Definition at line 637 of file event_int.h. Referenced by _timer_heapify_down(), _timer_heapify_up(), _timer_untree(), and timer_resched(). |
|
For internal use only. This type is a helper type for declaring an attribute set. The ev_attr_t type, declared in event.h, is a pointer to this type, and should be treated by the user as an opaque object. Definition at line 169 of file event_int.h. |
|
For internal use only. This type is a helper type for describing a specific type of generator. It contains two lists of the described generator--a list of active generators and a free list. Definition at line 187 of file event_int.h. |
|
For internal use only. This type is a helper type for keeping a list of generators. It is used for keeping track of a free list, as well as for keeping a list of active generators. Definition at line 178 of file event_int.h. |
|
For internal use only. This type is a helper type for describing a number of generators (with sequential generator types; see ev_gentype_t). It is part of linked list rooted in an ev_ctx_t; each element in the linked list describes one or more generators. Definition at line 197 of file event_int.h. |
|
For internal use only. This type represents one of a list of application-overridden variables. Definition at line 160 of file event_int.h. |
|
For internal use only. This type represents one of a list of application-registered variables. Definition at line 152 of file event_int.h. |
|
For internal use only. This function is used when the ev_log() macro is insufficient. It will call snprintf() to format a log message, then call the user logging function to log the message.
Definition at line 134 of file event_log.c. References _ev_asflags, _ev_debuglog, and DEBUG_BUF. Referenced by engine_load(), event_destroy(), and main(). |
|
For internal use only.
This function looks up the ev_gendesc_t describing the generator
Definition at line 33 of file _ev_gen_lookup.c. References _ev_ctx_s::ec_gens, _ev_ctx_s::ec_maxgen, ev_init, ev_return, _ev_gens_s::gs_count, _ev_gens_s::gs_first, _ev_gens_s::gs_gens, and _ev_gens_s::gs_next. Referenced by event_gen_alloc(), event_gen_release(), and main(). |
|
For internal use only. This function restores the heap property of the timer tree by shifting the given node down within the tree.
Definition at line 121 of file _timer_heapify.c. References ev_return, ev_trace, node_swap(), _ev_tim_s::ti_expire, _ev_tim_s::ti_node, _ev_timnode_s::tn_left, _ev_timnode_s::tn_right, and tv_comp. Referenced by _timer_untree(), and timer_resched(). Here is the call graph for this function: ![]() |
|
For internal use only. This function restores the heap property of the timer tree by shifting the given node up within the tree.
Definition at line 105 of file _timer_heapify.c. References ev_return, ev_trace, node_swap(), _ev_tim_s::ti_expire, _ev_tim_s::ti_node, _ev_timnode_s::tn_parent, and tv_comp. Referenced by _timer_insert(), _timer_untree(), and timer_resched(). Here is the call graph for this function: ![]() |
|
For internal use only. This function inserts the given timer into the timer tree, maintaining the heap property of the tree.
Definition at line 34 of file timer_create.c. References _timer_heapify_up(), _ev_ctx_s::ec_timtree, ev_assert, ev_return, ev_trace, timer_destroy(), and tt_node_init. Referenced by timer_create(), and timer_resched(). Here is the call graph for this function: ![]() |
|
For internal use only. This function removes the specified timer from the timer tree, restoring the tree's heap property in the process.
Definition at line 32 of file timer_destroy.c. References _timer_heapify_down(), _timer_heapify_up(), _ev_ctx_s::ec_timtree, ev_assert, ev_return, ev_trace, _ev_tim_s::ti_expire, _ev_tim_s::ti_node, _ev_timnode_s::tn_left, _ev_timnode_s::tn_next, _ev_timnode_s::tn_parent, _ev_timnode_s::tn_prev, _ev_timnode_s::tn_right, tt_node_fix, tt_node_init, and tv_comp. Referenced by timer_destroy(), and timer_resched(). Here is the call graph for this function: ![]() |
|
For internal use only. This variable contains a set of flags controlling the logging and assertion behavior of the library. The available flags are EVAS_LOG, EVAS_ABORT, EVAS_LOOP, and EVAS_TRACE. This variable should only be manipulated by means of the event_log_debug(), event_log_trace(), and event_log_abort() functions. Definition at line 41 of file event_log.c. Referenced by _ev_debug(), event_log_abort(), event_log_debug(), event_log_reset(), event_log_set(), event_log_trace(), and main(). |
|
For internal use only. This variable contains a pointer to the function to be used for logging. See the documentation for the ev_log_t type for more information. It should only be manipulated by means of event_log_set() and event_log_reset(). Definition at line 64 of file event_log.c. Referenced by _ev_debug(), event_log_reset(), event_log_set(), and main(). |
|
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(). |