#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
-#include <errno.h>
#include <string.h>
#include <lttng/health-internal.h>
#include <bin/lttng-relayd/health-relayd.h>
#include <common/defaults.h>
#include <common/utils.h>
+#include <common/compat/errno.h>
#include "lttng-ctl-helper.h"
[ HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH ] = "Session daemon application registration dispatcher",
[ HEALTH_SESSIOND_TYPE_ROTATION ] = "Session daemon rotation manager",
[ HEALTH_SESSIOND_TYPE_TIMER ] = "Session daemon timer manager",
+ [ HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR ] = "Session daemon trigger action executor",
};
static
/*
* Set health socket path.
*
- * Returns 0 on success or -ENOMEM.
+ * Returns 0 on success or a negative errno.
*/
static
int set_health_socket_path(struct lttng_health *lh,
uid = getuid();
if (uid == 0 || tracing_group) {
- lttng_ctl_copy_string(lh->health_sock_path,
+ ret = lttng_strncpy(lh->health_sock_path,
global_str,
sizeof(lh->health_sock_path));
- return 0;
+ return ret == 0 ? 0 : -EINVAL;
}
/*
struct lttng_health *lttng_health_create_relayd(const char *path)
{
- struct lttng_health *lh;
+ int ret;
+ struct lttng_health *lh = NULL;
if (!path) {
- return NULL;
+ goto error;
}
lh = lttng_health_create(HEALTH_COMPONENT_RELAYD,
NR_HEALTH_RELAYD_TYPES);
if (!lh) {
- return NULL;
+ goto error;
}
- lttng_ctl_copy_string(lh->health_sock_path, path,
- sizeof(lh->health_sock_path));
+
+ ret = lttng_strncpy(lh->health_sock_path, path,
+ sizeof(lh->health_sock_path));
+ if (ret) {
+ goto error;
+ }
+
return lh;
+
+error:
+ free(lh);
+ return NULL;
}
void lttng_health_destroy(struct lttng_health *lh)
int closeret;
closeret = close(sock);
- assert(!closeret);
+ LTTNG_ASSERT(!closeret);
}
error: