The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Enumerations | Functions | Variables
event.c File Reference

Wrapper around libkqueue to make managing events easier. More...

#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/lst.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/rb.h>
#include <freeradius-devel/util/strerror.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/table.h>
#include <freeradius-devel/util/token.h>
#include <freeradius-devel/util/atexit.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <pthread.h>
+ Include dependency graph for event.c:

Go to the source code of this file.

Data Structures

struct  fr_event_fd
 A file descriptor/filter event. More...
 
struct  fr_event_func_map_entry_t
 Specifies a mapping between a function pointer in a structure and its respective event. More...
 
struct  fr_event_func_map_t
 
struct  fr_event_list
 Stores all information relating to an event list. More...
 
struct  fr_event_pid
 
struct  fr_event_pid.early_exit
 Fields that are only used if we're being triggered by a user event. More...
 
struct  fr_event_pid_reap_t
 Hold additional information for automatically reaped PIDs. More...
 
struct  fr_event_post_t
 Callbacks to perform after all timers and FDs have been checked. More...
 
struct  fr_event_pre_t
 Callbacks to perform when the event handler is about to check the events. More...
 
struct  fr_event_timer
 A timer event. More...
 
struct  fr_event_user_s
 Callbacks for kevent() user events. More...
 

Macros

#define EVENT_DEBUG(...)
 
#define FR_EV_BATCH_FDS   (256)
 
#define FR_EVENT_FD_PCAP   0
 
#define fr_time()   static_assert(0, "Use el->time for event loop timing")
 
#define GET_FUNC(_ef, _offset)   *((fr_event_fd_cb_t const *)((uint8_t const *)&(_ef)->active + _offset))
 
#define NOTE_EXITSTATUS   (0)
 

Enumerations

enum  fr_event_fd_type_t {
  FR_EVENT_FD_SOCKET = 1 ,
  FR_EVENT_FD_FILE = 2 ,
  FR_EVENT_FD_DIRECTORY = 4
}
 
enum  fr_event_func_idx_type_t {
  FR_EVENT_FUNC_IDX_NONE = 0 ,
  FR_EVENT_FUNC_IDX_FILTER ,
  FR_EVENT_FUNC_IDX_FFLAGS
}
 

Functions

static int _event_build_indexes (UNUSED void *uctx)
 
static int _event_fd_delete (fr_event_fd_t *ef)
 Remove a file descriptor from the event loop and rbtree but don't explicitly free it. More...
 
static int _event_free_indexes (UNUSED void *uctx)
 Free any memory we allocated for indexes. More...
 
static int _event_list_free (fr_event_list_t *el)
 Cleanup an event list. More...
 
static int _event_pid_free (fr_event_pid_t *ev)
 Remove PID wait event from kevent if the fr_event_pid_t is freed. More...
 
static int _event_timer_free (fr_event_timer_t *ev)
 Remove an event from the event loop. More...
 
static int _event_user_delete (fr_event_user_t *ev)
 Memory will not be freed if we fail to remove the event from the kqueue. More...
 
int _fr_event_fd_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_fd_t **ef_out, fr_event_list_t *el, int fd, fr_event_fd_cb_t read_fn, fr_event_fd_cb_t write_fn, fr_event_error_cb_t error, void *uctx)
 Associate I/O callbacks with a file descriptor. More...
 
int _fr_event_fd_move (NDEBUG_LOCATION_ARGS fr_event_list_t *dst, fr_event_list_t *src, int fd, fr_event_filter_t filter)
 Move a file descriptor event from one event list to another. More...
 
int _fr_event_filter_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_fd_t **ef_out, fr_event_list_t *el, int fd, fr_event_filter_t filter, void *funcs, fr_event_error_cb_t error, void *uctx)
 Insert a filter for the specified fd. More...
 
int _fr_event_filter_update (NDEBUG_LOCATION_ARGS fr_event_list_t *el, int fd, fr_event_filter_t filter, fr_event_update_t const updates[])
 Suspend/resume a subset of filters. More...
 
static void _fr_event_pid_early_exit (fr_event_list_t *el, void *uctx)
 Called on the next loop through the event loop when inserting an EVFILT_PROC event fails. More...
 
int _fr_event_pid_reap (NDEBUG_LOCATION_ARGS fr_event_list_t *el, pid_t pid, fr_event_pid_cb_t callback, void *uctx)
 Asynchronously wait for a PID to exit, then reap it. More...
 
static void _fr_event_pid_reap_cb (UNUSED fr_event_list_t *el, pid_t pid, int status, void *uctx)
 Does the actual reaping of PIDs. More...
 
int _fr_event_pid_wait (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_pid_t const **ev_p, pid_t pid, fr_event_pid_cb_t callback, void *uctx)
 Insert a PID event into an event list. More...
 
static int _fr_event_reap_free (fr_event_pid_reap_t *reap)
 
int _fr_event_timer_at (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_timer_t const **ev_p, fr_time_t when, fr_event_timer_cb_t callback, void const *uctx)
 Insert a timer event into an event list. More...
 
int _fr_event_timer_in (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_timer_t const **ev_p, fr_time_delta_t delta, fr_event_timer_cb_t callback, void const *uctx)
 Insert a timer event into an event list. More...
 
int _fr_event_user_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_user_t **ev_p, bool trigger, fr_event_user_cb_t callback, void *uctx)
 Add a user callback to the event list. More...
 
static void event_callback (fr_event_list_t *el, fr_event_fd_t *ef, int *filter, int flags, int *fflags)
 
 EVENT_DEBUG ("%s - Reaper forcefully reaping PID %u - %p", __FUNCTION__, reap->pid_ev->pid, reap)
 
static fr_event_fd_cb_t event_fd_func (fr_event_fd_t *ef, int *filter, int *fflags)
 Figure out which function to call given a kevent. More...
 
static void event_fd_func_index_build (fr_event_func_map_t *map)
 
static void event_list_reap_run_callback (fr_event_pid_reap_t *reap, pid_t pid, int status)
 Saves some boilerplate... More...
 
 event_list_reap_run_callback (reap, reap->pid_ev->pid, status)
 
static void event_pid_eval (fr_event_list_t *el, struct kevent *kev)
 Evaluate a EVFILT_PROC event. More...
 
static void event_user_eval (fr_event_list_t *el, struct kevent *kev)
 
static ssize_t fr_event_build_evset (UNUSED fr_event_list_t *el, struct kevent out_kev[], size_t outlen, fr_event_funcs_t *active, fr_event_fd_t *ef, fr_event_funcs_t const *new, fr_event_funcs_t const *prev)
 Build a new evset based on function pointers present. More...
 
int fr_event_corral (fr_event_list_t *el, fr_time_t now, bool wait)
 Gather outstanding timer and file descriptor events. More...
 
int fr_event_fd_armour (fr_event_list_t *el, int fd, fr_event_filter_t filter, uintptr_t armour)
 Armour an FD. More...
 
fr_event_fd_cb_t fr_event_fd_cb (fr_event_fd_t *ef, int kq_filter, int kq_fflags)
 Returns the appropriate callback function for a given event. More...
 
static int8_t fr_event_fd_cmp (void const *one, void const *two)
 Compare two file descriptor handles. More...
 
int fr_event_fd_delete (fr_event_list_t *el, int fd, fr_event_filter_t filter)
 Remove a file descriptor from the event loop. More...
 
fr_event_fd_tfr_event_fd_handle (fr_event_list_t *el, int fd, fr_event_filter_t filter)
 Get the opaque event handle from a file descriptor. More...
 
static void fr_event_fd_noop (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, UNUSED void *uctx)
 Placeholder callback to avoid branches in service loop. More...
 
static int fr_event_fd_type_set (fr_event_fd_t *ef, int fd)
 Discover the type of a file descriptor. More...
 
void * fr_event_fd_uctx (fr_event_fd_t *ef)
 Returns the uctx associated with an fr_event_fd_t handle. More...
 
int fr_event_fd_unarmour (fr_event_list_t *el, int fd, fr_event_filter_t filter, uintptr_t armour)
 Unarmour an FD. More...
 
fr_event_list_tfr_event_list_alloc (TALLOC_CTX *ctx, fr_event_status_cb_t status, void *status_uctx)
 Initialise a new event list. More...
 
bool fr_event_list_empty (fr_event_list_t *el)
 Return whether the event loop has any active events. More...
 
int fr_event_list_kq (fr_event_list_t *el)
 Return the kq associated with an event list. More...
 
uint64_t fr_event_list_num_fds (fr_event_list_t *el)
 Return the number of file descriptors is_registered with this event loop. More...
 
uint64_t fr_event_list_num_timers (fr_event_list_t *el)
 Return the number of timer events currently scheduled. More...
 
unsigned int fr_event_list_reap_signal (fr_event_list_t *el, fr_time_delta_t timeout, int signal)
 Send a signal to all the processes we have in our reap list, and reap them. More...
 
void fr_event_list_set_time_func (fr_event_list_t *el, fr_event_time_source_t func)
 Override event list time source. More...
 
fr_time_t fr_event_list_time (fr_event_list_t *el)
 Get the current server time according to the event list. More...
 
int fr_event_loop (fr_event_list_t *el)
 Run an event loop. More...
 
void fr_event_loop_exit (fr_event_list_t *el, int code)
 Signal an event loop exit with the specified code. More...
 
bool fr_event_loop_exiting (fr_event_list_t *el)
 Check to see whether the event loop is in the process of exiting. More...
 
int fr_event_post_delete (fr_event_list_t *el, fr_event_timer_cb_t callback, void *uctx)
 Delete a post-event callback from the event list. More...
 
int fr_event_post_insert (fr_event_list_t *el, fr_event_timer_cb_t callback, void *uctx)
 Add a post-event callback to the event list. More...
 
int fr_event_pre_delete (fr_event_list_t *el, fr_event_status_cb_t callback, void *uctx)
 Delete a pre-event callback from the event list. More...
 
int fr_event_pre_insert (fr_event_list_t *el, fr_event_status_cb_t callback, void *uctx)
 Add a pre-event callback to the event list. More...
 
void fr_event_service (fr_event_list_t *el)
 Service any outstanding timer or file descriptor events. More...
 
static int8_t fr_event_timer_cmp (void const *a, void const *b)
 Compare two timer events to see which one should occur first. More...
 
int fr_event_timer_delete (fr_event_timer_t const **ev_p)
 Delete a timer event from the event list. More...
 
int fr_event_timer_run (fr_event_list_t *el, fr_time_t *when)
 Run a single scheduled timer event. More...
 
fr_time_t fr_event_timer_when (fr_event_timer_t const *ev)
 Internal timestamp representing when the timer should fire. More...
 
int fr_event_user_trigger (fr_event_list_t *el, fr_event_user_t *ev)
 Trigger a user event. More...
 
 if (kill(reap->pid_ev->pid, signal)< 0)
 
 talloc_free (reap)
 
 waitpid (reap->pid_ev->pid, &status, 0)
 

Variables

force __pad0__
 
static fr_event_func_map_t filter_maps []
 
static fr_table_num_sorted_t const fr_event_fd_type_table []
 
static size_t fr_event_fd_type_table_len = NUM_ELEMENTS(fr_event_fd_type_table)
 
static fr_table_num_sorted_t const kevent_filter_table []
 
static size_t kevent_filter_table_len = NUM_ELEMENTS(kevent_filter_table)
 
return processed
 

Detailed Description

Wrapper around libkqueue to make managing events easier.

Non-thread-safe event handling specific to FreeRADIUS.

By non-thread-safe we mean multiple threads can't insert/delete events concurrently into the same event list without synchronization.

Definition in file event.c.


Data Structure Documentation

◆ fr_event_fd

struct fr_event_fd

A file descriptor/filter event.

Definition at line 294 of file event.c.

+ Collaboration diagram for fr_event_fd:
Data Fields
fr_event_funcs_t active Active filter functions.
uintptr_t armour protection flag from being deleted.
fr_event_list_t * el Event list this event belongs to.
fr_dlist_t entry Entry in free list.
fr_event_error_cb_t error Callback for when an error occurs on the FD.
int fd File descriptor we're listening for events on.
char const * file Source file this event was last updated in.
fr_event_filter_t filter
bool is_registered Whether this fr_event_fd_t's FD has been registered with kevent.

Mostly for debugging.

int line Line this event was last updated on.
TALLOC_CTX * linked_ctx talloc ctx this event was bound to.
fr_event_func_map_t const * map Function map between fr_event_funcs_t and kevent filters.
fr_rb_node_t node Entry in the tree of file descriptor handles.

this should really go away and we should pass around handles directly.

int sock_type The type of socket SOCK_STREAM, SOCK_RAW etc...
fr_event_funcs_t stored Stored (set, but inactive) filter functions.
fr_event_fd_type_t type Type of events we're interested in.
void * uctx Context pointer to pass to each file descriptor callback.

◆ fr_event_func_map_entry_t

struct fr_event_func_map_entry_t

Specifies a mapping between a function pointer in a structure and its respective event.

If the function pointer at the specified offset is set, then a matching event will be added.

If the function pointer is NULL, then any existing events will be removed.

Definition at line 155 of file event.c.

Data Fields
bool coalesce Coalesce this map with the next.
uint32_t fflags fflags to pass to filter.
int16_t filter Filter to apply.
uint16_t flags Flags to use for inserting event.
char const * name Name of the event.
size_t offset Offset of function pointer in structure.
int type Type this filter applies to.

◆ fr_event_func_map_t

struct fr_event_func_map_t

Definition at line 165 of file event.c.

+ Collaboration diagram for fr_event_func_map_t:
Data Fields
fr_event_func_map_entry_t ** ev_to_func Function -> Event maps in index order.
fr_event_func_map_entry_t * func_to_ev Function -> Event maps coalesced, out of order.
fr_event_func_idx_type_t idx_type What type of index we use for event to function mapping.

◆ fr_event_list

struct fr_event_list

Stores all information relating to an event list.

Definition at line 411 of file event.c.

+ Collaboration diagram for fr_event_list:
Data Fields
bool dispatch Whether the event list is currently dispatching events.
fr_dlist_head_t ev_to_add dlist of events to add
struct kevent events[FR_EV_BATCH_FDS]
int exit If non-zero event loop will prevent the addition of new events, and will return immediately from the corral/service function.
fr_dlist_head_t fd_to_free File descriptor events pending deletion.
fr_rb_tree_t * fds Tree used to track FDs with filters in kqueue.
bool in_handler Deletes should be deferred until after the handlers complete.
int kq instance associated with this event list.
fr_time_t now The last time the event list was serviced.
int num_fd_events Number of events in this event list.
fr_dlist_head_t pid_to_reap A list of all orphaned child processes we're waiting to reap.
fr_dlist_head_t post_callbacks post-processing callbacks
fr_dlist_head_t pre_callbacks callbacks when we may be idle...
fr_event_time_source_t time Where our time comes from.
fr_lst_t * times of timer events to be executed.
int will_exit Will exit on next call to fr_event_corral.

◆ fr_event_pid

struct fr_event_pid

Definition at line 332 of file event.c.

+ Collaboration diagram for fr_event_pid:
Data Fields
fr_event_pid_cb_t callback callback to run when the child exits
struct fr_event_pid early_exit Fields that are only used if we're being triggered by a user event.
fr_event_list_t * el Event list this event belongs to.
char const * file Source file this event was last updated in.
bool is_registered Whether this user event has been registered with the event loop.
int line Line this event was last updated on.
fr_event_pid_t const ** parent
pid_t pid child to wait for
void * uctx Context pointer to pass to each file descriptor callback.

◆ fr_event_pid.early_exit

struct fr_event_pid.early_exit

Fields that are only used if we're being triggered by a user event.

Definition at line 346 of file event.c.

Data Fields
fr_event_user_t * ev Fallback user event we use to raise a PID event when a race occurs with kevent.
int status Status we got from waitid.

◆ fr_event_pid_reap_t

struct fr_event_pid_reap_t

Hold additional information for automatically reaped PIDs.

Definition at line 359 of file event.c.

+ Collaboration diagram for fr_event_pid_reap_t:
Data Fields
fr_event_pid_cb_t callback callback to run when the child exits
fr_event_list_t * el Event list this event belongs to.
fr_dlist_t entry If the fr_event_pid is in the detached, reap state, it's inserted into a list associated with the event.

We then send SIGKILL, and forcefully reap the process on exit.

fr_event_pid_t const * pid_ev pid_ev this reaper is bound to.
void * uctx Context pointer to pass to each file descriptor callback.

◆ fr_event_post_t

struct fr_event_post_t

Callbacks to perform after all timers and FDs have been checked.

Definition at line 402 of file event.c.

+ Collaboration diagram for fr_event_post_t:
Data Fields
fr_event_timer_cb_t callback The callback to call.
fr_dlist_t entry Linked list of callback.
void * uctx Context for the callback.

◆ fr_event_pre_t

struct fr_event_pre_t

Callbacks to perform when the event handler is about to check the events.

Definition at line 393 of file event.c.

+ Collaboration diagram for fr_event_pre_t:
Data Fields
fr_event_status_cb_t callback The callback to call.
fr_dlist_t entry Linked list of callback.
void * uctx Context for the callback.

◆ fr_event_timer

struct fr_event_timer

A timer event.

Definition at line 102 of file event.c.

+ Collaboration diagram for fr_event_timer:
Data Fields
fr_event_timer_cb_t callback Callback to execute when the timer fires.
fr_event_list_t * el Event list containing this timer.
fr_dlist_t entry List of deferred timer events.
char const * file Source file this event was last updated in.
int line Line this event was last updated on.
TALLOC_CTX * linked_ctx talloc ctx this event was bound to.
fr_lst_index_t lst_id Where to store opaque lst data.
fr_event_timer_t const ** parent A pointer to the parent structure containing the timer event.
void const * uctx Context pointer to pass to the callback.
fr_time_t when When this timer should fire.

◆ fr_event_user_s

struct fr_event_user_s

Callbacks for kevent() user events.

Definition at line 375 of file event.c.

+ Collaboration diagram for fr_event_user_s:
Data Fields
fr_event_user_cb_t callback The callback to call.
fr_event_list_t * el Event list this event belongs to.
char const * file Source file this event was last updated in.
bool is_registered Whether this user event has been registered with the event loop.
int line Line this event was last updated on.
void * uctx Context for the callback.

Macro Definition Documentation

◆ EVENT_DEBUG

#define EVENT_DEBUG (   ...)

Definition at line 73 of file event.c.

◆ FR_EV_BATCH_FDS

#define FR_EV_BATCH_FDS   (256)

Definition at line 57 of file event.c.

◆ FR_EVENT_FD_PCAP

#define FR_EVENT_FD_PCAP   0

Definition at line 145 of file event.c.

◆ fr_time

#define fr_time (   void)    static_assert(0, "Use el->time for event loop timing")

Definition at line 60 of file event.c.

◆ GET_FUNC

#define GET_FUNC (   _ef,
  _offset 
)    *((fr_event_fd_cb_t const *)((uint8_t const *)&(_ef)->active + _offset))

◆ NOTE_EXITSTATUS

#define NOTE_EXITSTATUS   (0)

Enumeration Type Documentation

◆ fr_event_fd_type_t

Enumerator
FR_EVENT_FD_SOCKET 

is a socket.

FR_EVENT_FD_FILE 

is a file.

FR_EVENT_FD_DIRECTORY 

is a directory.

Definition at line 124 of file event.c.

◆ fr_event_func_idx_type_t

Enumerator
FR_EVENT_FUNC_IDX_NONE 
FR_EVENT_FUNC_IDX_FILTER 

Sign flip is performed i.e. -1 = 0The filter is used / as the index in the ev to func index.

FR_EVENT_FUNC_IDX_FFLAGS 

The bit position of the flags in FFLAGS is used to provide the index.

i.e. 0x01 -> 0, 0x02 -> 1, 0x08 -> 3 etc..

Definition at line 134 of file event.c.

Function Documentation

◆ _event_build_indexes()

static int _event_build_indexes ( UNUSED void *  uctx)
static

Definition at line 2820 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _event_fd_delete()

static int _event_fd_delete ( fr_event_fd_t ef)
static

Remove a file descriptor from the event loop and rbtree but don't explicitly free it.

Parameters
[in]efto remove.
Returns
  • 0 on success.
  • -1 on error;

Definition at line 868 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _event_free_indexes()

static int _event_free_indexes ( UNUSED void *  uctx)
static

Free any memory we allocated for indexes.

Definition at line 2812 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _event_list_free()

static int _event_list_free ( fr_event_list_t el)
static

Cleanup an event list.

Frees/destroys any resources associated with an event list

Parameters
[in]elto free resources for.

Definition at line 2794 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _event_pid_free()

static int _event_pid_free ( fr_event_pid_t ev)
static

Remove PID wait event from kevent if the fr_event_pid_t is freed.

Parameters
[in]evto free.
Returns
0

Definition at line 1643 of file event.c.

+ Here is the caller graph for this function:

◆ _event_timer_free()

static int _event_timer_free ( fr_event_timer_t ev)
static

Remove an event from the event loop.

Parameters
[in]evto free.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1396 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _event_user_delete()

static int _event_user_delete ( fr_event_user_t ev)
static

Memory will not be freed if we fail to remove the event from the kqueue.

It's easier to debug memory leaks with modern tooling than it is to determine why we get random failures and event leaks inside of kqueue.

Returns
  • 0 on success.
  • -1 on failure.

Definition at line 2141 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_fd_insert()

int _fr_event_fd_insert ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_fd_t **  ef_out,
fr_event_list_t el,
int  fd,
fr_event_fd_cb_t  read_fn,
fr_event_fd_cb_t  write_fn,
fr_event_error_cb_t  error,
void *  uctx 
)

Associate I/O callbacks with a file descriptor.

Parameters
[in]ctxto bind lifetime of the event to.
[out]ef_outWhere to store the output event
[in]elto insert fd callback into.
[in]fdto install filters for.
[in]read_fnfunction to call when fd is readable.
[in]write_fnfunction to call when fd is writable.
[in]errorfunction to call when an error occurs on the fd.
[in]uctxto pass to handler.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1233 of file event.c.

+ Here is the call graph for this function:

◆ _fr_event_fd_move()

int _fr_event_fd_move ( NDEBUG_LOCATION_ARGS fr_event_list_t dst,
fr_event_list_t src,
int  fd,
fr_event_filter_t  filter 
)

Move a file descriptor event from one event list to another.

FIXME - Move suspended events too.

Note
Any pending events will not be transferred.
Parameters
[in]dstEvent list to move file descriptor event to.
[in]srcEvent list to move file descriptor from.
[in]fdof the event to move.
[in]filterof the event to move.
Returns
  • 0 on success.
  • -1 on failure. The event will remain active in the src list.

Definition at line 949 of file event.c.

+ Here is the call graph for this function:

◆ _fr_event_filter_insert()

int _fr_event_filter_insert ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_fd_t **  ef_out,
fr_event_list_t el,
int  fd,
fr_event_filter_t  filter,
void *  funcs,
fr_event_error_cb_t  error,
void *  uctx 
)

Insert a filter for the specified fd.

Parameters
[in]ctxto bind lifetime of the event to.
[out]ef_outPreviously allocated ef, or NULL.
[in]elto insert fd callback into.
[in]fdto install filters for.
[in]filterone of the fr_event_filter_t values.
[in]funcsStructure containing callback functions. If a function pointer is set, the equivalent kevent filter will be installed.
[in]errorfunction to call when an error occurs on the fd.
[in]uctxto pass to handler.

Definition at line 1077 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_filter_update()

int _fr_event_filter_update ( NDEBUG_LOCATION_ARGS fr_event_list_t el,
int  fd,
fr_event_filter_t  filter,
fr_event_update_t const  updates[] 
)

Suspend/resume a subset of filters.

This function trades producing useful errors for speed.

An example of suspending the read filter for an FD would be:

{ 0 }
}
@ FR_EVENT_FILTER_IO
Combined filter for read/write functions/.
Definition: event.h:62
#define fr_event_filter_update(...)
Definition: event.h:224
#define FR_EVENT_SUSPEND(_s, _f)
Temporarily remove the filter for a func from kevent.
Definition: event.h:94
Callbacks for the FR_EVENT_FILTER_IO filter.
Definition: event.h:173
Structure describing a modification to a filter's state.
Definition: event.h:75
static fr_event_update_t pause_read[]
Definition: master.c:155
static fr_event_list_t * el
Parameters
[in]elto update descriptor in.
[in]fdto update filters for.
[in]filterThe type of filter to update.
[in]updatesAn array of updates to toggle filters on/off without removing the callback function.

Definition at line 1000 of file event.c.

+ Here is the call graph for this function:

◆ _fr_event_pid_early_exit()

static void _fr_event_pid_early_exit ( fr_event_list_t el,
void *  uctx 
)
static

Called on the next loop through the event loop when inserting an EVFILT_PROC event fails.

This is just a trampoleen function which takes the user event and simulates an EVFILT_PROC event from it.

Parameters
[in]elThat received the event.
[in]uctxAn fr_event_pid_t to process.

Definition at line 1710 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_pid_reap()

int _fr_event_pid_reap ( NDEBUG_LOCATION_ARGS fr_event_list_t el,
pid_t  pid,
fr_event_pid_cb_t  callback,
void *  uctx 
)

Asynchronously wait for a PID to exit, then reap it.

This is intended to be used when we no longer care about a process exiting, but we still want to clean up its state so we don't have zombie processes sticking around.

Parameters
[in]elto use to reap the process.
[in]pidto reap.
[in]callbackto call when the process is reaped. May be NULL.
[in]uctxto pass to callback.
Returns
  • -1 if we couldn't find the process or it has already exited/been reaped.
  • 0 on success (we setup a process handler).

Definition at line 1968 of file event.c.

+ Here is the call graph for this function:

◆ _fr_event_pid_reap_cb()

static void _fr_event_pid_reap_cb ( UNUSED fr_event_list_t el,
pid_t  pid,
int  status,
void *  uctx 
)
static

Does the actual reaping of PIDs.

Definition at line 1925 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_pid_wait()

int _fr_event_pid_wait ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_event_pid_t const **  ev_p,
pid_t  pid,
fr_event_pid_cb_t  callback,
void *  uctx 
)

Insert a PID event into an event list.

Note
The talloc parent of the memory returned in ev_p must not be changed. If the lifetime of the event needs to be bound to another context this function should be called with the existing event pointed to by ev_p.
Parameters
[in]ctxto bind lifetime of the event to.
[in]elto insert event into.
[in,out]ev_pIf not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense.
[in]pidchild PID to wait for
[in]callbackfunction to execute if the event fires.
[in]uctxuser data to pass to the event.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1741 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_reap_free()

static int _fr_event_reap_free ( fr_event_pid_reap_t reap)
static

Definition at line 1938 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_timer_at()

int _fr_event_timer_at ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_event_timer_t const **  ev_p,
fr_time_t  when,
fr_event_timer_cb_t  callback,
void const *  uctx 
)

Insert a timer event into an event list.

Note
The talloc parent of the memory returned in ev_p must not be changed. If the lifetime of the event needs to be bound to another context this function should be called with the existing event pointed to by ev_p.
Parameters
[in]ctxto bind lifetime of the event to.
[in]elto insert event into.
[in,out]ev_pIf not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense.
[in]whenwe should run the event.
[in]callbackfunction to execute if the event fires.
[in]uctxuser data to pass to the event.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1451 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _fr_event_timer_in()

int _fr_event_timer_in ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_event_timer_t const **  ev_p,
fr_time_delta_t  delta,
fr_event_timer_cb_t  callback,
void const *  uctx 
)

Insert a timer event into an event list.

Note
The talloc parent of the memory returned in ev_p must not be changed. If the lifetime of the event needs to be bound to another context this function should be called with the existing event pointed to by ev_p.
Parameters
[in]ctxto bind lifetime of the event to.
[in]elto insert event into.
[in,out]ev_pIf not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense.
[in]deltaIn how many nanoseconds to wait before should we execute the event.
[in]callbackfunction to execute if the event fires.
[in]uctxuser data to pass to the event.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1596 of file event.c.

+ Here is the call graph for this function:

◆ _fr_event_user_insert()

int _fr_event_user_insert ( NDEBUG_LOCATION_ARGS TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_event_user_t **  ev_p,
bool  trigger,
fr_event_user_cb_t  callback,
void *  uctx 
)

Add a user callback to the event list.

Parameters
[in]ctxto allocate the event in.
[in]elContaining the timer events.
[out]ev_pWhere to write a pointer.
[in]triggerWhether the user event is triggered initially.
[in]callbackfor EVFILT_USER.
[in]uctxfor the callback.
Returns
  • 0 on success.
  • -1 on error.

Definition at line 2187 of file event.c.

+ Here is the call graph for this function:

◆ event_callback()

static void event_callback ( fr_event_list_t el,
fr_event_fd_t ef,
int *  filter,
int  flags,
int *  fflags 
)
inlinestatic

Definition at line 2536 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EVENT_DEBUG()

EVENT_DEBUG ( "%s - Reaper forcefully reaping PID %u - %p"  ,
__FUNCTION__  ,
reap->pid_ev->  pid,
reap   
)

◆ event_fd_func()

static fr_event_fd_cb_t event_fd_func ( fr_event_fd_t ef,
int *  filter,
int *  fflags 
)
inlinestatic

Figure out which function to call given a kevent.

This function should be called in a loop until it returns NULL.

Parameters
[in]efFile descriptor state handle.
[in]filterfrom the kevent.
[in,out]fflagsfrom the kevent. Each call will return the function from the next most significant NOTE_*, with each NOTE_* before unset from fflags.
Returns
  • NULL there are no more callbacks to call.
  • The next callback to call.

Definition at line 529 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ event_fd_func_index_build()

static void event_fd_func_index_build ( fr_event_func_map_t map)
static

Definition at line 447 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ event_list_reap_run_callback() [1/2]

static void event_list_reap_run_callback ( fr_event_pid_reap_t reap,
pid_t  pid,
int  status 
)
inlinestatic

Saves some boilerplate...

Definition at line 1917 of file event.c.

+ Here is the caller graph for this function:

◆ event_list_reap_run_callback() [2/2]

event_list_reap_run_callback ( reap  ,
reap->pid_ev->  pid,
status   
)

◆ event_pid_eval()

static void event_pid_eval ( fr_event_list_t el,
struct kevent *  kev 
)
inlinestatic

Evaluate a EVFILT_PROC event.

Definition at line 1663 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ event_user_eval()

static void event_user_eval ( fr_event_list_t el,
struct kevent *  kev 
)
inlinestatic

Definition at line 2159 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_build_evset()

static ssize_t fr_event_build_evset ( UNUSED fr_event_list_t el,
struct kevent  out_kev[],
size_t  outlen,
fr_event_funcs_t active,
fr_event_fd_t ef,
fr_event_funcs_t const *  new,
fr_event_funcs_t const *  prev 
)
static

Build a new evset based on function pointers present.

Note
The contents of active functions may be inconsistent if this function errors. But the only time that will occur is if the caller passed invalid arguments.
Parameters
[in]elwe're building events for.
[out]out_kevwhere to write the evset.
[in]outlenlength of output buffer.
[out]activeThe set of function pointers with active filters.
[in]efevent to insert.
[in]newFunctions to map to filters.
[in]prevPrevious set of functions mapped to filters.
Returns
  • >= 0 the number of changes written to out.
  • < 0 an error occurred.

Definition at line 678 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_corral()

int fr_event_corral ( fr_event_list_t el,
fr_time_t  now,
bool  wait 
)

Gather outstanding timer and file descriptor events.

Parameters
[in]elto process events for.
[in]nowThe current time.
[in]waitif true, block on the kevent() call until a timer or file descriptor event occurs.
Returns
  • <0 error, or the event loop is exiting
  • the number of outstanding I/O events, +1 if at least one timer will fire.

Definition at line 2414 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_armour()

int fr_event_fd_armour ( fr_event_list_t el,
int  fd,
fr_event_filter_t  filter,
uintptr_t  armour 
)

Armour an FD.

Parameters
[in]elto remove file descriptor from.
[in]fdto remove.
[in]filterThe type of filter to remove.
[in]armourThe armour to add.
Returns
  • 0 if file descriptor was armoured
  • <0 on error.

Definition at line 1342 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_cb()

fr_event_fd_cb_t fr_event_fd_cb ( fr_event_fd_t ef,
int  kq_filter,
int  kq_fflags 
)

Returns the appropriate callback function for a given event.

Parameters
[in]efthe event filter fd handle.
[in]kq_filterIf the callbacks are indexed by filter.
[in]kq_fflagsIf the callbacks are indexed by NOTES (fflags).
Returns
  • NULL if no event it associated with the given ef/kq_filter or kq_fflags combo.
  • The callback that would be called if an event with this filter/fflag combo was received.

