X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-relayd%2Flive.c;h=06cfa5c7bb64da3321af4c251bf3f2a50580091e;hb=a2814ea7573bf5edd5323d6f89c48ff14105db69;hp=eed82a6c86512b6acea63bf5a71704c73ae98b1f;hpb=8bb66c3cd60938352927ee865759433387324250;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index eed82a6c8..06cfa5c7b 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1,20 +1,10 @@ /* - * Copyright (C) 2013 - Julien Desfossez - * David Goulet - * 2015 - Mathieu Desnoyers + * Copyright (C) 2013 Julien Desfossez + * Copyright (C) 2013 David Goulet + * Copyright (C) 2015 Mathieu Desnoyers * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -449,6 +439,10 @@ int create_named_thread_poll_set(struct lttng_poll_event *events, ret = fd_tracker_util_poll_create(the_fd_tracker, name, events, 1, LTTNG_CLOEXEC); + if (ret) { + PERROR("Failed to create \"%s\" poll file descriptor", name); + goto error; + } /* Add quit pipe */ ret = lttng_poll_add(events, thread_quit_pipe[0], LPOLLIN | LPOLLERR); @@ -571,7 +565,11 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name) ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock_fd, (const char **) (formated_name ? &formated_name : NULL), 1, create_sock, sock); - free(formated_name); + if (ret) { + PERROR("Failed to create \"%s\" socket", + formated_name ?: "Unknown"); + goto error; + } DBG("Listening on %s socket %d", name, sock->fd); ret = sock->ops->bind(sock); @@ -586,12 +584,14 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name) } + free(formated_name); return sock; error: if (sock) { lttcomm_destroy_sock(sock); } + free(formated_name); return NULL; } @@ -608,6 +608,7 @@ void *thread_listener(void *data) DBG("[thread] Relay live listener started"); + rcu_register_thread(); health_register(health_relayd, HEALTH_RELAYD_TYPE_LIVE_LISTENER); health_code_update(); @@ -749,6 +750,7 @@ error_sock_control: DBG("Live viewer listener thread exited with error"); } health_unregister(health_relayd); + rcu_unregister_thread(); DBG("Live viewer listener thread cleanup complete"); if (lttng_relay_stop_threads()) { ERR("Error stopping threads");