|
Crinit -- Configurable Rootfs Init
|
Implementation of elos event handling. More...
#include "eloslog.h"#include <errno.h>#include <pthread.h>#include <safu/common.h>#include <safu/ringbuffer.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <time.h>#include "common.h"#include "confparse.h"#include "globopt.h"
Data Structures | |
| struct | crinitElosEventThread_t |
Macros | |
| #define | STR_HELPER(x) #x |
| #define | STR(x) STR_HELPER(x) |
| #define | CRINIT_MACHINE_ID_LENGTH 32 |
| #define | CRINIT_MACHINE_ID_FORMAT "%" STR(CRINIT_MACHINE_ID_LENGTH) "s" |
Functions | |
| static int | crinitFetchHWId (char *hwId) |
| static int | crinitPublishEvent (void const *element, void const *data) |
| static void * | crinitEloslogEventTransmitter (void *arg) |
| int | crinitElosLog (crinitElosSeverityE_t severity, crinitElosEventMessageCodeE_t messageCode, uint64_t classification, const char *format,...) |
| int | crinitEloslogInit (void) |
| int | crinitEloslogActivate (bool e) |
Variables | |
| static bool | crinitElosActivated = false |
| Indicates if the elos connection and handler thread has been set up. | |
| static pthread_mutex_t | crinitElosActivatedLock = PTHREAD_MUTEX_INITIALIZER |
| Mutex to guard crinitElosActivated. | |
| static struct crinitElosEventThread_t | crinitTinfo |
| static pthread_mutex_t | crinitEloslogSessionLock = PTHREAD_MUTEX_INITIALIZER |
| static safuRingBuffer_t | crinitElosEventBuffer |
| static pthread_mutex_t | crinitEloslogTrCondLock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_cond_t | crinitEloslogTransmitCondition = PTHREAD_COND_INITIALIZER |
| static int | crinitEloslogTransmitCounter = 0 |
Implementation of elos event handling.
| #define CRINIT_MACHINE_ID_FORMAT "%" STR(CRINIT_MACHINE_ID_LENGTH) "s" |
| #define CRINIT_MACHINE_ID_LENGTH 32 |
| #define STR | ( | x | ) | STR_HELPER(x) |
| #define STR_HELPER | ( | x | ) | #x |
| int crinitElosLog | ( | crinitElosSeverityE_t | severity, |
| crinitElosEventMessageCodeE_t | messageCode, | ||
| uint64_t | classification, | ||
| const char * | format, | ||
| ... | |||
| ) |
Log a crinit event to elos.
| severity | The event severity. |
| messageCode | The event message code. |
| classification | The event classification bitmask. |
| format | Format string to format remaining arguments. |
| int crinitEloslogActivate | ( | bool | e | ) |
Specify if events should be sent to Elos.
By default, Crinit will not connect to elos. If this is set to true, however, Crinit will connect and send events to the elos daemon.
| e | true if elos should be used, false otherwise. |
|
static |
| int crinitEloslogInit | ( | void | ) |
Initialize all components needed to handle event logging.
|
inlinestatic |
|
inlinestatic |
|
static |
Indicates if the elos connection and handler thread has been set up.
|
static |
Mutex to guard crinitElosActivated.
|
static |
Ring buffer of elos event messages
|
static |
Mutex synchronizing elos connection
|
static |
Condition variable to block the transmitter thread until there are events to send
|
static |
Counter to account for condition variable signalling while it is not being waited on
|
static |
Mutex synchronizing access to the transmitter condition variable
|
static |