Definition at line 1318 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_cmp()

static int8_t fr_event_fd_cmp ( void const *  one,
void const *  two 
)
static

Compare two file descriptor handles.

Parameters
[in]onethe first file descriptor handle.
[in]twothe second file descriptor handle.
Returns
CMP(one, two)

Definition at line 589 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_fd_delete()

int fr_event_fd_delete ( fr_event_list_t el,
int  fd,
fr_event_filter_t  filter 
)

Remove a file descriptor from the event loop.

Parameters
[in]elto remove file descriptor from.
[in]fdto remove.
[in]filterThe type of filter to remove.
Returns
  • 0 if file descriptor was removed.
  • <0 on error.

Definition at line 1260 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_handle()

fr_event_fd_t* fr_event_fd_handle ( fr_event_list_t el,
int  fd,
fr_event_filter_t  filter 
)

Get the opaque event handle from a file descriptor.

Parameters
[in]elto search for fd/filter in.
[in]fdto search for.
[in]filterto search for.
Returns
  • NULL if no event could be found.
  • The opaque handle representing an fd event.

Definition at line 1296 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_noop()

static void fr_event_fd_noop ( UNUSED fr_event_list_t el,
UNUSED int  fd,
UNUSED int  flags,
UNUSED void *  uctx 
)
static

Placeholder callback to avoid branches in service loop.

This is set in place of any NULL function pointers, so that the event loop doesn't SEGV if a filter callback function is unset between corral and service.

Definition at line 657 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_fd_type_set()

static int fr_event_fd_type_set ( fr_event_fd_t ef,
int  fd 
)
static

Discover the type of a file descriptor.

This function writes the result of the discovery to the ef->type, and ef->sock_type fields.

Parameters
[out]efto write type data to.
[in]fdto discover the type of.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 811 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_fd_uctx()

void* fr_event_fd_uctx ( fr_event_fd_t ef)

Returns the uctx associated with an fr_event_fd_t handle.

Definition at line 1326 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_fd_unarmour()

int fr_event_fd_unarmour ( fr_event_list_t el,
int  fd,
fr_event_filter_t  filter,
uintptr_t  armour 
)

Unarmour an FD.

Parameters
[in]elto remove file descriptor from.
[in]fdto remove.
[in]filterThe type of filter to remove.
[in]armourThe armour to remove
Returns
  • 0 if file descriptor was unarmoured
  • <0 on error.

Definition at line 1372 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_list_alloc()

fr_event_list_t* fr_event_list_alloc ( TALLOC_CTX *  ctx,
fr_event_status_cb_t  status,
void *  status_uctx 
)

Initialise a new event list.

Parameters
[in]ctxto allocate memory in.
[in]statuscallback, called on each iteration of the event list.
[in]status_uctxcontext for the status callback
Returns
  • A pointer to a new event list on success (free with talloc_free).
  • NULL on error.

Definition at line 2899 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_list_empty()

bool fr_event_list_empty ( fr_event_list_t el)

Return whether the event loop has any active events.

Definition at line 2979 of file event.c.

+ Here is the call graph for this function:

◆ fr_event_list_kq()

int fr_event_list_kq ( fr_event_list_t el)

Return the kq associated with an event list.

Parameters
[in]elto return timer events for.
Returns
kq

Definition at line 625 of file event.c.

◆ fr_event_list_num_fds()

uint64_t fr_event_list_num_fds ( fr_event_list_t el)

Return the number of file descriptors is_registered with this event loop.

Definition at line 601 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_list_num_timers()

uint64_t fr_event_list_num_timers ( fr_event_list_t el)

Return the number of timer events currently scheduled.

Parameters
[in]elto return timer events for.
Returns
number of timer events.

Definition at line 613 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_list_reap_signal()

unsigned int fr_event_list_reap_signal ( fr_event_list_t el,
fr_time_delta_t  timeout,
int  signal 
)

Send a signal to all the processes we have in our reap list, and reap them.

Parameters
[in]elcontaining the processes to reap.
[in]timeouthow long to wait before we signal the processes.
[in]signalto send to processes. Should be a fatal signal.
Returns
The number of processes reaped.

Definition at line 2004 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_list_set_time_func()

void fr_event_list_set_time_func ( fr_event_list_t el,
fr_event_time_source_t  func 
)

Override event list time source.

Parameters
[in]elto set new time function for.
[in]functo set.

Definition at line 2971 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_list_time()

fr_time_t fr_event_list_time ( fr_event_list_t el)

Get the current server time according to the event list.

If the event list is currently dispatching events, we return the time this iteration of the event list started.

If the event list is not currently dispatching events, we return the current system time.

Parameters
[in]elto get time from.
Returns
the current time according to the event list.

Definition at line 643 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_loop()

int fr_event_loop ( fr_event_list_t el)

Run an event loop.

Note
Will not return until fr_event_loop_exit is called.
Parameters
[in]elto start processing.

Definition at line 2766 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_loop_exit()

void fr_event_loop_exit ( fr_event_list_t el,
int  code 
)

Signal an event loop exit with the specified code.

The event loop will complete its current iteration, and then exit with the specified code.

Parameters
[in]elto signal to exit.
[in]codefor fr_event_loop to return.

Definition at line 2744 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_loop_exiting()

bool fr_event_loop_exiting ( fr_event_list_t el)

Check to see whether the event loop is in the process of exiting.

Parameters
[in]elto check.

Definition at line 2755 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_post_delete()

