Refactor: lttng-ctl: follow terminology of the tracker documentation
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index 823de94785c1a6d6964ed9b165f47d4690d59741..ea3f860398d3ca35edb16e515f55f14cbebcdcf7 100644 (file)
@@ -1,19 +1,9 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
- * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2016 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.
  */
 
 #define _LGPL_SOURCE
 #include "notification-thread-commands.h"
 #include "rotate.h"
 
+struct lttng_ht *ust_app_ht;
+struct lttng_ht *ust_app_ht_by_sock;
+struct lttng_ht *ust_app_ht_by_notify_sock;
+
 static
 int ust_app_flush_app_session(struct ust_app *app, struct ust_app_session *ua_sess);
 
@@ -1025,7 +1019,7 @@ error_free:
  * Alloc new UST app channel.
  */
 static
-struct ust_app_channel *alloc_ust_app_channel(char *name,
+struct ust_app_channel *alloc_ust_app_channel(const char *name,
                struct ust_app_session *ua_sess,
                struct lttng_ust_channel_attr *attr)
 {
@@ -4347,6 +4341,11 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                goto end;
        }
 
+       if (ua_sess->enabled) {
+               pthread_mutex_unlock(&ua_sess->lock);
+               goto end;
+       }
+
        /* Upon restart, we skip the setup, already done */
        if (ua_sess->started) {
                goto skip_setup;
@@ -4387,6 +4386,7 @@ skip_setup:
 
        /* Indicate that the session has been started once */
        ua_sess->started = 1;
+       ua_sess->enabled = 1;
 
        pthread_mutex_unlock(&ua_sess->lock);
 
@@ -4476,6 +4476,7 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
        }
 
        health_code_update();
+       ua_sess->enabled = 0;
 
        /* Quiescent wait after stopping trace */
        pthread_mutex_lock(&app->sock_lock);
@@ -5115,11 +5116,14 @@ void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app)
        if (!app->compatible) {
                return;
        }
-       if (trace_ust_id_tracker_lookup(LTTNG_TRACKER_VPID, usess, app->pid) &&
+       if (trace_ust_id_tracker_lookup(LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID,
+                           usess, app->pid) &&
                        trace_ust_id_tracker_lookup(
-                                       LTTNG_TRACKER_VUID, usess, app->uid) &&
+                                       LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID,
+                                       usess, app->uid) &&
                        trace_ust_id_tracker_lookup(
-                                       LTTNG_TRACKER_VGID, usess, app->gid)) {
+                                       LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID,
+                                       usess, app->gid)) {
                /*
                 * Synchronize the application's internal tracing configuration
                 * and start tracing.
This page took 0.025609 seconds and 4 git commands to generate.