![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
#include "config.h"#include "system.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <errno.h>#include <limits.h>#include <stdint.h>#include "utils/arax_assert.h"#include <pwd.h>
Include dependency graph for config.c:Go to the source code of this file.
Functions | |
| const char * | conf_get (const char *path) |
| void | conf_set (const char *path, const char *conf_str) |
| void | utils_config_write_str (char *path, const char *key, const char *value) |
| void | utils_config_write_long (char *path, const char *key, long value) |
| char * | utils_config_alloc_path (const char *path) |
| void | utils_config_free_path (char *path) |
| int | _utils_config_get_str (char *path, const char *key, char *value, size_t value_size) |
| int | utils_config_get_str (char *path, const char *key, char *value, size_t value_size, const char *def_val) |
| int | utils_config_get_bool (char *path, const char *key, int *value, int def_val) |
| int | utils_config_get_int (char *path, const char *key, int *value, int def_val) |
| int | utils_config_get_long (char *path, const char *key, long *value, long def_val) |
| int | utils_config_get_size (char *path, const char *key, size_t *value, size_t def_val) |
| enum utils_config_source | utils_config_get_source () |
| int _utils_config_get_str | ( | char * | path, |
| const char * | key, | ||
| char * | value, | ||
| size_t | value_size ) |
Definition at line 133 of file config.c.
References conf_get().
Referenced by utils_config_get_long(), and utils_config_get_str().
Here is the call graph for this function:
Here is the caller graph for this function:| const char * conf_get | ( | const char * | path | ) |
Definition at line 13 of file config.c.
References arax_assert, CONFIG_ENV, CONFIG_FILE, system_env_var(), system_file_size(), and utils_config_get_source().
Referenced by _utils_config_get_str(), and utils_config_write_str().
Here is the call graph for this function:
Here is the caller graph for this function:| void conf_set | ( | const char * | path, |
| const char * | conf_str ) |
Definition at line 49 of file config.c.
References arax_assert, CONFIG_ENV, CONFIG_FILE, and utils_config_get_source().
Referenced by utils_config_write_str().
Here is the call graph for this function:
Here is the caller graph for this function:| char * utils_config_alloc_path | ( | const char * | path | ) |
Create configuration based on path
NOTE: free returned value with utils_config_free_path().
path is scanned for the following characters and replaced: ~:Gets replaced with users home path (e.g. /home/user)
| path |
Definition at line 94 of file config.c.
References arax_assert, and system_home_path().
Referenced by _arax_init(), arax_clean(), async_meta_init_always(), and async_meta_init_once().
Here is the call graph for this function:
Here is the caller graph for this function:| void utils_config_free_path | ( | char * | path | ) |
Free path allocated with utils_config_alloc_path.
| path | Return value of a utils_config_alloc_path invocation. |
Definition at line 128 of file config.c.
Referenced by arax_clean(), arax_exit(), async_meta_init_always(), and async_meta_init_once().
Here is the caller graph for this function:| int utils_config_get_bool | ( | char * | path, |
| const char * | key, | ||
| int * | value, | ||
| int | def_val ) |
Get value corresponding to key as a boolean (0,1)
Will search the path file for a key/value pair matching the key. If the value is not found 0 will be returned. If during the search any error occurs, 0 will be returned and a message will be printed on stderr. If the value is found and the value equals to 1 then *value will be assigned 1, otherwise *value will be set to 0.
| path | Config path. |
| key | c style string, with the key of interest. |
| value | pointer to allocated array of size value_size. |
| def_val | Default value in case the key is not found. |
Definition at line 178 of file config.c.
References utils_config_get_int().
Referenced by _arax_init(), and async_meta_init_once().
Here is the call graph for this function:
Here is the caller graph for this function:| int utils_config_get_int | ( | char * | path, |
| const char * | key, | ||
| int * | value, | ||
| int | def_val ) |
Get value corresponding to key as an integer
Will search the path file for a key/value pair matching the key. If during the search any error occurs, 0 will be returned and a message will be printed on stderr. If the value is found it will be converted to an integer using atoi() and the result will be assigned to val. If no value is found val will be assigned def_val and 0 will be returned.
| path | Config path. |
| key | c style string string, with the key of interest. |
| value | pointer to allocated array of size value_size. |
| def_val | Default value in case the key is not found. |
Definition at line 190 of file config.c.
References utils_config_get_long().
Referenced by utils_config_get_bool().
Here is the call graph for this function:
Here is the caller graph for this function:| int utils_config_get_long | ( | char * | path, |
| const char * | key, | ||
| long * | value, | ||
| long | def_val ) |
Get value corresponding to key as a long
Will search the path file for a key/value pair matching the key. If during the search any error occurs, 0 will be returned and a message will be printed on stderr. If the value is found it will be converted to a long using strtol() and the result will be assigned to val. If no value is found val will be assigned def_val and 0 will be returned.
| path | Config path. |
| key | c style string string, with the key of interest. |
| value | pointer to allocated array of size value_size. |
| def_val | Default value in case the key is not found. |
Definition at line 206 of file config.c.
References _utils_config_get_str(), and utils_config_write_long().
Referenced by utils_config_get_int(), and utils_config_get_size().
Here is the call graph for this function:
Here is the caller graph for this function:| int utils_config_get_size | ( | char * | path, |
| const char * | key, | ||
| size_t * | value, | ||
| size_t | def_val ) |
Get value corresponding to key as a size_t
Value is retrieved with utils_config_get_long(). If acquired value value is in [SIZE_MAX,0] it is assigned to val and 1 is returned.
Otherwise 0 is returned and val is assigned def_val.
| path | Config path. |
| key | c style string string, with the key of interest. |
| value | pointer to allocated array of size value_size. |
| def_val | Default value in case value was not found/appropriate. |
Definition at line 226 of file config.c.
References utils_config_get_long().
Referenced by _arax_init().
Here is the call graph for this function:
Here is the caller graph for this function:| enum utils_config_source utils_config_get_source | ( | ) |
Return the current configuration source.
Definition at line 242 of file config.c.
References CONFIG_ENV, CONFIG_FILE, and system_env_var().
Referenced by _arax_init(), conf_get(), and conf_set().
Here is the call graph for this function:
Here is the caller graph for this function:| int utils_config_get_str | ( | char * | path, |
| const char * | key, | ||
| char * | value, | ||
| size_t | value_size, | ||
| const char * | def_val ) |
Get value corresponding to key as a string
Will search the path file for a key/value pair matching the key. If the value is not found 0 will be returned. If during the search any error occurs, 0 will be returned and a message will be printed on stderr.
| path | Config path, returned by utils_config_alloc_path. |
| key | c style string string, with the key of interest. |
| value | pointer to allocated array of size value_size. |
| value_size | Size of value array, in bytes. |
| def_val | Default value in case the key is not found. |
Definition at line 164 of file config.c.
References _utils_config_get_str(), and utils_config_write_str().
Referenced by _arax_init(), arax_clean(), and async_meta_init_always().
Here is the call graph for this function:
Here is the caller graph for this function:| void utils_config_write_long | ( | char * | path, |
| const char * | key, | ||
| long | value ) |
Definition at line 85 of file config.c.
References utils_config_write_str().
Referenced by utils_config_get_long().
Here is the call graph for this function:
Here is the caller graph for this function:| void utils_config_write_str | ( | char * | path, |
| const char * | key, | ||
| const char * | value ) |
Definition at line 71 of file config.c.
References conf_get(), and conf_set().
Referenced by utils_config_get_str(), and utils_config_write_long().
Here is the call graph for this function:
Here is the caller graph for this function: