X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl-health.c;h=c20522bd6b458ac446da3093c79ace48a6f286e6;hb=55fb8091d6b72decba72edf53034b05764cc8dac;hp=a3863619f78587cb842ea8e25c510be7c1a986ba;hpb=6c71277b0dc97ce8a4ac6b8d359b4b349c04b658;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.c index a3863619f..c20522bd6 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.c +++ b/src/lib/lttng-ctl/lttng-ctl-health.c @@ -20,11 +20,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define _LGPL_SOURCE #include #include #include #include #include +#include #include #include @@ -68,6 +70,8 @@ const char *sessiond_thread_name[NR_HEALTH_SESSIOND_TYPES] = { [ HEALTH_SESSIOND_TYPE_HT_CLEANUP ] = "Session daemon hash table cleanup", [ HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY ] = "Session daemon application notification manager", [ 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", }; static @@ -84,6 +88,9 @@ const char *relayd_thread_name[NR_HEALTH_RELAYD_TYPES] = { [ HEALTH_RELAYD_TYPE_DISPATCHER ] = "Relay daemon dispatcher", [ HEALTH_RELAYD_TYPE_WORKER ] = "Relay daemon worker", [ HEALTH_RELAYD_TYPE_LISTENER ] = "Relay daemon listener", + [ HEALTH_RELAYD_TYPE_LIVE_DISPATCHER ] = "Relay daemon live dispatcher", + [ HEALTH_RELAYD_TYPE_LIVE_WORKER ] = "Relay daemon live worker", + [ HEALTH_RELAYD_TYPE_LIVE_LISTENER ] = "Relay daemon live listener", }; static @@ -96,7 +103,7 @@ const char **thread_name[NR_HEALTH_COMPONENT] = { /* * 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, @@ -145,10 +152,10 @@ 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; } /* @@ -220,20 +227,30 @@ struct lttng_health * 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) @@ -257,7 +274,7 @@ retry: if (ret) { goto error; } - /* Connect to the sesssion daemon */ + /* Connect to component */ sock = lttcomm_connect_unix_sock(health->health_sock_path); if (sock < 0) { if (tracing_group) { @@ -269,6 +286,7 @@ retry: goto error; } + memset(&msg, 0, sizeof(msg)); msg.cmd = HEALTH_CMD_CHECK; ret = lttcomm_send_unix_sock(sock, (void *)&msg, sizeof(msg));