X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl-health.c;h=955b1fcd00cb5e617d0756c95db8267032b83897;hp=01d430d0d4c49fc390b4c6ffa77ddb92ea2ed575;hb=657d1bf105996bf8f6e13af697fb1112afa61b28;hpb=73d8fe3ef7055233c91caae38fce49405435b064 diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.c index 01d430d0d..955b1fcd0 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.c +++ b/src/lib/lttng-ctl/lttng-ctl-health.c @@ -6,27 +6,15 @@ * Copyright (C) 2011 David Goulet * Copyright (C) 2013 Mathieu Desnoyers * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include #include #include -#include #include #include @@ -35,6 +23,7 @@ #include #include #include +#include #include "lttng-ctl-helper.h" @@ -71,6 +60,9 @@ 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", + [ HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR ] = "Session daemon trigger action executor", }; static @@ -102,7 +94,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, @@ -151,10 +143,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; } /* @@ -226,20 +218,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) @@ -304,7 +306,7 @@ close_error: int closeret; closeret = close(sock); - assert(!closeret); + LTTNG_ASSERT(!closeret); } error: