Crinit -- Configurable Rootfs Init
|
Header related to global option storage. More...
Go to the source code of this file.
Classes | |
struct | crinitGlobOptStore_t |
Macros | |
#define | CRINIT_GLOBOPT_DEBUG debug |
DEBUG global option. More... | |
#define | CRINIT_GLOBOPT_USE_SYSLOG useSyslog |
USE_SYSLOG global option. More... | |
#define | CRINIT_GLOBOPT_USE_ELOS useElos |
USE_ELOS global option. More... | |
#define | CRINIT_GLOBOPT_ELOS_PORT elosPort |
ELOS_PORT global option. More... | |
#define | CRINIT_GLOBOPT_ELOS_SERVER elosServer |
ELOS_SERVER global option. More... | |
#define | CRINIT_GLOBOPT_INCLDIR inclDir |
INCLUDEDIR global option. More... | |
#define | CRINIT_GLOBOPT_INCL_SUFFIX inclSuffix |
INCLUDE_SUFFIX global option. More... | |
#define | CRINIT_GLOBOPT_SHDGRACEP shdGraceP |
SHUTDOWN_GRACE_PERIOD_US global option. More... | |
#define | CRINIT_GLOBOPT_ENV globEnv |
Reference to the global task environment. More... | |
#define | CRINIT_GLOBOPT_FILTERS globFilters |
Reference to the global task filters. More... | |
#define | crinitGlobOptGet(globOptMember, retPtr) |
#define | crinitGlobOptSet(globOptMember, val) |
Typedefs | |
typedef struct crinitGlobOptStore_t | crinitGlobOptStore_t |
Functions | |
static crinitGlobOptStore_t crinitGenericGlobOptHelper | __attribute__ ((unused)) |
int | crinitGlobOptInitDefault (void) |
void | crinitGlobOptDestroy (void) |
crinitGlobOptStore_t * | crinitGlobOptBorrow (void) |
int | crinitGlobOptRemit (void) |
int | crinitGlobOptSetString (size_t memberOffset, const char *val) |
int | crinitGlobOptSetBoolean (size_t memberOffset, bool val) |
int | crinitGlobOptSetInteger (size_t memberOffset, int val) |
int | crinitGlobOptSetUnsignedLL (size_t memberOffset, unsigned long long val) |
int | crinitGlobOptSetEnvSet (size_t memberOffset, const crinitEnvSet_t *val) |
int | crinitGlobOptGetString (size_t memberOffset, char **val) |
int | crinitGlobOptGetBoolean (size_t memberOffset, bool *val) |
int | crinitGlobOptGetInteger (size_t memberOffset, int *val) |
int | crinitGlobOptGetUnsignedLL (size_t memberOffset, unsigned long long *val) |
int | crinitGlobOptGetEnvSet (size_t memberOffset, crinitEnvSet_t *val) |
Header related to global option storage.
#define CRINIT_GLOBOPT_DEBUG debug |
DEBUG global option.
#define CRINIT_GLOBOPT_ELOS_PORT elosPort |
ELOS_PORT global option.
#define CRINIT_GLOBOPT_ELOS_SERVER elosServer |
ELOS_SERVER global option.
#define CRINIT_GLOBOPT_ENV globEnv |
Reference to the global task environment.
#define CRINIT_GLOBOPT_FILTERS globFilters |
Reference to the global task filters.
#define CRINIT_GLOBOPT_INCL_SUFFIX inclSuffix |
INCLUDE_SUFFIX global option.
#define CRINIT_GLOBOPT_INCLDIR inclDir |
INCLUDEDIR global option.
#define CRINIT_GLOBOPT_SHDGRACEP shdGraceP |
SHUTDOWN_GRACE_PERIOD_US global option.
#define CRINIT_GLOBOPT_USE_ELOS useElos |
USE_ELOS global option.
#define CRINIT_GLOBOPT_USE_SYSLOG useSyslog |
USE_SYSLOG global option.
#define crinitGlobOptGet | ( | globOptMember, | |
retPtr | |||
) |
Type-generic macro to get the value of a given global option.
Thread-safe as all mapped function are thread-safe.
globOptMember | One of the member names of crinitGlobOptStore_t (or one of the CRINIT_GLOBOPT_* constants). |
retPtr | Return pointer for value. Type depends on the chosen member of crinitGlobOptStore_t and is always &(member_type) . In case of char ** (for a string) and crinitEnvSet_t * memory will be allocated. |
#define crinitGlobOptSet | ( | globOptMember, | |
val | |||
) |
Type-generic macro to get the value of a given global option.
Thread-safe as all mapped function are thread-safe.
globOptMember | One of the member names of crinitGlobOptStore_t (or one of the CRINIT_GLOBOPT_* constants). |
val | Value to store. Type depends on the chosen member of crinitGlobOptStore_t. See function signatures of crinitGlobOptGet*(). |
typedef struct crinitGlobOptStore_t crinitGlobOptStore_t |
Structure definition for the global option storage.
|
static |
Dummy instance for Generic Selection of members to work (see type-generic macros below).
crinitGlobOptStore_t* crinitGlobOptBorrow | ( | void | ) |
Provide direct thread-safe access to the central global option storage.
Calling thread will hold an exclusive lock on the central instance of crinitGlobOptStore_t. After the calling thread has finished its operations on the global option storage, it must release the lock using crinitGlobOptRemit().
void crinitGlobOptDestroy | ( | void | ) |
Deletes all set global options from storage.
Any allocated memory is freed. The function uses mutexes internally and is thread-safe.
int crinitGlobOptGetBoolean | ( | size_t | memberOffset, |
bool * | val | ||
) |
Retrieves a boolean value from a global option.
Consider using the type-generic macro crinitGlobOptGet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | Return pointer for the retrieved boolean value. |
int crinitGlobOptGetEnvSet | ( | size_t | memberOffset, |
crinitEnvSet_t * | val | ||
) |
Retrieves a crinitEnvSet_t value from a global option.
Consider using the type-generic macro crinitGlobOptGet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | Pointer to the crinitEnvSet_t instance to which the global one will be duplicated. |
int crinitGlobOptGetInteger | ( | size_t | memberOffset, |
int * | val | ||
) |
Retrieves an integer value from a global option.
Consider using the type-generic macro crinitGlobOptGet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | Return pointer for the retrieved integer value. |
int crinitGlobOptGetString | ( | size_t | memberOffset, |
char ** | val | ||
) |
Retrieves a string value from a global option.
Consider using the type-generic macro crinitGlobOptGet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
Will allocate memory for the returned string. When no longer in use, free() should be called on the returned pointer to free the memory.
memberOffset | The offset of the member of the global option struct to set. |
val | Return pointer for the retrieved string. Memory will be allocated. |
int crinitGlobOptGetUnsignedLL | ( | size_t | memberOffset, |
unsigned long long * | val | ||
) |
Retrieves an unsigned long long value from a global option.
Consider using the type-generic macro crinitGlobOptGet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | Return pointer for the unsigned long long integer value. |
int crinitGlobOptInitDefault | ( | void | ) |
Sets global options to their default values.
Uses crinitGlobOptSet() and is therefore thread-safe.
int crinitGlobOptRemit | ( | void | ) |
Release the lock on the global option storage acquired via crinitGlobOptBorrow().
int crinitGlobOptSetBoolean | ( | size_t | memberOffset, |
bool | val | ||
) |
Stores a boolean value for a global option.
Consider using the type-generic macro crinitGlobOptSet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | The boolean value to store. |
int crinitGlobOptSetEnvSet | ( | size_t | memberOffset, |
const crinitEnvSet_t * | val | ||
) |
Stores a crinitEnvSet_t value for a global option.
Consider using the type-generic macro crinitGlobOptSet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | Pointer to the crinitEnvSet_t which shall be stored. |
int crinitGlobOptSetInteger | ( | size_t | memberOffset, |
int | val | ||
) |
Stores an integer value for a global option.
Consider using the type-generic macro crinitGlobOptSet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | The boolean value to store. |
int crinitGlobOptSetString | ( | size_t | memberOffset, |
const char * | val | ||
) |
Stores a string value for a global option.
Consider using the type-generic macro crinitGlobOptSet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The offset of the member of the global option struct to set. |
val | The string value to store, must be null-terminated. |
int crinitGlobOptSetUnsignedLL | ( | size_t | memberOffset, |
unsigned long long | val | ||
) |
Stores an unsigned long long value for a global option.
Consider using the type-generic macro crinitGlobOptSet() which can be used with member names instead of offsets. Will lock the global option storage as long as needed and is thread-safe.
memberOffset | The global option to set. |
val | The unsigned long long integer value to store. |