Crinit -- Configurable Rootfs Init
|
Header related to the Config Parser. More...
Go to the source code of this file.
Classes | |
struct | crinitConfKvList_t |
Macros | |
#define | CRINIT_CONFIG_KEYSTR_TASKS "TASKS" |
Config key for the list of task file names. More... | |
#define | CRINIT_CONFIG_KEYSTR_INCLUDES "INCLUDES" |
Config key for the list of task file names. More... | |
#define | CRINIT_CONFIG_KEYSTR_TASKDIR_SYMLINKS "TASKDIR_FOLLOW_SYMLINKS" |
configurations. More... | |
#define | CRINIT_CONFIG_KEYSTR_DEBUG "DEBUG" |
Config file key for DEBUG global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_TASKDIR "TASKDIR" |
Config file key for TASKDIR global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_INCLDIR "INCLUDEDIR" |
Config file key for INCLUDEDIR global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_SHDGRACEP "SHUTDOWN_GRACE_PERIOD_US" |
Config file key for SHUTDOWN_GRACE_PERIOD_US global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_USE_SYSLOG "USE_SYSLOG" |
Config file key for USE_SYSLOG global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_USE_ELOS "USE_ELOS" |
Config file key for USE_ELOS global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_ELOS_SERVER "ELOS_SERVER" |
Config file key for ELOS_SERVER global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_ELOS_PORT "ELOS_PORT" |
Config file key for ELOS_PORT global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_INCL_SUFFIX "INCLUDE_SUFFIX" |
Config file key for INCLUDE_SUFFIX global option. More... | |
#define | CRINIT_CONFIG_KEYSTR_TASK_FILE_SUFFIX "TASK_FILE_SUFFIX" |
Config key for the task file extension in dynamic configurations. More... | |
#define | CRINIT_CONFIG_KEYSTR_COMMAND "COMMAND" |
Config key to add a command to the task. More... | |
#define | CRINIT_CONFIG_KEYSTR_DEPENDS "DEPENDS" |
Config key to add dependencies to the task. More... | |
#define | CRINIT_CONFIG_KEYSTR_ENV_SET "ENV_SET" |
Config key to set an environment variable with. More... | |
#define | CRINIT_CONFIG_KEYSTR_FILTER_DEFINE "FILTER_DEFINE" |
Config key to define an elos filter. More... | |
#define | CRINIT_CONFIG_KEYSTR_INCLUDE "INCLUDE" |
Config key for file include directives. More... | |
#define | CRINIT_CONFIG_KEYSTR_IOREDIR "IO_REDIRECT" |
Config key for IO redirections. More... | |
#define | CRINIT_CONFIG_KEYSTR_NAME "NAME" |
Config key for the task name. More... | |
#define | CRINIT_CONFIG_KEYSTR_PROVIDES "PROVIDES" |
Config key for provided features. More... | |
#define | CRINIT_CONFIG_KEYSTR_RESPAWN "RESPAWN" |
Config key to set a task to be respawning. More... | |
#define | CRINIT_CONFIG_KEYSTR_RESPAWN_RETRIES "RESPAWN_RETRIES" |
Config key to set how often a task is allowed to respawn on failure. More... | |
#define | CRINIT_CONFIG_DEFAULT_TASK_FILE_SUFFIX ".crinit" |
Default filename extension of task files. More... | |
#define | CRINIT_CONFIG_KEYSTR_INCL_FILE_SUFFIX "INCL_FILE_SUFFIX" |
Config key for the task include file extension in dynamic configurations. More... | |
#define | CRINIT_CONFIG_DEFAULT_INCL_FILE_SUFFIX ".crincl" |
Default filename extension of task include files. More... | |
#define | CRINIT_CONFIG_DEFAULT_DEBUG false |
Default value for DEBUG global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_TASKDIR "/etc/crinit" |
Default value for TASKDIR global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_TASKDIR_SYMLINKS true |
#define | CRINIT_CONFIG_DEFAULT_INCLDIR "/etc/crinit" |
Default value for INCLUDEDIR global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_SHDGRACEP 100000uLL |
Default value for SHUTDOWN_GRACE_PERIOD_US global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_USE_SYSLOG false |
Default value for USE_SYSLOG global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_USE_ELOS false |
Default value for USE_ELOS global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_ELOS_SERVER "127.0.0.1" |
Default value for ELOS_SERVER global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_ELOS_PORT 54321 |
Default value for ELOS_SERVER global option. More... | |
#define | CRINIT_CONFIG_DEFAULT_INCL_SUFFIX ".crincl" |
Default filename extension of include files. More... | |
#define | CRINIT_CONFIG_STDOUT_NAME "STDOUT" |
What stdout is called in task configs. More... | |
#define | CRINIT_CONFIG_STDERR_NAME "STDERR" |
What stderr is called in task configs. More... | |
#define | CRINIT_CONFIG_STDIN_NAME "STDIN" |
What stdin is called in task configs. More... | |
Typedefs | |
typedef enum crinitConfigs_t | crinitConfigs_t |
typedef enum crinitConfigType_t | crinitConfigType_t |
typedef struct crinitConfKvList_t | crinitConfKvList_t |
Functions | |
int | crinitParseConf (crinitConfKvList_t **confList, const char *filename) |
void | crinitFreeConfList (crinitConfKvList_t *confList) |
void | crinitFreeArgvArray (char **inArgv) |
int | crinitLoadSeriesConf (crinitFileSeries_t *series, const char *filename) |
Header related to the Config Parser.
#define CRINIT_CONFIG_DEFAULT_DEBUG false |
Default value for DEBUG global option.
#define CRINIT_CONFIG_DEFAULT_ELOS_PORT 54321 |
Default value for ELOS_SERVER global option.
#define CRINIT_CONFIG_DEFAULT_ELOS_SERVER "127.0.0.1" |
Default value for ELOS_SERVER global option.
#define CRINIT_CONFIG_DEFAULT_INCL_FILE_SUFFIX ".crincl" |
Default filename extension of task include files.
#define CRINIT_CONFIG_DEFAULT_INCL_SUFFIX ".crincl" |
Default filename extension of include files.
#define CRINIT_CONFIG_DEFAULT_INCLDIR "/etc/crinit" |
Default value for INCLUDEDIR global option.
#define CRINIT_CONFIG_DEFAULT_SHDGRACEP 100000uLL |
Default value for SHUTDOWN_GRACE_PERIOD_US global option.
#define CRINIT_CONFIG_DEFAULT_TASK_FILE_SUFFIX ".crinit" |
Default filename extension of task files.
#define CRINIT_CONFIG_DEFAULT_TASKDIR "/etc/crinit" |
Default value for TASKDIR global option.
#define CRINIT_CONFIG_DEFAULT_TASKDIR_SYMLINKS true |
#define CRINIT_CONFIG_DEFAULT_USE_ELOS false |
Default value for USE_ELOS global option.
#define CRINIT_CONFIG_DEFAULT_USE_SYSLOG false |
Default value for USE_SYSLOG global option.
#define CRINIT_CONFIG_KEYSTR_COMMAND "COMMAND" |
Config key to add a command to the task.
#define CRINIT_CONFIG_KEYSTR_DEBUG "DEBUG" |
Config file key for DEBUG global option.
#define CRINIT_CONFIG_KEYSTR_DEPENDS "DEPENDS" |
Config key to add dependencies to the task.
#define CRINIT_CONFIG_KEYSTR_ELOS_PORT "ELOS_PORT" |
Config file key for ELOS_PORT global option.
#define CRINIT_CONFIG_KEYSTR_ELOS_SERVER "ELOS_SERVER" |
Config file key for ELOS_SERVER global option.
#define CRINIT_CONFIG_KEYSTR_ENV_SET "ENV_SET" |
Config key to set an environment variable with.
#define CRINIT_CONFIG_KEYSTR_FILTER_DEFINE "FILTER_DEFINE" |
Config key to define an elos filter.
#define CRINIT_CONFIG_KEYSTR_INCL_FILE_SUFFIX "INCL_FILE_SUFFIX" |
Config key for the task include file extension in dynamic configurations.
#define CRINIT_CONFIG_KEYSTR_INCL_SUFFIX "INCLUDE_SUFFIX" |
Config file key for INCLUDE_SUFFIX global option.
#define CRINIT_CONFIG_KEYSTR_INCLDIR "INCLUDEDIR" |
Config file key for INCLUDEDIR global option.
#define CRINIT_CONFIG_KEYSTR_INCLUDE "INCLUDE" |
Config key for file include directives.
#define CRINIT_CONFIG_KEYSTR_INCLUDES "INCLUDES" |
Config key for the list of task file names.
#define CRINIT_CONFIG_KEYSTR_IOREDIR "IO_REDIRECT" |
Config key for IO redirections.
#define CRINIT_CONFIG_KEYSTR_NAME "NAME" |
Config key for the task name.
#define CRINIT_CONFIG_KEYSTR_PROVIDES "PROVIDES" |
Config key for provided features.
#define CRINIT_CONFIG_KEYSTR_RESPAWN "RESPAWN" |
Config key to set a task to be respawning.
#define CRINIT_CONFIG_KEYSTR_RESPAWN_RETRIES "RESPAWN_RETRIES" |
Config key to set how often a task is allowed to respawn on failure.
#define CRINIT_CONFIG_KEYSTR_SHDGRACEP "SHUTDOWN_GRACE_PERIOD_US" |
Config file key for SHUTDOWN_GRACE_PERIOD_US global option.
#define CRINIT_CONFIG_KEYSTR_TASK_FILE_SUFFIX "TASK_FILE_SUFFIX" |
Config key for the task file extension in dynamic configurations.
#define CRINIT_CONFIG_KEYSTR_TASKDIR "TASKDIR" |
Config file key for TASKDIR global option.
#define CRINIT_CONFIG_KEYSTR_TASKDIR_SYMLINKS "TASKDIR_FOLLOW_SYMLINKS" |
configurations.
Config key for the option to follow symbolic links from TASKDIR
in dynamic
#define CRINIT_CONFIG_KEYSTR_TASKS "TASKS" |
Config key for the list of task file names.
#define CRINIT_CONFIG_KEYSTR_USE_ELOS "USE_ELOS" |
Config file key for USE_ELOS global option.
#define CRINIT_CONFIG_KEYSTR_USE_SYSLOG "USE_SYSLOG" |
Config file key for USE_SYSLOG global option.
#define CRINIT_CONFIG_STDERR_NAME "STDERR" |
What stderr is called in task configs.
#define CRINIT_CONFIG_STDIN_NAME "STDIN" |
What stdin is called in task configs.
#define CRINIT_CONFIG_STDOUT_NAME "STDOUT" |
What stdout is called in task configs.
typedef enum crinitConfigs_t crinitConfigs_t |
Enumeration of all configuration keys. Goes together with crinitTaskCfgMap and crinitSeriesCfgMap.
typedef enum crinitConfigType_t crinitConfigType_t |
typedef struct crinitConfKvList_t crinitConfKvList_t |
Linked list to hold key/value pairs read from the config file.
enum crinitConfigs_t |
Enumeration of all configuration keys. Goes together with crinitTaskCfgMap and crinitSeriesCfgMap.
enum crinitConfigType_t |
void crinitFreeArgvArray | ( | char ** | inArgv | ) |
Frees a string array with a backing string.
inArgv | The string array to free, must be a double pointer with 2 allocations, one array of pointers and a single inner array of char. |
void crinitFreeConfList | ( | crinitConfKvList_t * | confList | ) |
Frees memory allocated for an crinitConfKvList_t by crinitParseConf().
confList | Pointer to crinitConfKvList_t allocated by crinitParseConf() and not freed before. If confList is NULL, crinitFreeConfList() will return without freeing any memory. |
int crinitLoadSeriesConf | ( | crinitFileSeries_t * | series, |
const char * | filename | ||
) |
Parse a series file.
Will return the task config and include files to be loaded in series. Will also set any global options specified in the series file.
series | Returns the paths to the task configs specified in the series file (or scanned from TASKDIR, if configured). |
filename | The path to the series file to load. |
int crinitParseConf | ( | crinitConfKvList_t ** | confList, |
const char * | filename | ||
) |
Parse a config file into a crinitConfKvList_t.
Parses a config file and fills confList. Items of confList are dynamically allocated (grown) and need to be freed using free_confList(). The format of the config file is expected to be KEY1=VALUE1<newline>KEY2=VALUE2<newline>... Lines beginning with '#' are considered comments.
confList | will return a pointer to dynamically allocated memory of a ConfKvList filled with the key/value-pairs from the config file. |
filename | Path to the configuration file. |