X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fconfig.c;h=783e784b2481b4e6ed04e5b247678c0649abc4ba;hb=e83a8bdbfb6a9542f40d62ead334f249baf05255;hp=a4b59ff0865e559e3f2dea86bbc8c3cc022bcec2;hpb=d324faf7d618feb0b209c8c7da497b244fa7046a;p=lttng-tools.git diff --git a/src/common/config/config.c b/src/common/config/config.c index a4b59ff08..783e784b2 100644 --- a/src/common/config/config.c +++ b/src/common/config/config.c @@ -118,6 +118,8 @@ const char * const config_element_max_size = "max_size"; const char * const config_element_pid = "pid"; const char * const config_element_pids = "pids"; const char * const config_element_shared_memory_path = "shared_memory_path"; +const char * const config_element_pid_tracker = "pid_tracker"; +const char * const config_element_trackers = "trackers"; const char * const config_domain_type_kernel = "KERNEL"; const char * const config_domain_type_ust = "UST"; @@ -2495,6 +2497,23 @@ end: return ret; } +/* Allocate dirent as recommended by READDIR(3), NOTES on readdir_r */ +static +struct dirent *alloc_dirent(const char *path) +{ + size_t len; + long name_max; + struct dirent *entry; + + name_max = pathconf(path, _PC_NAME_MAX); + if (name_max == -1) { + name_max = PATH_MAX; + } + len = offsetof(struct dirent, d_name) + name_max + 1; + entry = zmalloc(len); + return entry; +} + static int load_session_from_path(const char *path, const char *session_name, struct session_config_validation_ctx *validation_ctx, int override) @@ -2530,7 +2549,7 @@ int load_session_from_path(const char *path, const char *session_name, goto end; } - entry = zmalloc(sizeof(*entry)); + entry = alloc_dirent(path); if (!entry) { ret = -LTTNG_ERR_NOMEM; goto end;