/*
- * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
- * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * 2013 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
- * 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.
*/
#include <stddef.h>
{
struct ltt_session *sess, *stmp;
const struct ltt_session_list *session_list = session_get_list();
+ struct ust_app *app;
/* Consumer is in an ERROR state. Stop any application update. */
- if (uatomic_read(&ust_consumerd_state) == CONSUMER_ERROR) {
+ if (uatomic_read(&the_ust_consumerd_state) == CONSUMER_ERROR) {
/* Stop the update process since the consumer is dead. */
return;
}
+ rcu_read_lock();
+ LTTNG_ASSERT(app_sock >= 0);
+ app = ust_app_find_by_sock(app_sock);
+ if (app == NULL) {
+ /*
+ * Application can be unregistered before so
+ * this is possible hence simply stopping the
+ * update.
+ */
+ DBG3("UST app update failed to find app sock %d",
+ app_sock);
+ goto unlock_rcu;
+ }
+
+ /* Update all event notifiers for the app. */
+ ust_app_global_update_event_notifier_rules(app);
+
/* For all tracing session(s) */
cds_list_for_each_entry_safe(sess, stmp, &session_list->head, list) {
- struct ust_app *app;
-
if (!session_get(sess)) {
continue;
}
session_lock(sess);
- if (!sess->ust_session) {
+ if (!sess->active || !sess->ust_session ||
+ !sess->ust_session->active) {
goto unlock_session;
}
- rcu_read_lock();
- assert(app_sock >= 0);
- app = ust_app_find_by_sock(app_sock);
- if (app == NULL) {
- /*
- * Application can be unregistered before so
- * this is possible hence simply stopping the
- * update.
- */
- DBG3("UST app update failed to find app sock %d",
- app_sock);
- goto unlock_rcu;
- }
ust_app_global_update(sess->ust_session, app);
- unlock_rcu:
- rcu_read_unlock();
unlock_session:
session_unlock(sess);
session_put(sess);
}
+
+unlock_rcu:
+ rcu_read_unlock();
}
/*
struct lttng_poll_event events;
struct ust_reg_wait_node *wait_node = NULL, *tmp_wait_node;
- assert(wait_queue);
+ LTTNG_ASSERT(wait_queue);
lttng_poll_init(&events);
cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
&wait_queue->head, head) {
- assert(wait_node->app);
+ LTTNG_ASSERT(wait_node->app);
ret = lttng_poll_add(&events, wait_node->app->sock,
LPOLLHUP | LPOLLERR);
if (ret < 0) {
uint32_t revents = LTTNG_POLL_GETEV(&events, i);
int pollfd = LTTNG_POLL_GETFD(&events, i);
- if (!revents) {
- /* No activity for this FD (poll implementation). */
- continue;
- }
-
cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
&wait_queue->head, head) {
if (pollfd == wait_node->app->sock &&
rcu_register_thread();
- health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
+ health_register(the_health_sessiond,
+ HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
if (testpoint(sessiond_thread_app_reg_dispatch)) {
goto error_testpoint;
ust_cmd->sock, ust_cmd->reg_msg.name,
ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor);
- if (ust_cmd->reg_msg.type == USTCTL_SOCKET_CMD) {
+ if (ust_cmd->reg_msg.type == LTTNG_UST_CTL_SOCKET_CMD) {
wait_node = zmalloc(sizeof(*wait_node));
if (!wait_node) {
PERROR("zmalloc wait_node dispatch");
}
lttng_fd_put(LTTNG_FD_APPS, 1);
free(ust_cmd);
+ ust_cmd = NULL;
goto error;
}
CDS_INIT_LIST_HEAD(&wait_node->head);
}
lttng_fd_put(LTTNG_FD_APPS, 1);
free(wait_node);
+ wait_node = NULL;
free(ust_cmd);
+ ust_cmd = NULL;
continue;
}
/*
wait_queue.count++;
free(ust_cmd);
+ ust_cmd = NULL;
/*
* We have to continue here since we don't have the notify
* socket and the application MUST be added to the hash table
wait_queue.count--;
app = wait_node->app;
free(wait_node);
+ wait_node = NULL;
DBG3("UST app notify socket %d is set", ust_cmd->sock);
break;
}
lttng_fd_put(LTTNG_FD_APPS, 1);
}
free(ust_cmd);
+ ust_cmd = NULL;
}
if (app) {
/* Set app version. This call will print an error if needed. */
(void) ust_app_version(app);
+ (void) ust_app_setup_event_notifier_group(app);
+
/* Send notify socket through the notify pipe. */
ret = send_socket_to_thread(
notifiers->apps_cmd_notify_pipe_write_fd,
health_error();
ERR("Health error occurred in %s", __func__);
}
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
rcu_unregister_thread();
return NULL;
}