Crinit -- Configurable Rootfs Init
|
Implementation of elos connection. More...
#include "elosio.h"
#include <dlfcn.h>
#include <netinet/in.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include "common.h"
#include "confparse.h"
#include "globopt.h"
#include "list.h"
#include "logio.h"
#include "task.h"
#include "taskdb.h"
#include "thrpool.h"
Classes | |
struct | crinitElosSession |
struct | crinitElosEventVector |
struct | crinitElosioFilterTask |
struct | crinitElosioFilter |
struct | crinitElosEventThread |
Macros | |
#define | CRINIT_ELOS_IDENT "crinit" |
Identification string for crinit logging to syslog. More... | |
#define | CRINIT_ELOS_LIBRARY "libelos.so.0" |
Elos shared library name. More... | |
#define | CRINIT_ELOS_DEPENDENCY "@elos" |
Elos filter dependency prefix. More... | |
#define | ELOS_ID_INVALID 0 |
Invalid elos event queue ID constant. More... | |
#define | crinitElosioTryExec(func, err_msg, ...) |
Typedefs | |
typedef enum crinitSafuResultE_t | crinitSafuResultE_t |
typedef uint32_t | crinitElosEventQueueId_t |
typedef struct crinitElosSession | crinitElosSession_t |
typedef struct crinitElosEventVector | crinitElosEventVector_t |
typedef struct crinitElosioFilterTask | crinitElosioFilterTask_t |
typedef struct crinitElosioFilter | crinitElosioFilter_t |
Enumerations | |
enum | crinitSafuResultE_t { SAFU_RESULT_FAILED = -1 , SAFU_RESULT_OK = 0 , SAFU_RESULT_NOT_FOUND = 1 } |
Variables | |
static bool | crinitUseElos |
Specifies if we should use syslog calls instead of FILE streams. More... | |
static struct crinitElosEventThread | crinitTinfo |
static crinitList_t | crinitFilterTasks = CRINIT_LIST_INIT(crinitFilterTasks) |
static pthread_mutex_t | crinitElosioFilterTaskLock = PTHREAD_MUTEX_INITIALIZER |
static pthread_mutex_t | crinitElosioSessionLock = PTHREAD_MUTEX_INITIALIZER |
Implementation of elos connection.
#define CRINIT_ELOS_DEPENDENCY "@elos" |
Elos filter dependency prefix.
#define CRINIT_ELOS_IDENT "crinit" |
Identification string for crinit logging to syslog.
#define CRINIT_ELOS_LIBRARY "libelos.so.0" |
Elos shared library name.
#define crinitElosioTryExec | ( | func, | |
err_msg, | |||
... | |||
) |
Macro to simplify checking for a valid elos session.
Will print an error message and return from the calling function with an error code if the session pointer is either null or the conn.
HINT: This uses a GNU extension of gcc to define a compound statement enclosed in parentheses.
func | Elos function to be called. |
err_msg | Error message to be returned on error. |
#define ELOS_ID_INVALID 0 |
Invalid elos event queue ID constant.
typedef uint32_t crinitElosEventQueueId_t |
Type defition for elos event queue IDs.
typedef struct crinitElosEventVector crinitElosEventVector_t |
Elos event vector type.
typedef struct crinitElosioFilter crinitElosioFilter_t |
Definition of a single filter related to a task.
typedef struct crinitElosioFilterTask crinitElosioFilterTask_t |
Task that has unfulfilled filter dependencies.
typedef struct crinitElosSession crinitElosSession_t |
Elos session type.
typedef enum crinitSafuResultE_t crinitSafuResultE_t |
Possible elos return values.
enum crinitSafuResultE_t |
int crinitElosioActivate | ( | struct crinitTaskDB_t * | taskDb, |
bool | sl | ||
) |
Specify if Elos should be used.
By default, Crinit will not connect to elos. If this is set to true
, however, Crinit will connect to the elos daemon.
taskDb | Task database to be informed if event occurs. |
sl | true if elos should be used, false otherwise. |
|
inlinestatic |
Disconnect from elos daemon.
|
static |
|
inlinestatic |
Fetches a single symbol from the elos client shared library.
lp | Pointer to the elos shared library |
symbolName | Name of the symbol to be fetched |
symbol | Function pointer to be assigned |
|
static |
Frees the heap allocated members of the filter.
filter | Filter to be destroyed. |
|
static |
Create and register a new elos event filter handle from a given environment set.
task | Task to create elos filter for. |
name | Name of the filter to register. |
filter | Pointer to the created filter. |
|
static |
Free the complete list of subscribed filters.
filterTask | The task owning this filter list. |
|
static |
Subscribes all filters currently registered with elosio.
|
static |
Extracts all filter defines for each task and creates a local elos filter handle, which will be used to subscribe for this filter.
|
static |
Inserts an elos filter into the list of filter subscriptions.
filterTask | Task to register the filter for. |
filter | Filter to be registered. |
|
inlinestatic |
Subscribes the filter with elos.
filter | The filter to subscribe. |
|
static |
Frees the heap allocated members of the filter task.
filterTask | Filter task to be destroyed. |
|
static |
Free the complete list of filter tasks.
|
static |
Removes the given filter from the filter list.
filterTask | Task to remove the filter from. |
filter | Filter to be destroyed. |
|
inlinestatic |
Unsubscribes the filter from elos.
filter | The filter to unsubscribe. |
|
static |
Initializes the vtable managed within the elosio thread context.
taskDb | Pointer to the crinit task database |
tinfo | Elosio thread context |
int crinitElosioTaskAdded | ( | struct crinitTask_t * | task | ) |
Hook which will be invoked if a new task has been added and will register the elos filters for this task.
task | Task that has been added to elos. |
|
static |
Mutex synchronizing elos filter task registration
|
static |
Mutex synchronizing elos connection
|
static |
List of tasks with elos filter dependencies
|
static |
|
static |
Specifies if we should use syslog calls instead of FILE streams.