int fr_event_post_delete ( fr_event_list_t el,
fr_event_timer_cb_t  callback,
void *  uctx 
)

Delete a post-event callback from the event list.

Parameters
[in]elContaining the timer events.
[in]callbackThe post-processing callback.
[in]uctxfor the callback.
Returns
  • < 0 on error
  • 0 on success

Definition at line 2335 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_post_insert()

int fr_event_post_insert ( fr_event_list_t el,
fr_event_timer_cb_t  callback,
void *  uctx 
)

Add a post-event callback to the event list.

Events are serviced in insert order. i.e. insert A, B, we then have A running before B.

Parameters
[in]elContaining the timer events.
[in]callbackThe post-processing callback.
[in]uctxfor the callback.
Returns
  • < 0 on error
  • 0 on success

Definition at line 2313 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_pre_delete()

int fr_event_pre_delete ( fr_event_list_t el,
fr_event_status_cb_t  callback,
void *  uctx 
)

Delete a pre-event callback from the event list.

Parameters
[in]elContaining the timer events.
[in]callbackThe pre-processing callback.
[in]uctxfor the callback.
Returns
  • < 0 on error
  • 0 on success

Definition at line 2281 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_pre_insert()

int fr_event_pre_insert ( fr_event_list_t el,
fr_event_status_cb_t  callback,
void *  uctx 
)

Add a pre-event callback to the event list.

Events are serviced in insert order. i.e. insert A, B, we then have A running before B.

Parameters
[in]elContaining the timer events.
[in]callbackThe pre-processing callback.
[in]uctxfor the callback.
Returns
  • < 0 on error
  • 0 on success

Definition at line 2259 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_service()

void fr_event_service ( fr_event_list_t el)

Service any outstanding timer or file descriptor events.

Parameters
[in]elcontaining events to service.

Definition at line 2549 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_timer_cmp()

static int8_t fr_event_timer_cmp ( void const *  a,
void const *  b 
)
static

Compare two timer events to see which one should occur first.

Parameters
[in]athe first timer event.
[in]bthe second timer event.
Returns
  • +1 if a should occur later than b.
  • -1 if a should occur earlier than b.
  • 0 if both events occur at the same time.

Definition at line 576 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_timer_delete()

int fr_event_timer_delete ( fr_event_timer_t const **  ev_p)

Delete a timer event from the event list.

Parameters
[in]ev_pof the event being deleted.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1611 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_timer_run()

int fr_event_timer_run ( fr_event_list_t el,
fr_time_t when 
)

Run a single scheduled timer event.

Parameters
[in]elcontaining the timer events.
[in]whenProcess events scheduled to run before or at this time.
Returns
  • 0 no timer events fired.
  • 1 a timer event fired.

Definition at line 2363 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_event_timer_when()

fr_time_t fr_event_timer_when ( fr_event_timer_t const *  ev)

Internal timestamp representing when the timer should fire.

Returns
When the timestamp should fire.

Definition at line 1633 of file event.c.

+ Here is the caller graph for this function:

◆ fr_event_user_trigger()

int fr_event_user_trigger ( fr_event_list_t el,
fr_event_user_t ev 
)

Trigger a user event.

Parameters
[in]elcontaining the user event.
[in]evHandle for the user event.
Returns
  • 0 on success.
  • -1 on error.

Definition at line 2233 of file event.c.

+ Here is the call graph for this function:

◆ if()

if ( )

Definition at line 2105 of file event.c.

+ Here is the call graph for this function:

◆ talloc_free()

talloc_free ( reap  )

◆ waitpid()

waitpid ( reap->pid_ev->  pid,
status,
 
)
+ Here is the caller graph for this function:

Variable Documentation

◆ __pad0__

force __pad0__

Definition at line 2096 of file event.c.

◆ filter_maps

fr_event_func_map_t filter_maps[]
static

Definition at line 172 of file event.c.

◆ fr_event_fd_type_table

fr_table_num_sorted_t const fr_event_fd_type_table[]
static
Initial value:
= {
{ L("directory"), FR_EVENT_FD_DIRECTORY },
{ L("file"), FR_EVENT_FD_FILE },
{ L("pcap"), FR_EVENT_FD_PCAP },
{ L("socket"), FR_EVENT_FD_SOCKET }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207
#define FR_EVENT_FD_PCAP
Definition: event.c:145
@ FR_EVENT_FD_FILE
is a file.
Definition: event.c:126
@ FR_EVENT_FD_DIRECTORY
is a directory.
Definition: event.c:127
@ FR_EVENT_FD_SOCKET
is a socket.
Definition: event.c:125

Definition at line 283 of file event.c.

◆ fr_event_fd_type_table_len

size_t fr_event_fd_type_table_len = NUM_ELEMENTS(fr_event_fd_type_table)
static

Definition at line 289 of file event.c.

◆ kevent_filter_table

fr_table_num_sorted_t const kevent_filter_table[]
static
Initial value:
= {
{ L("EVFILT_PROC"), EVFILT_PROC },
{ L("EVFILT_READ"), EVFILT_READ },
{ L("EVFILT_SIGNAL"), EVFILT_SIGNAL },
{ L("EVFILT_TIMER"), EVFILT_TIMER },
{ L("EVFILT_VNODE"), EVFILT_VNODE },
{ L("EVFILT_WRITE"), EVFILT_WRITE }
}

Definition at line 76 of file event.c.

◆ kevent_filter_table_len

size_t kevent_filter_table_len = NUM_ELEMENTS(kevent_filter_table)
static

Definition at line 93 of file event.c.

◆ processed

return processed

Definition at line 2129 of file event.c.