#define _LGPL_SOURCE
#include "lttng-ctl-helper.hpp"
+#include <common/compiler.hpp>
#include <common/compat/errno.hpp>
#include <common/defaults.hpp>
#include <common/utils.hpp>
char health_sock_path[PATH_MAX];
/* For consumer health only */
enum lttng_health_consumerd consumerd_type;
- struct lttng_health_thread thread[];
+ struct lttng_health_thread thread[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH];
};
static const char *get_sessiond_thread_name(health_type_sessiond type)
* required size (excluding closing null).
*/
home = utils_get_home_dir();
- if (home == NULL) {
+ if (home == nullptr) {
/* Fallback in /tmp */
home = "/tmp";
}
lh = zmalloc<lttng_health>(sizeof(*lh) + sizeof(lh->thread[0]) * nr_threads);
if (!lh) {
- return NULL;
+ return nullptr;
}
lh->component = hc;
lh = lttng_health_create(HEALTH_COMPONENT_SESSIOND, NR_HEALTH_SESSIOND_TYPES);
if (!lh) {
- return NULL;
+ return nullptr;
}
return lh;
}
lh = lttng_health_create(HEALTH_COMPONENT_CONSUMERD, NR_HEALTH_CONSUMERD_TYPES);
if (!lh) {
- return NULL;
+ return nullptr;
}
lh->consumerd_type = consumerd;
return lh;
struct lttng_health *lttng_health_create_relayd(const char *path)
{
int ret;
- struct lttng_health *lh = NULL;
+ struct lttng_health *lh = nullptr;
if (!path) {
goto error;
error:
free(lh);
- return NULL;
+ return nullptr;
}
void lttng_health_destroy(struct lttng_health *lh)
unsigned int nth_thread)
{
if (!health || nth_thread >= health->nr_threads) {
- return NULL;
+ return nullptr;
}
return &health->thread[nth_thread];
}
unsigned int nr;
if (!thread) {
- return NULL;
+ return nullptr;
}
nr = thread - &thread->p->thread[0];
return get_thread_name(thread->p->component, nr);