Clean-up: sessiond: prepend `the_` to global variable names
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 31 Mar 2021 14:36:33 +0000 (10:36 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 13 Apr 2021 20:21:12 +0000 (16:21 -0400)
This avoids name clashes between global variables and local variables or
function parameters (notification_thread_handle, for example). This is a
step towards enabling -Wshadow.

This also helps readability, in my opinion, as it helps quickly spot
that some code is using a global variable.

Change-Id: Ib0e35ad7efcc54fa88e1900cab3388b98a06b8d9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
34 files changed:
src/bin/lttng-sessiond/action-executor.c
src/bin/lttng-sessiond/agent-thread.c
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/agent.h
src/bin/lttng-sessiond/channel.c
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/dispatch.c
src/bin/lttng-sessiond/globals.c
src/bin/lttng-sessiond/health-sessiond.h
src/bin/lttng-sessiond/health.c
src/bin/lttng-sessiond/ht-cleanup.c
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/lttng-sessiond.h
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/manage-apps.c
src/bin/lttng-sessiond/manage-consumer.c
src/bin/lttng-sessiond/manage-kernel.c
src/bin/lttng-sessiond/modprobe.c
src/bin/lttng-sessiond/notification-thread.c
src/bin/lttng-sessiond/notify-apps.c
src/bin/lttng-sessiond/process-utils.c
src/bin/lttng-sessiond/register.c
src/bin/lttng-sessiond/rotation-thread.c
src/bin/lttng-sessiond/session.c
src/bin/lttng-sessiond/timer.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/bin/lttng-sessiond/ust-registry.c
src/bin/lttng-sessiond/utils.c
tests/unit/test_session.c

index 86bada257634b90a8d0ebd7dc225732602b12e48..e5e72b09f2bd88b789d3993212e6b95c1cdeea44 100644 (file)
@@ -539,7 +539,8 @@ static void *action_executor_thread(void *_data)
 
        assert(executor);
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
+       health_register(the_health_sessiond,
+                       HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
 
        rcu_register_thread();
        rcu_thread_online();
@@ -592,7 +593,7 @@ static void *action_executor_thread(void *_data)
 
        rcu_thread_offline();
        rcu_unregister_thread();
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
 
        return NULL;
 }
index 2015498ff59a178bf76e26eb5d092e1e3a748e87..720639efd0b50d0433992c22b113a6be8693b439 100644 (file)
@@ -90,8 +90,8 @@ static void update_agent_app(const struct agent_app *app)
         * We are protected against the addition of new events by the session
         * list lock being held.
         */
-       cds_lfht_for_each_entry (trigger_agents_ht_by_domain->ht, &iter.iter,
-                       trigger_agent, node.node) {
+       cds_lfht_for_each_entry(the_trigger_agents_ht_by_domain->ht,
+                       &iter.iter, trigger_agent, node.node) {
                agent_update(trigger_agent, app);
        }
        rcu_read_unlock();
@@ -114,8 +114,8 @@ static struct lttcomm_sock *init_tcp_socket(void)
         */
        ret = uri_parse(default_reg_uri, &uri);
        assert(ret);
-       assert(config.agent_tcp_port.begin > 0);
-       uri->port = config.agent_tcp_port.begin;
+       assert(the_config.agent_tcp_port.begin > 0);
+       uri->port = the_config.agent_tcp_port.begin;
 
        sock = lttcomm_alloc_sock_from_uri(uri);
        uri_free(uri);
@@ -129,8 +129,8 @@ static struct lttcomm_sock *init_tcp_socket(void)
                goto error;
        }
 
-       for (port = config.agent_tcp_port.begin;
-                       port <= config.agent_tcp_port.end; port++) {
+       for (port = the_config.agent_tcp_port.begin;
+                       port <= the_config.agent_tcp_port.end; port++) {
                ret = lttcomm_sock_set_port(sock, (uint16_t) port);
                if (ret) {
                        ERR("[agent-thread] Failed to set port %u on socket",
@@ -154,16 +154,17 @@ static struct lttcomm_sock *init_tcp_socket(void)
        }
 
        if (!bind_succeeded) {
-               if (config.agent_tcp_port.begin == config.agent_tcp_port.end) {
+               if (the_config.agent_tcp_port.begin ==
+                               the_config.agent_tcp_port.end) {
                        WARN("Another process is already using the agent port %i. "
-                                       "Agent support will be deactivated.",
-                                       config.agent_tcp_port.begin);
+                            "Agent support will be deactivated.",
+                                       the_config.agent_tcp_port.begin);
                        goto error;
                } else {
                        WARN("All ports in the range [%i, %i] are already in use. "
-                                       "Agent support will be deactivated.",
-                                       config.agent_tcp_port.begin,
-                                       config.agent_tcp_port.end);
+                            "Agent support will be deactivated.",
+                                       the_config.agent_tcp_port.begin,
+                                       the_config.agent_tcp_port.end);
                        goto error;
                }
        }
@@ -330,8 +331,8 @@ bool agent_tracing_is_enabled(void)
  */
 static int write_agent_port(uint16_t port)
 {
-       return utils_create_pid_file((pid_t) port,
-                       config.agent_port_file_path.value);
+       return utils_create_pid_file(
+                       (pid_t) port, the_config.agent_port_file_path.value);
 }
 
 static
@@ -368,7 +369,7 @@ static void *thread_agent_management(void *data)
        rcu_thread_online();
 
        /* Agent initialization call MUST be called before starting the thread. */
-       assert(agent_apps_ht_by_sock);
+       assert(the_agent_apps_ht_by_sock);
 
        /* Create pollset with size 2, quit pipe and registration socket. */
        ret = lttng_poll_create(&events, 2, LTTNG_CLOEXEC);
index b726e0184124a3732641611694031116f54f92c7..10c2d7c85fd3085b186160663d59911935a7285c 100644 (file)
@@ -677,7 +677,7 @@ int agent_enable_event(struct agent_event *event,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, app,
+       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
                        node.node) {
                if (app->domain != domain) {
                        continue;
@@ -752,7 +752,7 @@ int agent_enable_context(const struct lttng_event_context *ctx,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, app,
+       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
                        node.node) {
                struct agent_app_ctx *agent_ctx;
 
@@ -812,7 +812,7 @@ int agent_disable_event(struct agent_event *event,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, app,
+       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
                        node.node) {
                if (app->domain != domain) {
                        continue;
@@ -852,7 +852,7 @@ static int disable_context(struct agent_app_ctx *ctx,
        rcu_read_lock();
        DBG2("Disabling agent application context %s:%s",
                        ctx->provider_name, ctx->ctx_name);
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, app,
+       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
                        node.node) {
                if (app->domain != domain) {
                        continue;
@@ -896,7 +896,7 @@ int agent_list_events(struct lttng_event **events,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, app,
+       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
                        node.node) {
                ssize_t nb_ev;
                struct lttng_event *agent_events;
@@ -994,7 +994,8 @@ struct agent_app *agent_find_app_by_sock(int sock)
 
        assert(sock >= 0);
 
-       lttng_ht_lookup(agent_apps_ht_by_sock, (void *)((unsigned long) sock), &iter);
+       lttng_ht_lookup(the_agent_apps_ht_by_sock,
+                       (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                goto error;
@@ -1017,7 +1018,7 @@ void agent_add_app(struct agent_app *app)
        assert(app);
 
        DBG3("Agent adding app sock: %d and pid: %d to ht", app->sock->fd, app->pid);
-       lttng_ht_add_unique_ulong(agent_apps_ht_by_sock, &app->node);
+       lttng_ht_add_unique_ulong(the_agent_apps_ht_by_sock, &app->node);
 }
 
 /*
@@ -1035,7 +1036,7 @@ void agent_delete_app(struct agent_app *app)
        DBG3("Agent deleting app pid: %d and sock: %d", app->pid, app->sock->fd);
 
        iter.iter.node = &app->node.node;
-       ret = lttng_ht_del(agent_apps_ht_by_sock, &iter);
+       ret = lttng_ht_del(the_agent_apps_ht_by_sock, &iter);
        assert(!ret);
 }
 
@@ -1423,8 +1424,8 @@ void agent_destroy(struct agent *agt)
  */
 int agent_app_ht_alloc(void)
 {
-       agent_apps_ht_by_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
-       return agent_apps_ht_by_sock ? 0 : -1;
+       the_agent_apps_ht_by_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
+       return the_agent_apps_ht_by_sock ? 0 : -1;
 }
 
 /*
@@ -1461,11 +1462,12 @@ void agent_app_ht_clean(void)
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
 
-       if (!agent_apps_ht_by_sock) {
+       if (!the_agent_apps_ht_by_sock) {
                return;
        }
        rcu_read_lock();
-       cds_lfht_for_each_entry(agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry(
+                       the_agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
                struct agent_app *app;
 
                app = caa_container_of(node, struct agent_app, node);
@@ -1473,7 +1475,7 @@ void agent_app_ht_clean(void)
        }
        rcu_read_unlock();
 
-       lttng_ht_destroy(agent_apps_ht_by_sock);
+       lttng_ht_destroy(the_agent_apps_ht_by_sock);
 }
 
 /*
@@ -1534,8 +1536,8 @@ void agent_update(const struct agent *agt, const struct agent_app *app)
  */
 int agent_by_event_notifier_domain_ht_create(void)
 {
-       trigger_agents_ht_by_domain = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
-       return trigger_agents_ht_by_domain ? 0 : -1;
+       the_trigger_agents_ht_by_domain = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
+       return the_trigger_agents_ht_by_domain ? 0 : -1;
 }
 
 /*
@@ -1546,24 +1548,24 @@ void agent_by_event_notifier_domain_ht_destroy(void)
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
-       if (!trigger_agents_ht_by_domain) {
+       if (!the_trigger_agents_ht_by_domain) {
                return;
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry (trigger_agents_ht_by_domain->ht, &iter.iter,
-                       node, node) {
+       cds_lfht_for_each_entry(the_trigger_agents_ht_by_domain->ht,
+                       &iter.iter, node, node) {
                struct agent *agent =
                                caa_container_of(node, struct agent, node);
                const int ret = lttng_ht_del(
-                               trigger_agents_ht_by_domain, &iter);
+                               the_trigger_agents_ht_by_domain, &iter);
 
                assert(ret == 0);
                agent_destroy(agent);
        }
 
        rcu_read_unlock();
-       lttng_ht_destroy(trigger_agents_ht_by_domain);
+       lttng_ht_destroy(the_trigger_agents_ht_by_domain);
 }
 
 struct agent *agent_find_by_event_notifier_domain(
@@ -1574,12 +1576,12 @@ struct agent *agent_find_by_event_notifier_domain(
        struct lttng_ht_iter iter;
        const uint64_t key = (uint64_t) domain_type;
 
-       assert(trigger_agents_ht_by_domain);
+       assert(the_trigger_agents_ht_by_domain);
 
        DBG3("Per-event notifier domain agent lookup for domain '%s'",
                        lttng_domain_type_str(domain_type));
 
-       lttng_ht_lookup(trigger_agents_ht_by_domain, &key, &iter);
+       lttng_ht_lookup(the_trigger_agents_ht_by_domain, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (!node) {
                goto end;
index c88af21c5a13e53536a248d87be6495905ff452f..b0a4fa863c3e0fca98a688bdd98d840cd25d760b 100644 (file)
  * Hash table that contains the agent app created upon registration indexed by
  * socket. Global to the session daemon.
  */
-extern struct lttng_ht *agent_apps_ht_by_sock;
+extern struct lttng_ht *the_agent_apps_ht_by_sock;
 
 /*
  * Hash table that contains the trigger agents by domain */
-extern struct lttng_ht *trigger_agents_ht_by_domain;
+extern struct lttng_ht *the_trigger_agents_ht_by_domain;
 
 struct agent_ht_key {
        const char *name;
index 049c784b379102b36e2b362cc5ab69e05b47f78b..2beb4f711e6a60adbcafec0f9ab6c269de805234 100644 (file)
@@ -397,7 +397,7 @@ int channel_ust_create(struct ltt_ust_session *usess,
        /*
         * Invalid subbuffer size if it's lower then the page size.
         */
-       if (attr->attr.subbuf_size < page_size) {
+       if (attr->attr.subbuf_size < the_page_size) {
                ret = LTTNG_ERR_INVALID;
                goto error;
        }
index 770a2ee4464f0b6962b9bd731095823b1feb9021..c9ff2ec70fa635ff6de188ef12bd70361be6e512 100644 (file)
@@ -208,7 +208,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                /*
                 * Exec consumerd.
                 */
-               if (config.verbose_consumer) {
+               if (the_config.verbose_consumer) {
                        verbosity = "--verbose";
                } else if (lttng_opt_quiet) {
                        verbosity = "--quiet";
@@ -224,35 +224,37 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                         * fallback on the 32-bit one,
                         */
                        DBG3("Looking for a kernel consumer at these locations:");
-                       DBG3("  1) %s", config.consumerd64_bin_path.value ? : "NULL");
+                       DBG3("  1) %s", the_config.consumerd64_bin_path.value ? : "NULL");
                        DBG3("  2) %s/%s", INSTALL_BIN_PATH, DEFAULT_CONSUMERD_FILE);
-                       DBG3("  3) %s", config.consumerd32_bin_path.value ? : "NULL");
-                       if (stat(config.consumerd64_bin_path.value, &st) == 0) {
+                       DBG3("  3) %s", the_config.consumerd32_bin_path.value ? : "NULL");
+                       if (stat(the_config.consumerd64_bin_path.value, &st) == 0) {
                                DBG3("Found location #1");
-                               consumer_to_use = config.consumerd64_bin_path.value;
+                               consumer_to_use = the_config.consumerd64_bin_path.value;
                        } else if (stat(INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE, &st) == 0) {
                                DBG3("Found location #2");
                                consumer_to_use = INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE;
-                       } else if (config.consumerd32_bin_path.value &&
-                                       stat(config.consumerd32_bin_path.value, &st) == 0) {
+                       } else if (the_config.consumerd32_bin_path.value &&
+                                       stat(the_config.consumerd32_bin_path.value, &st) == 0) {
                                DBG3("Found location #3");
-                               consumer_to_use = config.consumerd32_bin_path.value;
+                               consumer_to_use = the_config.consumerd32_bin_path.value;
                        } else {
                                DBG("Could not find any valid consumerd executable");
                                ret = -EINVAL;
                                goto error;
                        }
                        DBG("Using kernel consumer at: %s",  consumer_to_use);
-                       (void) execl(consumer_to_use,
-                               "lttng-consumerd", verbosity, "-k",
-                               "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
-                               "--consumerd-err-sock", consumer_data->err_unix_sock_path,
-                               "--group", config.tracing_group_name.value,
-                               NULL);
+                       (void) execl(consumer_to_use, "lttng-consumerd",
+                                       verbosity, "-k", "--consumerd-cmd-sock",
+                                       consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock",
+                                       consumer_data->err_unix_sock_path,
+                                       "--group",
+                                       the_config.tracing_group_name.value,
+                                       NULL);
                        break;
                case LTTNG_CONSUMER64_UST:
                {
-                       if (config.consumerd64_lib_dir.value) {
+                       if (the_config.consumerd64_lib_dir.value) {
                                const char *tmp;
                                size_t tmplen;
                                char *tmpnew;
@@ -261,13 +263,13 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen(config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(the_config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
                                tmpnew = zmalloc(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
                                        goto error;
                                }
-                               strcat(tmpnew, config.consumerd64_lib_dir.value);
+                               strcat(tmpnew, the_config.consumerd64_lib_dir.value);
                                if (tmp[0] != '\0') {
                                        strcat(tmpnew, ":");
                                        strcat(tmpnew, tmp);
@@ -279,17 +281,22 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        goto error;
                                }
                        }
-                       DBG("Using 64-bit UST consumer at: %s",  config.consumerd64_bin_path.value);
-                       (void) execl(config.consumerd64_bin_path.value, "lttng-consumerd", verbosity, "-u",
-                                       "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
-                                       "--consumerd-err-sock", consumer_data->err_unix_sock_path,
-                                       "--group", config.tracing_group_name.value,
+                       DBG("Using 64-bit UST consumer at: %s",
+                                       the_config.consumerd64_bin_path.value);
+                       (void) execl(the_config.consumerd64_bin_path.value,
+                                       "lttng-consumerd", verbosity, "-u",
+                                       "--consumerd-cmd-sock",
+                                       consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock",
+                                       consumer_data->err_unix_sock_path,
+                                       "--group",
+                                       the_config.tracing_group_name.value,
                                        NULL);
                        break;
                }
                case LTTNG_CONSUMER32_UST:
                {
-                       if (config.consumerd32_lib_dir.value) {
+                       if (the_config.consumerd32_lib_dir.value) {
                                const char *tmp;
                                size_t tmplen;
                                char *tmpnew;
@@ -298,13 +305,13 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen(config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(the_config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
                                tmpnew = zmalloc(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
                                        goto error;
                                }
-                               strcat(tmpnew, config.consumerd32_lib_dir.value);
+                               strcat(tmpnew, the_config.consumerd32_lib_dir.value);
                                if (tmp[0] != '\0') {
                                        strcat(tmpnew, ":");
                                        strcat(tmpnew, tmp);
@@ -316,11 +323,16 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        goto error;
                                }
                        }
-                       DBG("Using 32-bit UST consumer at: %s",  config.consumerd32_bin_path.value);
-                       (void) execl(config.consumerd32_bin_path.value, "lttng-consumerd", verbosity, "-u",
-                                       "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
-                                       "--consumerd-err-sock", consumer_data->err_unix_sock_path,
-                                       "--group", config.tracing_group_name.value,
+                       DBG("Using 32-bit UST consumer at: %s",
+                                       the_config.consumerd32_bin_path.value);
+                       (void) execl(the_config.consumerd32_bin_path.value,
+                                       "lttng-consumerd", verbosity, "-u",
+                                       "--consumerd-cmd-sock",
+                                       consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock",
+                                       consumer_data->err_unix_sock_path,
+                                       "--group",
+                                       the_config.tracing_group_name.value,
                                        NULL);
                        break;
                }
@@ -784,7 +796,8 @@ static int check_rotate_compatible(void)
 {
        int ret = 1;
 
-       if (kernel_tracer_version.major != 2 || kernel_tracer_version.minor < 11) {
+       if (the_kernel_tracer_version.major != 2 ||
+                       the_kernel_tracer_version.minor < 11) {
                DBG("Kernel tracer version is not compatible with the rotation feature");
                ret = 0;
        }
@@ -893,8 +906,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                break;
        }
 
-       if (config.no_kernel && need_domain
-                       && cmd_ctx->lsm.domain.type == LTTNG_DOMAIN_KERNEL) {
+       if (the_config.no_kernel && need_domain &&
+                       cmd_ctx->lsm.domain.type == LTTNG_DOMAIN_KERNEL) {
                if (!is_root) {
                        ret = LTTNG_ERR_NEED_ROOT_SESSIOND;
                } else {
@@ -905,13 +918,13 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
 
        /* Deny register consumer if we already have a spawned consumer. */
        if (cmd_ctx->lsm.cmd_type == LTTNG_REGISTER_CONSUMER) {
-               pthread_mutex_lock(&kconsumer_data.pid_mutex);
-               if (kconsumer_data.pid > 0) {
+               pthread_mutex_lock(&the_kconsumer_data.pid_mutex);
+               if (the_kconsumer_data.pid > 0) {
                        ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
-                       pthread_mutex_unlock(&kconsumer_data.pid_mutex);
+                       pthread_mutex_unlock(&the_kconsumer_data.pid_mutex);
                        goto error;
                }
-               pthread_mutex_unlock(&kconsumer_data.pid_mutex);
+               pthread_mutex_unlock(&the_kconsumer_data.pid_mutex);
        }
 
        /*
@@ -1034,8 +1047,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                }
 
                /* Consumer is in an ERROR state. Report back to client */
-               if (need_consumerd && uatomic_read(&kernel_consumerd_state) ==
-                                                     CONSUMER_ERROR) {
+               if (need_consumerd && uatomic_read(&the_kernel_consumerd_state) ==
+                                               CONSUMER_ERROR) {
                        ret = LTTNG_ERR_NO_KERNCONSUMERD;
                        goto error;
                }
@@ -1051,25 +1064,25 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                        }
 
                        /* Start the kernel consumer daemon */
-                       pthread_mutex_lock(&kconsumer_data.pid_mutex);
-                       if (kconsumer_data.pid == 0 &&
+                       pthread_mutex_lock(&the_kconsumer_data.pid_mutex);
+                       if (the_kconsumer_data.pid == 0 &&
                                        cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) {
-                               pthread_mutex_unlock(&kconsumer_data.pid_mutex);
-                               ret = start_consumerd(&kconsumer_data);
+                               pthread_mutex_unlock(&the_kconsumer_data.pid_mutex);
+                               ret = start_consumerd(&the_kconsumer_data);
                                if (ret < 0) {
                                        ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
                                        goto error;
                                }
-                               uatomic_set(&kernel_consumerd_state, CONSUMER_STARTED);
+                               uatomic_set(&the_kernel_consumerd_state, CONSUMER_STARTED);
                        } else {
-                               pthread_mutex_unlock(&kconsumer_data.pid_mutex);
+                               pthread_mutex_unlock(&the_kconsumer_data.pid_mutex);
                        }
 
                        /*
                         * The consumer was just spawned so we need to add the socket to
                         * the consumer output of the session if exist.
                         */
-                       ret = consumer_create_socket(&kconsumer_data,
+                       ret = consumer_create_socket(&the_kconsumer_data,
                                        cmd_ctx->session->kernel_session->consumer);
                        if (ret < 0) {
                                goto error;
@@ -1093,8 +1106,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                }
 
                /* Consumer is in an ERROR state. Report back to client */
-               if (need_consumerd && uatomic_read(&ust_consumerd_state) ==
-                                                     CONSUMER_ERROR) {
+               if (need_consumerd &&
+                               uatomic_read(&the_ust_consumerd_state) ==
+                                               CONSUMER_ERROR) {
                        ret = LTTNG_ERR_NO_USTCONSUMERD;
                        goto error;
                }
@@ -1111,58 +1125,58 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
 
                        /* Start the UST consumer daemons */
                        /* 64-bit */
-                       pthread_mutex_lock(&ustconsumer64_data.pid_mutex);
-                       if (config.consumerd64_bin_path.value &&
-                                       ustconsumer64_data.pid == 0 &&
+                       pthread_mutex_lock(&the_ustconsumer64_data.pid_mutex);
+                       if (the_config.consumerd64_bin_path.value &&
+                                       the_ustconsumer64_data.pid == 0 &&
                                        cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) {
-                               pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
-                               ret = start_consumerd(&ustconsumer64_data);
+                               pthread_mutex_unlock(&the_ustconsumer64_data.pid_mutex);
+                               ret = start_consumerd(&the_ustconsumer64_data);
                                if (ret < 0) {
                                        ret = LTTNG_ERR_UST_CONSUMER64_FAIL;
-                                       uatomic_set(&ust_consumerd64_fd, -EINVAL);
+                                       uatomic_set(&the_ust_consumerd64_fd, -EINVAL);
                                        goto error;
                                }
 
-                               uatomic_set(&ust_consumerd64_fd, ustconsumer64_data.cmd_sock);
-                               uatomic_set(&ust_consumerd_state, CONSUMER_STARTED);
+                               uatomic_set(&the_ust_consumerd64_fd, the_ustconsumer64_data.cmd_sock);
+                               uatomic_set(&the_ust_consumerd_state, CONSUMER_STARTED);
                        } else {
-                               pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
+                               pthread_mutex_unlock(&the_ustconsumer64_data.pid_mutex);
                        }
 
                        /*
                         * Setup socket for consumer 64 bit. No need for atomic access
                         * since it was set above and can ONLY be set in this thread.
                         */
-                       ret = consumer_create_socket(&ustconsumer64_data,
+                       ret = consumer_create_socket(&the_ustconsumer64_data,
                                        cmd_ctx->session->ust_session->consumer);
                        if (ret < 0) {
                                goto error;
                        }
 
                        /* 32-bit */
-                       pthread_mutex_lock(&ustconsumer32_data.pid_mutex);
-                       if (config.consumerd32_bin_path.value &&
-                                       ustconsumer32_data.pid == 0 &&
+                       pthread_mutex_lock(&the_ustconsumer32_data.pid_mutex);
+                       if (the_config.consumerd32_bin_path.value &&
+                                       the_ustconsumer32_data.pid == 0 &&
                                        cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) {
-                               pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
-                               ret = start_consumerd(&ustconsumer32_data);
+                               pthread_mutex_unlock(&the_ustconsumer32_data.pid_mutex);
+                               ret = start_consumerd(&the_ustconsumer32_data);
                                if (ret < 0) {
                                        ret = LTTNG_ERR_UST_CONSUMER32_FAIL;
-                                       uatomic_set(&ust_consumerd32_fd, -EINVAL);
+                                       uatomic_set(&the_ust_consumerd32_fd, -EINVAL);
                                        goto error;
                                }
 
-                               uatomic_set(&ust_consumerd32_fd, ustconsumer32_data.cmd_sock);
-                               uatomic_set(&ust_consumerd_state, CONSUMER_STARTED);
+                               uatomic_set(&the_ust_consumerd32_fd, the_ustconsumer32_data.cmd_sock);
+                               uatomic_set(&the_ust_consumerd_state, CONSUMER_STARTED);
                        } else {
-                               pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
+                               pthread_mutex_unlock(&the_ustconsumer32_data.pid_mutex);
                        }
 
                        /*
                         * Setup socket for consumer 32 bit. No need for atomic access
                         * since it was set above and can ONLY be set in this thread.
                         */
-                       ret = consumer_create_socket(&ustconsumer32_data,
+                       ret = consumer_create_socket(&the_ustconsumer32_data,
                                        cmd_ctx->session->ust_session->consumer);
                        if (ret < 0) {
                                goto error;
@@ -1185,13 +1199,13 @@ skip_domain:
                case LTTNG_DOMAIN_LOG4J:
                case LTTNG_DOMAIN_PYTHON:
                case LTTNG_DOMAIN_UST:
-                       if (uatomic_read(&ust_consumerd_state) != CONSUMER_STARTED) {
+                       if (uatomic_read(&the_ust_consumerd_state) != CONSUMER_STARTED) {
                                ret = LTTNG_ERR_NO_USTCONSUMERD;
                                goto error;
                        }
                        break;
                case LTTNG_DOMAIN_KERNEL:
-                       if (uatomic_read(&kernel_consumerd_state) != CONSUMER_STARTED) {
+                       if (uatomic_read(&the_kernel_consumerd_state) != CONSUMER_STARTED) {
                                ret = LTTNG_ERR_NO_KERNCONSUMERD;
                                goto error;
                        }
@@ -1292,7 +1306,7 @@ skip_domain:
                                cmd_ctx->lsm.domain.type,
                                cmd_ctx->lsm.u.context.channel_name,
                                ALIGNED_CONST_PTR(cmd_ctx->lsm.u.context.ctx),
-                               kernel_poll_pipe[1]);
+                               the_kernel_poll_pipe[1]);
 
                cmd_ctx->lsm.u.context.ctx.u.app_ctx.provider_name = NULL;
                cmd_ctx->lsm.u.context.ctx.u.app_ctx.ctx_name = NULL;
@@ -1351,7 +1365,7 @@ error_add_context:
                ret = cmd_enable_channel(cmd_ctx->session,
                                ALIGNED_CONST_PTR(cmd_ctx->lsm.domain),
                                ALIGNED_CONST_PTR(cmd_ctx->lsm.u.channel.chan),
-                               kernel_poll_pipe[1]);
+                               the_kernel_poll_pipe[1]);
                break;
        }
        case LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE:
@@ -1685,7 +1699,7 @@ error_add_context:
                                cmd_ctx->lsm.u.enable.channel_name,
                                ev,
                                filter_expression, bytecode, exclusion,
-                               kernel_poll_pipe[1]);
+                               the_kernel_poll_pipe[1]);
                lttng_event_destroy(ev);
                break;
        }
@@ -1841,8 +1855,7 @@ error_add_context:
        case LTTNG_DESTROY_SESSION:
        {
                ret = cmd_destroy_session(cmd_ctx->session,
-                               notification_thread_handle,
-                               sock);
+                               the_notification_thread_handle, sock);
                break;
        }
        case LTTNG_LIST_DOMAINS:
@@ -1968,7 +1981,7 @@ error_add_context:
 
                switch (cmd_ctx->lsm.domain.type) {
                case LTTNG_DOMAIN_KERNEL:
-                       cdata = &kconsumer_data;
+                       cdata = &the_kconsumer_data;
                        break;
                default:
                        ret = LTTNG_ERR_UND;
@@ -2159,7 +2172,8 @@ error_add_context:
                original_reply_payload_size = cmd_ctx->reply_payload.buffer.size;
 
                ret = cmd_register_trigger(&cmd_creds, payload_trigger,
-                               notification_thread_handle, &return_trigger);
+                               the_notification_thread_handle,
+                               &return_trigger);
                if (ret != LTTNG_OK) {
                        lttng_trigger_put(payload_trigger);
                        goto error;
@@ -2197,7 +2211,7 @@ error_add_context:
                }
 
                ret = cmd_unregister_trigger(&cmd_creds, payload_trigger,
-                               notification_thread_handle);
+                               the_notification_thread_handle);
                lttng_trigger_put(payload_trigger);
                break;
        }
@@ -2270,11 +2284,9 @@ error_add_context:
                schedule_type = (enum lttng_rotation_schedule_type) cmd_ctx->lsm.u.rotation_set_schedule.type;
                value = cmd_ctx->lsm.u.rotation_set_schedule.value;
 
-               ret = cmd_rotation_set_schedule(cmd_ctx->session,
-                               set_schedule,
-                               schedule_type,
-                               value,
-                               notification_thread_handle);
+               ret = cmd_rotation_set_schedule(cmd_ctx->session, set_schedule,
+                               schedule_type, value,
+                               the_notification_thread_handle);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -2319,8 +2331,8 @@ error_add_context:
 
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
-               ret = cmd_list_triggers(cmd_ctx,
-                               notification_thread_handle, &return_triggers);
+               ret = cmd_list_triggers(cmd_ctx, the_notification_thread_handle,
+                               &return_triggers);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -2377,9 +2389,11 @@ static int create_client_sock(void)
        const mode_t old_umask = umask(0);
 
        /* Create client tool unix socket */
-       client_sock = lttcomm_create_unix_sock(config.client_unix_sock_path.value);
+       client_sock = lttcomm_create_unix_sock(
+                       the_config.client_unix_sock_path.value);
        if (client_sock < 0) {
-               ERR("Create unix sock failed: %s", config.client_unix_sock_path.value);
+               ERR("Create unix sock failed: %s",
+                               the_config.client_unix_sock_path.value);
                ret = -1;
                goto end;
        }
@@ -2393,10 +2407,11 @@ static int create_client_sock(void)
        }
 
        /* File permission MUST be 660 */
-       ret = chmod(config.client_unix_sock_path.value, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+       ret = chmod(the_config.client_unix_sock_path.value,
+                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (ret < 0) {
                ERR("Set file permissions failed: %s",
-                               config.client_unix_sock_path.value);
+                               the_config.client_unix_sock_path.value);
                PERROR("chmod");
                (void) lttcomm_close_unix_sock(client_sock);
                ret = -1;
@@ -2446,7 +2461,7 @@ static void *thread_manage_clients(void *data)
 
        rcu_register_thread();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_CMD);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_CMD);
 
        health_code_update();
 
@@ -2684,7 +2699,7 @@ error:
 
 error_listen:
 error_create_poll:
-       unlink(config.client_unix_sock_path.value);
+       unlink(the_config.client_unix_sock_path.value);
        ret = close(client_sock);
        if (ret) {
                PERROR("close");
@@ -2695,7 +2710,7 @@ error_create_poll:
                ERR("Health error occurred in %s", __func__);
        }
 
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
 
        DBG("Client thread dying");
        lttng_payload_reset(&cmd_ctx.reply_payload);
index 28e0df019cd2738fa8afff054ad8d0d55f6bb4c4..73773bd137726c4f09cbd4508338f8b391ad8583 100644 (file)
@@ -4360,7 +4360,7 @@ enum lttng_error_code synchronize_tracer_notifier_register(
                                goto end_unlock_session_list;
                        }
 
-                       agent_add(agt, trigger_agents_ht_by_domain);
+                       agent_add(agt, the_trigger_agents_ht_by_domain);
                }
 
                ret_code = trigger_agent_enable(trigger, agt);
@@ -5320,8 +5320,8 @@ int cmd_rotate_session(struct ltt_session *session,
        chunk_being_archived = NULL;
        if (!quiet_rotation) {
                ret = notification_thread_command_session_rotation_ongoing(
-                               notification_thread_handle,
-                               session->name, session->uid, session->gid,
+                               the_notification_thread_handle, session->name,
+                               session->uid, session->gid,
                                ongoing_rotation_chunk_id);
                if (ret != LTTNG_OK) {
                        ERR("Failed to notify notification thread that a session rotation is ongoing for session %s",
index 115a46e2e1898c1e49213ef2dde91aaf07309ce9..4ba40a075fdae27516c53406f6cc1a1e9938f45d 100644 (file)
@@ -370,10 +370,10 @@ struct consumer_socket *consumer_find_socket_by_bitness(int bits,
 
        switch (bits) {
        case 64:
-               consumer_fd = uatomic_read(&ust_consumerd64_fd);
+               consumer_fd = uatomic_read(&the_ust_consumerd64_fd);
                break;
        case 32:
-               consumer_fd = uatomic_read(&ust_consumerd32_fd);
+               consumer_fd = uatomic_read(&the_ust_consumerd32_fd);
                break;
        default:
                assert(0);
@@ -1153,12 +1153,10 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                char output_path[LTTNG_PATH_MAX] = {};
                uint64_t relayd_session_id;
 
-               ret = relayd_create_session(rsock,
-                               &relayd_session_id,
+               ret = relayd_create_session(rsock, &relayd_session_id,
                                session_name, hostname, base_path,
-                               session_live_timer,
-                               consumer->snapshot, session_id,
-                               sessiond_uuid, current_chunk_id,
+                               session_live_timer, consumer->snapshot,
+                               session_id, the_sessiond_uuid, current_chunk_id,
                                session_creation_time,
                                session_name_contains_creation_time,
                                output_path);
index d33a3cba8fac0d231aabd527400b83adc7645d6f..22380fcdd58d4f1cdc878be9096ad8bf93a05db5 100644 (file)
@@ -39,7 +39,7 @@ static void update_ust_app(int app_sock)
        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;
        }
@@ -235,7 +235,8 @@ static void *thread_dispatch_ust_registration(void *data)
 
        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;
@@ -486,7 +487,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_unregister_thread();
        return NULL;
 }
index 85c1eec9035be74bb0b239b782a760dd27ad580f..53be62d7e95a0f19aa2f9b46463eb3c9817530b0 100644 (file)
 #include "lttng-sessiond.h"
 #include <common/uuid.h>
 
-lttng_uuid sessiond_uuid;
+lttng_uuid the_sessiond_uuid;
 
-int ust_consumerd64_fd = -1;
-int ust_consumerd32_fd = -1;
+int the_ust_consumerd64_fd = -1;
+int the_ust_consumerd32_fd = -1;
 
-long page_size;
+long the_page_size;
 
-struct health_app *health_sessiond;
+struct health_app *the_health_sessiond;
 
-struct notification_thread_handle *notification_thread_handle;
+struct notification_thread_handle *the_notification_thread_handle;
 
-struct lttng_ht *agent_apps_ht_by_sock = NULL;
-struct lttng_ht *trigger_agents_ht_by_domain = NULL;
+struct lttng_ht *the_agent_apps_ht_by_sock = NULL;
+struct lttng_ht *the_trigger_agents_ht_by_domain = NULL;
 
-struct lttng_kernel_tracer_version kernel_tracer_version;
-struct lttng_kernel_tracer_abi_version kernel_tracer_abi_version;
+struct lttng_kernel_tracer_version the_kernel_tracer_version;
+struct lttng_kernel_tracer_abi_version the_kernel_tracer_abi_version;
 
-int kernel_poll_pipe[2] = { -1, -1 };
+int the_kernel_poll_pipe[2] = {-1, -1};
 
-pid_t ppid;
-pid_t child_ppid;
+pid_t the_ppid;
+pid_t the_child_ppid;
 
-struct sessiond_config config;
+struct sessiond_config the_config;
 
-struct consumer_data kconsumer_data = {
+struct consumer_data the_kconsumer_data = {
        .type = LTTNG_CONSUMER_KERNEL,
        .err_sock = -1,
        .cmd_sock = -1,
@@ -43,7 +43,7 @@ struct consumer_data kconsumer_data = {
        .lock = PTHREAD_MUTEX_INITIALIZER,
 };
 
-struct consumer_data ustconsumer64_data = {
+struct consumer_data the_ustconsumer64_data = {
        .type = LTTNG_CONSUMER64_UST,
        .err_sock = -1,
        .cmd_sock = -1,
@@ -52,7 +52,7 @@ struct consumer_data ustconsumer64_data = {
        .lock = PTHREAD_MUTEX_INITIALIZER,
 };
 
-struct consumer_data ustconsumer32_data = {
+struct consumer_data the_ustconsumer32_data = {
        .type = LTTNG_CONSUMER32_UST,
        .err_sock = -1,
        .cmd_sock = -1,
@@ -61,12 +61,12 @@ struct consumer_data ustconsumer32_data = {
        .lock = PTHREAD_MUTEX_INITIALIZER,
 };
 
-enum consumerd_state ust_consumerd_state;
-enum consumerd_state kernel_consumerd_state;
+enum consumerd_state the_ust_consumerd_state;
+enum consumerd_state the_kernel_consumerd_state;
 
 static void __attribute__((constructor)) init_sessiond_uuid(void)
 {
-       if (lttng_uuid_generate(sessiond_uuid)) {
+       if (lttng_uuid_generate(the_sessiond_uuid)) {
                ERR("Failed to generate a session daemon UUID");
                abort();
        }
index b541822f87081ed47b8d7d551cabdb728d516992..af950b13467fe2b9bb42ebc88b5a3eb994165601 100644 (file)
@@ -29,7 +29,7 @@ enum health_type_sessiond {
 };
 
 /* Application health monitoring */
-extern struct health_app *health_sessiond;
+extern struct health_app *the_health_sessiond;
 
 bool launch_health_management_thread(void);
 
index 483616ac26a3d7b160b30d691a99a0d8f8bf9164..7fc557da5f8d28164af0cc9129d89768bda9949f 100644 (file)
@@ -77,7 +77,7 @@ static void *thread_manage_health(void *data)
        }
 
        /* Create unix socket */
-       sock = lttcomm_create_unix_sock(config.health_unix_sock_path.value);
+       sock = lttcomm_create_unix_sock(the_config.health_unix_sock_path.value);
        if (sock < 0) {
                ERR("Unable to create health check Unix socket");
                goto error;
@@ -87,23 +87,23 @@ static void *thread_manage_health(void *data)
                /* lttng health client socket path permissions */
                gid_t gid;
 
-               ret = utils_get_group_id(config.tracing_group_name.value, true, &gid);
+               ret = utils_get_group_id(the_config.tracing_group_name.value, true, &gid);
                if (ret) {
                        /* Default to root group. */
                        gid = 0;
                }
 
-               ret = chown(config.health_unix_sock_path.value, 0, gid);
+               ret = chown(the_config.health_unix_sock_path.value, 0, gid);
                if (ret < 0) {
-                       ERR("Unable to set group on %s", config.health_unix_sock_path.value);
+                       ERR("Unable to set group on %s", the_config.health_unix_sock_path.value);
                        PERROR("chown");
                        goto error;
                }
 
-               ret = chmod(config.health_unix_sock_path.value,
+               ret = chmod(the_config.health_unix_sock_path.value,
                                S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
                if (ret < 0) {
-                       ERR("Unable to set permissions on %s", config.health_unix_sock_path.value);
+                       ERR("Unable to set permissions on %s", the_config.health_unix_sock_path.value);
                        PERROR("chmod");
                        goto error;
                }
@@ -203,7 +203,7 @@ restart:
                         * health_check_state returns 0 if health is
                         * bad.
                         */
-                       if (!health_check_state(health_sessiond, i)) {
+                       if (!health_check_state(the_health_sessiond, i)) {
                                reply.ret_code |= 1ULL << i;
                        }
                }
@@ -229,7 +229,7 @@ error:
                ERR("Health error occurred in %s", __func__);
        }
        DBG("Health check thread dying");
-       unlink(config.health_unix_sock_path.value);
+       unlink(the_config.health_unix_sock_path.value);
        if (sock >= 0) {
                ret = close(sock);
                if (ret) {
index 8de175d11d50383ee07994fc49feeb563f77683b..c670baf49d78b951888a7e220cf6bfb646f32840 100644 (file)
@@ -70,7 +70,7 @@ static int set_pollset(struct lttng_poll_event *events, size_t size)
                goto error;
        }
 
-       ret = lttng_poll_add(events, ht_cleanup_pipe[0], LPOLLIN | LPOLLERR);
+       ret = lttng_poll_add(events, the_ht_cleanup_pipe[0], LPOLLIN | LPOLLERR);
        if (ret < 0) {
                DBG("[ht-thread] lttng_poll_add error %d.", ret);
                goto error;
@@ -85,7 +85,7 @@ error:
 static void cleanup_ht_cleanup_thread(void *data)
 {
        utils_close_pipe(ht_cleanup_quit_pipe);
-       utils_close_pipe(ht_cleanup_pipe);
+       utils_close_pipe(the_ht_cleanup_pipe);
 }
 
 static void *thread_ht_cleanup(void *data)
@@ -100,7 +100,7 @@ static void *thread_ht_cleanup(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_HT_CLEANUP);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_HT_CLEANUP);
 
        if (testpoint(sessiond_thread_ht_cleanup)) {
                DBG("[ht-thread] testpoint.");
@@ -145,14 +145,14 @@ static void *thread_ht_cleanup(void *data)
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
-                       if (pollfd != ht_cleanup_pipe[0]) {
+                       if (pollfd != the_ht_cleanup_pipe[0]) {
                                continue;
                        }
 
                        if (revents & LPOLLIN) {
                                /* Get socket from dispatch thread. */
-                               size_ret = lttng_read(ht_cleanup_pipe[0], &ht,
-                                               sizeof(ht));
+                               size_ret = lttng_read(the_ht_cleanup_pipe[0],
+                                               &ht, sizeof(ht));
                                if (size_ret < sizeof(ht)) {
                                        PERROR("ht cleanup notify pipe");
                                        goto error;
@@ -195,7 +195,7 @@ static void *thread_ht_cleanup(void *data)
                                continue;
                        }
 
-                       if (pollfd == ht_cleanup_pipe[0]) {
+                       if (pollfd == the_ht_cleanup_pipe[0]) {
                                continue;
                        }
 
@@ -219,7 +219,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
        return NULL;
@@ -243,7 +243,7 @@ struct lttng_thread *launch_ht_cleanup_thread(void)
        int ret;
        struct lttng_thread *thread;
 
-       ret = init_pipe(ht_cleanup_pipe);
+       ret = init_pipe(the_ht_cleanup_pipe);
        if (ret) {
                goto error;
        }
index 6244963cc688746b575719ee09fad3e217db5025..11a34af2a4e13a293d096b39d60251963f9d2705 100644 (file)
@@ -175,11 +175,11 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        assert(session_trylock_list());
 
        status = notification_thread_command_add_channel(
-                       notification_thread_handle, session->name,
-                       ksession->uid, ksession->gid,
-                       channel->channel->name, channel->key,
-                       LTTNG_DOMAIN_KERNEL,
-                       channel->channel->attr.subbuf_size * channel->channel->attr.num_subbuf);
+                       the_notification_thread_handle, session->name,
+                       ksession->uid, ksession->gid, channel->channel->name,
+                       channel->key, LTTNG_DOMAIN_KERNEL,
+                       channel->channel->attr.subbuf_size *
+                                       channel->channel->attr.num_subbuf);
        rcu_read_unlock();
        if (status != LTTNG_OK) {
                ret = -1;
index c377509ab4205dcba347ac97deec6ce2df478817..1da49a172d8235ededc509c23026e3baa63032b8 100644 (file)
@@ -1946,8 +1946,8 @@ int init_kernel_tracer(void)
        }
 
        /* Validate kernel version */
-       ret = kernel_validate_version(&kernel_tracer_version,
-                       &kernel_tracer_abi_version);
+       ret = kernel_validate_version(&the_kernel_tracer_version,
+                       &the_kernel_tracer_abi_version);
        if (ret < 0) {
                goto error_version;
        }
@@ -2073,7 +2073,7 @@ void cleanup_kernel_tracer(void)
        DBG2("Closing kernel event notifier group notification file descriptor");
        if (kernel_tracer_event_notifier_group_notification_fd >= 0) {
                int ret = notification_thread_command_remove_tracer_event_source(
-                               notification_thread_handle,
+                               the_notification_thread_handle,
                                kernel_tracer_event_notifier_group_notification_fd);
                if (ret != LTTNG_OK) {
                        ERR("Failed to remove kernel event notifier notification from notification thread");
index edc1bc115fbb9f5268108a8383d34f5b02c726e0..3c4261ea7acd94c2cd230af327e77228691002f7 100644 (file)
@@ -34,7 +34,7 @@ enum consumerd_state {
 };
 
 /* Unique identifier of a session daemon instance. */
-extern lttng_uuid sessiond_uuid;
+extern lttng_uuid the_sessiond_uuid;
 
 /*
  * This consumer daemon state is used to validate if a client command will be
@@ -57,8 +57,8 @@ extern lttng_uuid sessiond_uuid;
  * command is safe. After that, we can not guarantee the correctness of the
  * client request vis-a-vis the consumer.
  */
-extern enum consumerd_state ust_consumerd_state;
-extern enum consumerd_state kernel_consumerd_state;
+extern enum consumerd_state the_ust_consumerd_state;
+extern enum consumerd_state the_kernel_consumerd_state;
 
 extern const char default_home_dir[],
        default_tracing_group[],
@@ -66,11 +66,11 @@ extern const char default_home_dir[],
        default_global_apps_pipe[];
 
 /* Set in main.c at boot time of the daemon */
-extern struct lttng_kernel_tracer_version kernel_tracer_version;
-extern struct lttng_kernel_tracer_abi_version kernel_tracer_abi_version;
+extern struct lttng_kernel_tracer_version the_kernel_tracer_version;
+extern struct lttng_kernel_tracer_abi_version the_kernel_tracer_abi_version;
 
 /* Notification thread handle. */
-extern struct notification_thread_handle *notification_thread_handle;
+extern struct notification_thread_handle *the_notification_thread_handle;
 
 /*
  * This contains extra data needed for processing a command received by the
@@ -127,32 +127,32 @@ struct ust_reg_wait_node {
  * be called by call_rcu thread, because it may hang (waiting for
  * call_rcu completion).
  */
-extern int ht_cleanup_pipe[2];
+extern int the_ht_cleanup_pipe[2];
 
-extern int kernel_poll_pipe[2];
+extern int the_kernel_poll_pipe[2];
 
 /*
  * Populated when the daemon starts with the current page size of the system.
  * Set in main() with the current page size.
  */
-extern long page_size;
+extern long the_page_size;
 
 /* Application health monitoring */
-extern struct health_app *health_sessiond;
+extern struct health_app *the_health_sessiond;
 
-extern struct sessiond_config config;
+extern struct sessiond_config the_config;
 
-extern int ust_consumerd64_fd, ust_consumerd32_fd;
+extern int the_ust_consumerd64_fd, the_ust_consumerd32_fd;
 
 /* Parent PID for --sig-parent option */
-extern pid_t ppid;
+extern pid_t the_ppid;
 /* Internal parent PID use with daemonize. */
-extern pid_t child_ppid;
+extern pid_t the_child_ppid;
 
 /* Consumer daemon specific control data. */
-extern struct consumer_data ustconsumer32_data;
-extern struct consumer_data ustconsumer64_data;
-extern struct consumer_data kconsumer_data;
+extern struct consumer_data the_ustconsumer32_data;
+extern struct consumer_data the_ustconsumer64_data;
+extern struct consumer_data the_kconsumer_data;
 
 int sessiond_init_thread_quit_pipe(void);
 int sessiond_check_thread_quit_pipe(int fd, uint32_t events);
index e0b5595f3b25adbd6fb98332420d9cc458435060..d733f7061a854d4d846954704018383a1acd1aa2 100644 (file)
@@ -178,56 +178,56 @@ static void close_consumer_sockets(void)
 {
        int ret;
 
-       if (kconsumer_data.err_sock >= 0) {
-               ret = close(kconsumer_data.err_sock);
+       if (the_kconsumer_data.err_sock >= 0) {
+               ret = close(the_kconsumer_data.err_sock);
                if (ret < 0) {
                        PERROR("kernel consumer err_sock close");
                }
        }
-       if (ustconsumer32_data.err_sock >= 0) {
-               ret = close(ustconsumer32_data.err_sock);
+       if (the_ustconsumer32_data.err_sock >= 0) {
+               ret = close(the_ustconsumer32_data.err_sock);
                if (ret < 0) {
                        PERROR("UST consumerd32 err_sock close");
                }
        }
-       if (ustconsumer64_data.err_sock >= 0) {
-               ret = close(ustconsumer64_data.err_sock);
+       if (the_ustconsumer64_data.err_sock >= 0) {
+               ret = close(the_ustconsumer64_data.err_sock);
                if (ret < 0) {
                        PERROR("UST consumerd64 err_sock close");
                }
        }
-       if (kconsumer_data.cmd_sock >= 0) {
-               ret = close(kconsumer_data.cmd_sock);
+       if (the_kconsumer_data.cmd_sock >= 0) {
+               ret = close(the_kconsumer_data.cmd_sock);
                if (ret < 0) {
                        PERROR("kernel consumer cmd_sock close");
                }
        }
-       if (ustconsumer32_data.cmd_sock >= 0) {
-               ret = close(ustconsumer32_data.cmd_sock);
+       if (the_ustconsumer32_data.cmd_sock >= 0) {
+               ret = close(the_ustconsumer32_data.cmd_sock);
                if (ret < 0) {
                        PERROR("UST consumerd32 cmd_sock close");
                }
        }
-       if (ustconsumer64_data.cmd_sock >= 0) {
-               ret = close(ustconsumer64_data.cmd_sock);
+       if (the_ustconsumer64_data.cmd_sock >= 0) {
+               ret = close(the_ustconsumer64_data.cmd_sock);
                if (ret < 0) {
                        PERROR("UST consumerd64 cmd_sock close");
                }
        }
-       if (kconsumer_data.channel_monitor_pipe >= 0) {
-               ret = close(kconsumer_data.channel_monitor_pipe);
+       if (the_kconsumer_data.channel_monitor_pipe >= 0) {
+               ret = close(the_kconsumer_data.channel_monitor_pipe);
                if (ret < 0) {
                        PERROR("kernel consumer channel monitor pipe close");
                }
        }
-       if (ustconsumer32_data.channel_monitor_pipe >= 0) {
-               ret = close(ustconsumer32_data.channel_monitor_pipe);
+       if (the_ustconsumer32_data.channel_monitor_pipe >= 0) {
+               ret = close(the_ustconsumer32_data.channel_monitor_pipe);
                if (ret < 0) {
                        PERROR("UST consumerd32 channel monitor pipe close");
                }
        }
-       if (ustconsumer64_data.channel_monitor_pipe >= 0) {
-               ret = close(ustconsumer64_data.channel_monitor_pipe);
+       if (the_ustconsumer64_data.channel_monitor_pipe >= 0) {
+               ret = close(the_ustconsumer64_data.channel_monitor_pipe);
                if (ret < 0) {
                        PERROR("UST consumerd64 channel monitor pipe close");
                }
@@ -278,43 +278,43 @@ static void sessiond_cleanup(void)
        sessiond_close_quit_pipe();
        utils_close_pipe(apps_cmd_pipe);
        utils_close_pipe(apps_cmd_notify_pipe);
-       utils_close_pipe(kernel_poll_pipe);
+       utils_close_pipe(the_kernel_poll_pipe);
 
-       ret = remove(config.pid_file_path.value);
+       ret = remove(the_config.pid_file_path.value);
        if (ret < 0) {
-               PERROR("remove pidfile %s", config.pid_file_path.value);
+               PERROR("remove pidfile %s", the_config.pid_file_path.value);
        }
 
        DBG("Removing sessiond and consumerd content of directory %s",
-               config.rundir.value);
+                       the_config.rundir.value);
 
        /* sessiond */
-       DBG("Removing %s", config.pid_file_path.value);
-       (void) unlink(config.pid_file_path.value);
+       DBG("Removing %s", the_config.pid_file_path.value);
+       (void) unlink(the_config.pid_file_path.value);
 
-       DBG("Removing %s", config.agent_port_file_path.value);
-       (void) unlink(config.agent_port_file_path.value);
+       DBG("Removing %s", the_config.agent_port_file_path.value);
+       (void) unlink(the_config.agent_port_file_path.value);
 
        /* kconsumerd */
-       DBG("Removing %s", kconsumer_data.err_unix_sock_path);
-       (void) unlink(kconsumer_data.err_unix_sock_path);
+       DBG("Removing %s", the_kconsumer_data.err_unix_sock_path);
+       (void) unlink(the_kconsumer_data.err_unix_sock_path);
 
-       DBG("Removing directory %s", config.kconsumerd_path.value);
-       (void) rmdir(config.kconsumerd_path.value);
+       DBG("Removing directory %s", the_config.kconsumerd_path.value);
+       (void) rmdir(the_config.kconsumerd_path.value);
 
        /* ust consumerd 32 */
-       DBG("Removing %s", config.consumerd32_err_unix_sock_path.value);
-       (void) unlink(config.consumerd32_err_unix_sock_path.value);
+       DBG("Removing %s", the_config.consumerd32_err_unix_sock_path.value);
+       (void) unlink(the_config.consumerd32_err_unix_sock_path.value);
 
-       DBG("Removing directory %s", config.consumerd32_path.value);
-       (void) rmdir(config.consumerd32_path.value);
+       DBG("Removing directory %s", the_config.consumerd32_path.value);
+       (void) rmdir(the_config.consumerd32_path.value);
 
        /* ust consumerd 64 */
-       DBG("Removing %s", config.consumerd64_err_unix_sock_path.value);
-       (void) unlink(config.consumerd64_err_unix_sock_path.value);
+       DBG("Removing %s", the_config.consumerd64_err_unix_sock_path.value);
+       (void) unlink(the_config.consumerd64_err_unix_sock_path.value);
 
-       DBG("Removing directory %s", config.consumerd64_path.value);
-       (void) rmdir(config.consumerd64_path.value);
+       DBG("Removing directory %s", the_config.consumerd64_path.value);
+       (void) rmdir(the_config.consumerd64_path.value);
 
        pthread_mutex_destroy(&session_list->lock);
 
@@ -329,11 +329,11 @@ static void sessiond_cleanup(void)
 
        close_consumer_sockets();
 
-       wait_consumer(&kconsumer_data);
-       wait_consumer(&ustconsumer64_data);
-       wait_consumer(&ustconsumer32_data);
+       wait_consumer(&the_kconsumer_data);
+       wait_consumer(&the_ustconsumer64_data);
+       wait_consumer(&the_ustconsumer32_data);
 
-       if (is_root && !config.no_kernel) {
+       if (is_root && !the_config.no_kernel) {
                cleanup_kernel_tracer();
        }
 
@@ -351,7 +351,7 @@ static void sessiond_cleanup_options(void)
 {
        DBG("Cleaning up options");
 
-       sessiond_config_fini(&config);
+       sessiond_config_fini(&the_config);
 
        run_as_destroy_worker();
 }
@@ -380,9 +380,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "-c, --client-sock");
                } else {
-                       config_string_set(&config.client_unix_sock_path,
+                       config_string_set(&the_config.client_unix_sock_path,
                                        strdup(arg));
-                       if (!config.client_unix_sock_path.value) {
+                       if (!the_config.client_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -396,17 +396,17 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "-a, --apps-sock");
                } else {
-                       config_string_set(&config.apps_unix_sock_path,
+                       config_string_set(&the_config.apps_unix_sock_path,
                                        strdup(arg));
-                       if (!config.apps_unix_sock_path.value) {
+                       if (!the_config.apps_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
                }
        } else if (string_match(optname, "daemonize") || opt == 'd') {
-               config.daemonize = true;
+               the_config.daemonize = true;
        } else if (string_match(optname, "background") || opt == 'b') {
-               config.background = true;
+               the_config.background = true;
        } else if (string_match(optname, "group") || opt == 'g') {
                if (!arg || *arg == '\0') {
                        ret = -EINVAL;
@@ -416,9 +416,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "-g, --group");
                } else {
-                       config_string_set(&config.tracing_group_name,
+                       config_string_set(&the_config.tracing_group_name,
                                        strdup(arg));
-                       if (!config.tracing_group_name.value) {
+                       if (!the_config.tracing_group_name.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -433,7 +433,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        } else if (string_match(optname, "version") || opt == 'V') {
                opt_print_version = 1;
        } else if (string_match(optname, "sig-parent") || opt == 'S') {
-               config.sig_parent = true;
+               the_config.sig_parent = true;
        } else if (string_match(optname, "kconsumerd-err-sock")) {
                if (!arg || *arg == '\0') {
                        ret = -EINVAL;
@@ -443,9 +443,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--kconsumerd-err-sock");
                } else {
-                       config_string_set(&config.kconsumerd_err_unix_sock_path,
+                       config_string_set(
+                                       &the_config.kconsumerd_err_unix_sock_path,
                                        strdup(arg));
-                       if (!config.kconsumerd_err_unix_sock_path.value) {
+                       if (!the_config.kconsumerd_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -459,9 +460,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--kconsumerd-cmd-sock");
                } else {
-                       config_string_set(&config.kconsumerd_cmd_unix_sock_path,
+                       config_string_set(
+                                       &the_config.kconsumerd_cmd_unix_sock_path,
                                        strdup(arg));
-                       if (!config.kconsumerd_cmd_unix_sock_path.value) {
+                       if (!the_config.kconsumerd_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -475,9 +477,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--ustconsumerd64-err-sock");
                } else {
-                       config_string_set(&config.consumerd64_err_unix_sock_path,
+                       config_string_set(
+                                       &the_config.consumerd64_err_unix_sock_path,
                                        strdup(arg));
-                       if (!config.consumerd64_err_unix_sock_path.value) {
+                       if (!the_config.consumerd64_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -491,9 +494,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--ustconsumerd64-cmd-sock");
                } else {
-                       config_string_set(&config.consumerd64_cmd_unix_sock_path,
+                       config_string_set(
+                                       &the_config.consumerd64_cmd_unix_sock_path,
                                        strdup(arg));
-                       if (!config.consumerd64_cmd_unix_sock_path.value) {
+                       if (!the_config.consumerd64_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -507,9 +511,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--ustconsumerd32-err-sock");
                } else {
-                       config_string_set(&config.consumerd32_err_unix_sock_path,
+                       config_string_set(
+                                       &the_config.consumerd32_err_unix_sock_path,
                                        strdup(arg));
-                       if (!config.consumerd32_err_unix_sock_path.value) {
+                       if (!the_config.consumerd32_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
@@ -523,34 +528,37 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--ustconsumerd32-cmd-sock");
                } else {
-                       config_string_set(&config.consumerd32_cmd_unix_sock_path,
+                       config_string_set(
+                                       &the_config.consumerd32_cmd_unix_sock_path,
                                        strdup(arg));
-                       if (!config.consumerd32_cmd_unix_sock_path.value) {
+                       if (!the_config.consumerd32_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
                        }
                }
        } else if (string_match(optname, "no-kernel")) {
-               config.no_kernel = true;
+               the_config.no_kernel = true;
        } else if (string_match(optname, "quiet") || opt == 'q') {
-               config.quiet = true;
+               the_config.quiet = true;
        } else if (string_match(optname, "verbose") || opt == 'v') {
                /* Verbose level can increase using multiple -v */
                if (arg) {
                        /* Value obtained from config file */
-                       config.verbose = config_parse_value(arg);
+                       the_config.verbose = config_parse_value(arg);
                } else {
                        /* -v used on command line */
-                       config.verbose++;
+                       the_config.verbose++;
                }
                /* Clamp value to [0, 3] */
-               config.verbose = config.verbose < 0 ? 0 :
-                       (config.verbose <= 3 ? config.verbose : 3);
+               the_config.verbose = the_config.verbose < 0 ?
+                                     0 :
+                                     (the_config.verbose <= 3 ? the_config.verbose :
+                                                                3);
        } else if (string_match(optname, "verbose-consumer")) {
                if (arg) {
-                       config.verbose_consumer = config_parse_value(arg);
+                       the_config.verbose_consumer = config_parse_value(arg);
                } else {
-                       config.verbose_consumer++;
+                       the_config.verbose_consumer++;
                }
        } else if (string_match(optname, "consumerd32-path")) {
                if (!arg || *arg == '\0') {
@@ -561,9 +569,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--consumerd32-path");
                } else {
-                       config_string_set(&config.consumerd32_bin_path,
+                       config_string_set(&the_config.consumerd32_bin_path,
                                        strdup(arg));
-                       if (!config.consumerd32_bin_path.value) {
+                       if (!the_config.consumerd32_bin_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -577,9 +585,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--consumerd32-libdir");
                } else {
-                       config_string_set(&config.consumerd32_lib_dir,
+                       config_string_set(&the_config.consumerd32_lib_dir,
                                        strdup(arg));
-                       if (!config.consumerd32_lib_dir.value) {
+                       if (!the_config.consumerd32_lib_dir.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -593,9 +601,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--consumerd64-path");
                } else {
-                       config_string_set(&config.consumerd64_bin_path,
+                       config_string_set(&the_config.consumerd64_bin_path,
                                        strdup(arg));
-                       if (!config.consumerd64_bin_path.value) {
+                       if (!the_config.consumerd64_bin_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -609,9 +617,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--consumerd64-libdir");
                } else {
-                       config_string_set(&config.consumerd64_lib_dir,
+                       config_string_set(&the_config.consumerd64_lib_dir,
                                        strdup(arg));
-                       if (!config.consumerd64_lib_dir.value) {
+                       if (!the_config.consumerd64_lib_dir.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -625,8 +633,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "-p, --pidfile");
                } else {
-                       config_string_set(&config.pid_file_path, strdup(arg));
-                       if (!config.pid_file_path.value) {
+                       config_string_set(
+                                       &the_config.pid_file_path, strdup(arg));
+                       if (!the_config.pid_file_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -652,7 +661,8 @@ static int set_option(int opt, const char *arg, const char *optname)
                                ERR("Port overflow in --agent-tcp-port parameter: %s", arg);
                                return -1;
                        }
-                       config.agent_tcp_port.begin = config.agent_tcp_port.end = (int) v;
+                       the_config.agent_tcp_port.begin =
+                                       the_config.agent_tcp_port.end = (int) v;
                        DBG3("Agent TCP port set to non default: %i", (int) v);
                }
        } else if (string_match(optname, "load") || opt == 'l') {
@@ -664,8 +674,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "-l, --load");
                } else {
-                       config_string_set(&config.load_session_path, strdup(arg));
-                       if (!config.load_session_path.value) {
+                       config_string_set(&the_config.load_session_path,
+                                       strdup(arg));
+                       if (!the_config.load_session_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -679,8 +690,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--kmod-probes");
                } else {
-                       config_string_set(&config.kmod_probes_list, strdup(arg));
-                       if (!config.kmod_probes_list.value) {
+                       config_string_set(&the_config.kmod_probes_list,
+                                       strdup(arg));
+                       if (!the_config.kmod_probes_list.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -694,9 +706,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
                                "--extra-kmod-probes");
                } else {
-                       config_string_set(&config.kmod_extra_probes_list,
+                       config_string_set(&the_config.kmod_extra_probes_list,
                                        strdup(arg));
-                       if (!config.kmod_extra_probes_list.value) {
+                       if (!the_config.kmod_extra_probes_list.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
                        }
@@ -714,9 +726,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        ERR("Value out of range for --event-notifier-error-number-of-bucket parameter: %s", arg);
                        return -1;
                }
-               config.event_notifier_error_counter_bucket = (int) v;
+               the_config.event_notifier_error_counter_bucket = (int) v;
                DBG3("Number of event notifier error counter set to non default: %i",
-                               config.event_notifier_error_counter_bucket);
+                               the_config.event_notifier_error_counter_bucket);
                goto end;
        } else if (string_match(optname, "config") || opt == 'f') {
                /* This is handled in set_options() thus silent skip. */
@@ -893,7 +905,7 @@ end:
  */
 static int create_lockfile(void)
 {
-       return utils_create_lock_file(config.lock_file_path.value);
+       return utils_create_lock_file(the_config.lock_file_path.value);
 }
 
 /*
@@ -930,7 +942,7 @@ static void sessiond_cleanup_lock_file(void)
         * release the file system lock.
         */
        if (lockfile_fd >= 0) {
-               ret = remove(config.lock_file_path.value);
+               ret = remove(the_config.lock_file_path.value);
                if (ret < 0) {
                        PERROR("remove lock file");
                }
@@ -952,7 +964,8 @@ static int set_permissions(char *rundir)
        int ret;
        gid_t gid;
 
-       ret = utils_get_group_id(config.tracing_group_name.value, true, &gid);
+       ret = utils_get_group_id(
+                       the_config.tracing_group_name.value, true, &gid);
        if (ret) {
                /* Default to root group. */
                gid = 0;
@@ -977,30 +990,34 @@ static int set_permissions(char *rundir)
        }
 
        /* lttng client socket path */
-       ret = chown(config.client_unix_sock_path.value, 0, gid);
+       ret = chown(the_config.client_unix_sock_path.value, 0, gid);
        if (ret < 0) {
-               ERR("Unable to set group on %s", config.client_unix_sock_path.value);
+               ERR("Unable to set group on %s",
+                               the_config.client_unix_sock_path.value);
                PERROR("chown");
        }
 
        /* kconsumer error socket path */
-       ret = chown(kconsumer_data.err_unix_sock_path, 0, 0);
+       ret = chown(the_kconsumer_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s", kconsumer_data.err_unix_sock_path);
+               ERR("Unable to set group on %s",
+                               the_kconsumer_data.err_unix_sock_path);
                PERROR("chown");
        }
 
        /* 64-bit ustconsumer error socket path */
-       ret = chown(ustconsumer64_data.err_unix_sock_path, 0, 0);
+       ret = chown(the_ustconsumer64_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s", ustconsumer64_data.err_unix_sock_path);
+               ERR("Unable to set group on %s",
+                               the_ustconsumer64_data.err_unix_sock_path);
                PERROR("chown");
        }
 
        /* 32-bit ustconsumer compat32 error socket path */
-       ret = chown(ustconsumer32_data.err_unix_sock_path, 0, 0);
+       ret = chown(the_ustconsumer32_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s", ustconsumer32_data.err_unix_sock_path);
+               ERR("Unable to set group on %s",
+                               the_ustconsumer32_data.err_unix_sock_path);
                PERROR("chown");
        }
 
@@ -1016,12 +1033,12 @@ static int create_lttng_rundir(void)
 {
        int ret;
 
-       DBG3("Creating LTTng run directory: %s", config.rundir.value);
+       DBG3("Creating LTTng run directory: %s", the_config.rundir.value);
 
-       ret = mkdir(config.rundir.value, S_IRWXU);
+       ret = mkdir(the_config.rundir.value, S_IRWXU);
        if (ret < 0) {
                if (errno != EEXIST) {
-                       ERR("Unable to create %s", config.rundir.value);
+                       ERR("Unable to create %s", the_config.rundir.value);
                        goto error;
                } else {
                        ret = 0;
@@ -1043,13 +1060,13 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
 
        switch (consumer_data->type) {
        case LTTNG_CONSUMER_KERNEL:
-               path = config.kconsumerd_path.value;
+               path = the_config.kconsumerd_path.value;
                break;
        case LTTNG_CONSUMER64_UST:
-               path = config.consumerd64_path.value;
+               path = the_config.consumerd64_path.value;
                break;
        case LTTNG_CONSUMER32_UST:
-               path = config.consumerd32_path.value;
+               path = the_config.consumerd32_path.value;
                break;
        default:
                ERR("Consumer type unknown");
@@ -1069,8 +1086,8 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
        if (is_root) {
                gid_t gid;
 
-               ret = utils_get_group_id(config.tracing_group_name.value, true,
-                               &gid);
+               ret = utils_get_group_id(the_config.tracing_group_name.value,
+                               true, &gid);
                if (ret) {
                        /* Default to root group. */
                        gid = 0;
@@ -1207,7 +1224,7 @@ static void set_ulimit(void)
 
 static int write_pidfile(void)
 {
-       return utils_create_pid_file(getpid(), config.pid_file_path.value);
+       return utils_create_pid_file(getpid(), the_config.pid_file_path.value);
 }
 
 static int set_clock_plugin_env(void)
@@ -1215,12 +1232,12 @@ static int set_clock_plugin_env(void)
        int ret = 0;
        char *env_value = NULL;
 
-       if (!config.lttng_ust_clock_plugin.value) {
+       if (!the_config.lttng_ust_clock_plugin.value) {
                goto end;
        }
 
        ret = asprintf(&env_value, "LTTNG_UST_CLOCK_PLUGIN=%s",
-                       config.lttng_ust_clock_plugin.value);
+                       the_config.lttng_ust_clock_plugin.value);
        if (ret < 0) {
                PERROR("asprintf");
                goto end;
@@ -1234,7 +1251,7 @@ static int set_clock_plugin_env(void)
        }
 
        DBG("Updated LTTNG_UST_CLOCK_PLUGIN environment variable to \"%s\"",
-                       config.lttng_ust_clock_plugin.value);
+                       the_config.lttng_ust_clock_plugin.value);
 end:
        return ret;
 }
@@ -1264,8 +1281,8 @@ static void destroy_all_sessions_and_wait(void)
                        goto unlock_session;
                }
                (void) cmd_stop_trace(session);
-               (void) cmd_destroy_session(session, notification_thread_handle,
-                               NULL);
+               (void) cmd_destroy_session(
+                               session, the_notification_thread_handle, NULL);
        unlock_session:
                session_unlock(session);
                session_put(session);
@@ -1294,7 +1311,8 @@ static void unregister_all_triggers(void)
         * List all triggers as "root" since we wish to unregister all triggers.
         */
        ret_code = notification_thread_command_list_triggers(
-                       notification_thread_handle, creds.uid.value, &triggers);
+                       the_notification_thread_handle, creds.uid.value,
+                       &triggers);
        if (ret_code != LTTNG_OK) {
                ERR("Failed to list triggers while unregistering all triggers");
                goto end;
@@ -1322,8 +1340,8 @@ static void unregister_all_triggers(void)
                DBG("Unregistering trigger: trigger owner uid = %d, trigger name = '%s'",
                                (int) trigger_owner, trigger_name);
 
-               ret_code = cmd_unregister_trigger(
-                               &creds, trigger, notification_thread_handle);
+               ret_code = cmd_unregister_trigger(&creds, trigger,
+                               the_notification_thread_handle);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to unregister trigger: trigger owner uid = %d, trigger name = '%s', error: '%s'",
                                        (int) trigger_owner, trigger_name,
@@ -1351,15 +1369,15 @@ static int launch_run_as_worker(const char *procname)
         * be leaked as the process forks a run-as worker (and performs
         * no exec*()). The same would apply to any opened fd.
         */
-       return run_as_create_worker(procname, run_as_worker_post_fork_cleanup,
-                       &config);
+       return run_as_create_worker(
+                       procname, run_as_worker_post_fork_cleanup, &the_config);
 }
 
 static void sessiond_uuid_log(void)
 {
        char uuid_str[LTTNG_UUID_STR_LEN];
 
-       lttng_uuid_to_str(sessiond_uuid, uuid_str);
+       lttng_uuid_to_str(the_sessiond_uuid, uuid_str);
        DBG("Starting lttng-sessiond {%s}", uuid_str);
 }
 
@@ -1398,14 +1416,14 @@ int main(int argc, char **argv)
                goto exit_set_signal_handler;
        }
 
-       page_size = sysconf(_SC_PAGESIZE);
-       if (page_size < 0) {
+       the_page_size = sysconf(_SC_PAGESIZE);
+       if (the_page_size < 0) {
                PERROR("sysconf _SC_PAGESIZE");
-               page_size = LONG_MAX;
-               WARN("Fallback page size to %ld", page_size);
+               the_page_size = LONG_MAX;
+               WARN("Fallback page size to %ld", the_page_size);
        }
 
-       ret = sessiond_config_init(&config);
+       ret = sessiond_config_init(&the_config);
        if (ret) {
                retval = -1;
                goto exit_set_signal_handler;
@@ -1415,7 +1433,7 @@ int main(int argc, char **argv)
         * Init config from environment variables.
         * Command line option override env configuration per-doc. Do env first.
         */
-       sessiond_config_apply_env_config(&config);
+       sessiond_config_apply_env_config(&the_config);
 
        /*
         * Parse arguments and load the daemon configuration file.
@@ -1437,29 +1455,29 @@ int main(int argc, char **argv)
         * since daemonizing causes the sessiond's current working directory
         * to '/'.
         */
-       ret = sessiond_config_resolve_paths(&config);
+       ret = sessiond_config_resolve_paths(&the_config);
        if (ret) {
                goto exit_options;
        }
 
        /* Apply config. */
-       lttng_opt_verbose = config.verbose;
-       lttng_opt_quiet = config.quiet;
-       kconsumer_data.err_unix_sock_path =
-                       config.kconsumerd_err_unix_sock_path.value;
-       kconsumer_data.cmd_unix_sock_path =
-                       config.kconsumerd_cmd_unix_sock_path.value;
-       ustconsumer32_data.err_unix_sock_path =
-                       config.consumerd32_err_unix_sock_path.value;
-       ustconsumer32_data.cmd_unix_sock_path =
-                       config.consumerd32_cmd_unix_sock_path.value;
-       ustconsumer64_data.err_unix_sock_path =
-                       config.consumerd64_err_unix_sock_path.value;
-       ustconsumer64_data.cmd_unix_sock_path =
-                       config.consumerd64_cmd_unix_sock_path.value;
+       lttng_opt_verbose = the_config.verbose;
+       lttng_opt_quiet = the_config.quiet;
+       the_kconsumer_data.err_unix_sock_path =
+                       the_config.kconsumerd_err_unix_sock_path.value;
+       the_kconsumer_data.cmd_unix_sock_path =
+                       the_config.kconsumerd_cmd_unix_sock_path.value;
+       the_ustconsumer32_data.err_unix_sock_path =
+                       the_config.consumerd32_err_unix_sock_path.value;
+       the_ustconsumer32_data.cmd_unix_sock_path =
+                       the_config.consumerd32_cmd_unix_sock_path.value;
+       the_ustconsumer64_data.err_unix_sock_path =
+                       the_config.consumerd64_err_unix_sock_path.value;
+       the_ustconsumer64_data.cmd_unix_sock_path =
+                       the_config.consumerd64_cmd_unix_sock_path.value;
        set_clock_plugin_env();
 
-       sessiond_config_log(&config);
+       sessiond_config_log(&the_config);
        sessiond_uuid_log();
 
        if (opt_print_version) {
@@ -1481,11 +1499,11 @@ int main(int argc, char **argv)
        }
 
        /* Daemonize */
-       if (config.daemonize || config.background) {
+       if (the_config.daemonize || the_config.background) {
                int i;
 
-               ret = lttng_daemonize(&child_ppid, &recv_child_signal,
-                       !config.background);
+               ret = lttng_daemonize(&the_child_ppid, &recv_child_signal,
+                               !the_config.background);
                if (ret < 0) {
                        retval = -1;
                        goto exit_options;
@@ -1517,8 +1535,8 @@ int main(int argc, char **argv)
         * Initialize the health check subsystem. This call should set the
         * appropriate time values.
         */
-       health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
-       if (!health_sessiond) {
+       the_health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
+       if (!the_health_sessiond) {
                PERROR("health_app_create error");
                retval = -1;
                goto stop_threads;
@@ -1548,18 +1566,18 @@ int main(int argc, char **argv)
                        retval = -1;
                        goto stop_threads;
                }
-               kconsumer_data.channel_monitor_pipe =
+               the_kconsumer_data.channel_monitor_pipe =
                                lttng_pipe_release_writefd(
-                                       kernel_channel_monitor_pipe);
-               if (kconsumer_data.channel_monitor_pipe < 0) {
+                                               kernel_channel_monitor_pipe);
+               if (the_kconsumer_data.channel_monitor_pipe < 0) {
                        retval = -1;
                        goto stop_threads;
                }
        }
 
        /* Set consumer initial state */
-       kernel_consumerd_state = CONSUMER_STOPPED;
-       ust_consumerd_state = CONSUMER_STOPPED;
+       the_kernel_consumerd_state = CONSUMER_STOPPED;
+       the_ust_consumerd_state = CONSUMER_STOPPED;
 
        ust32_channel_monitor_pipe = lttng_pipe_open(0);
        if (!ust32_channel_monitor_pipe) {
@@ -1567,9 +1585,9 @@ int main(int argc, char **argv)
                retval = -1;
                goto stop_threads;
        }
-       ustconsumer32_data.channel_monitor_pipe = lttng_pipe_release_writefd(
-                       ust32_channel_monitor_pipe);
-       if (ustconsumer32_data.channel_monitor_pipe < 0) {
+       the_ustconsumer32_data.channel_monitor_pipe =
+                       lttng_pipe_release_writefd(ust32_channel_monitor_pipe);
+       if (the_ustconsumer32_data.channel_monitor_pipe < 0) {
                retval = -1;
                goto stop_threads;
        }
@@ -1593,9 +1611,9 @@ int main(int argc, char **argv)
                retval = -1;
                goto stop_threads;
        }
-       ustconsumer64_data.channel_monitor_pipe = lttng_pipe_release_writefd(
-                       ust64_channel_monitor_pipe);
-       if (ustconsumer64_data.channel_monitor_pipe < 0) {
+       the_ustconsumer64_data.channel_monitor_pipe =
+                       lttng_pipe_release_writefd(ust64_channel_monitor_pipe);
+       if (the_ustconsumer64_data.channel_monitor_pipe < 0) {
                retval = -1;
                goto stop_threads;
        }
@@ -1610,7 +1628,7 @@ int main(int argc, char **argv)
                goto stop_threads;
        }
 
-       event_notifier_error_accounting_init(config.event_notifier_error_counter_bucket);
+       event_notifier_error_accounting_init(the_config.event_notifier_error_counter_bucket);
 
        /*
         * Initialize agent app hash table. We allocate the hash table here
@@ -1634,13 +1652,13 @@ int main(int argc, char **argv)
         * kernel tracer.
         */
        if (is_root) {
-               if (set_consumer_sockets(&kconsumer_data)) {
+               if (set_consumer_sockets(&the_kconsumer_data)) {
                        retval = -1;
                        goto stop_threads;
                }
 
                /* Setup kernel tracer */
-               if (!config.no_kernel) {
+               if (!the_config.no_kernel) {
                        init_kernel_tracer();
                }
 
@@ -1650,24 +1668,24 @@ int main(int argc, char **argv)
        /* init lttng_fd tracking must be done after set_ulimit. */
        lttng_fd_init();
 
-       if (set_consumer_sockets(&ustconsumer64_data)) {
+       if (set_consumer_sockets(&the_ustconsumer64_data)) {
                retval = -1;
                goto stop_threads;
        }
 
-       if (set_consumer_sockets(&ustconsumer32_data)) {
+       if (set_consumer_sockets(&the_ustconsumer32_data)) {
                retval = -1;
                goto stop_threads;
        }
 
        /* Get parent pid if -S, --sig-parent is specified. */
-       if (config.sig_parent) {
-               ppid = getppid();
+       if (the_config.sig_parent) {
+               the_ppid = getppid();
        }
 
        /* Setup the kernel pipe for waking up the kernel thread */
-       if (is_root && !config.no_kernel) {
-               if (utils_create_pipe_cloexec(kernel_poll_pipe)) {
+       if (is_root && !the_config.no_kernel) {
+               if (utils_create_pipe_cloexec(the_kernel_poll_pipe)) {
                        retval = -1;
                        goto stop_threads;
                }
@@ -1697,9 +1715,9 @@ int main(int argc, char **argv)
        /* Check for the application socket timeout env variable. */
        env_app_timeout = getenv(DEFAULT_APP_SOCKET_TIMEOUT_ENV);
        if (env_app_timeout) {
-               config.app_socket_timeout = atoi(env_app_timeout);
+               the_config.app_socket_timeout = atoi(env_app_timeout);
        } else {
-               config.app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT;
+               the_config.app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT;
        }
 
        ret = write_pidfile();
@@ -1721,11 +1739,10 @@ int main(int argc, char **argv)
        }
 
        /* notification_thread_data acquires the pipes' read side. */
-       notification_thread_handle = notification_thread_handle_create(
-                       ust32_channel_monitor_pipe,
-                       ust64_channel_monitor_pipe,
+       the_notification_thread_handle = notification_thread_handle_create(
+                       ust32_channel_monitor_pipe, ust64_channel_monitor_pipe,
                        kernel_channel_monitor_pipe);
-       if (!notification_thread_handle) {
+       if (!the_notification_thread_handle) {
                retval = -1;
                ERR("Failed to create notification thread shared data");
                goto stop_threads;
@@ -1733,7 +1750,7 @@ int main(int argc, char **argv)
 
        /* Create notification thread. */
        notification_thread = launch_notification_thread(
-                       notification_thread_handle);
+                       the_notification_thread_handle);
        if (!notification_thread) {
                retval = -1;
                goto stop_threads;
@@ -1747,8 +1764,7 @@ int main(int argc, char **argv)
 
        /* rotation_thread_data acquires the pipes' read side. */
        rotation_thread_handle = rotation_thread_handle_create(
-                       rotation_timer_queue,
-                       notification_thread_handle);
+                       rotation_timer_queue, the_notification_thread_handle);
        if (!rotation_thread_handle) {
                retval = -1;
                ERR("Failed to create rotation thread shared data");
@@ -1770,7 +1786,7 @@ int main(int argc, char **argv)
        }
 
        /* Set credentials of the client socket and rundir */
-       if (is_root && set_permissions(config.rundir.value)) {
+       if (is_root && set_permissions(the_config.rundir.value)) {
                retval = -1;
                goto stop_threads;
        }
@@ -1808,16 +1824,16 @@ int main(int argc, char **argv)
        }
 
        /* Don't start this thread if kernel tracing is not requested nor root */
-       if (is_root && !config.no_kernel) {
+       if (is_root && !the_config.no_kernel) {
                /* Create kernel thread to manage kernel event */
-               if (!launch_kernel_management_thread(kernel_poll_pipe[0])) {
+               if (!launch_kernel_management_thread(the_kernel_poll_pipe[0])) {
                        retval = -1;
                        goto stop_threads;
                }
 
                if (kernel_get_notification_fd() >= 0) {
                        ret = notification_thread_command_add_tracer_event_source(
-                                       notification_thread_handle,
+                                       the_notification_thread_handle,
                                        kernel_get_notification_fd(),
                                        LTTNG_DOMAIN_KERNEL);
                        if (ret != LTTNG_OK) {
@@ -1829,8 +1845,8 @@ int main(int argc, char **argv)
        }
 
        /* Load sessions. */
-       ret = config_load_session(config.load_session_path.value,
-                       NULL, 1, 1, NULL);
+       ret = config_load_session(
+                       the_config.load_session_path.value, NULL, 1, 1, NULL);
        if (ret) {
                ERR("Session load failed: %s", error_get_str(ret));
                retval = -1;
@@ -1915,7 +1931,7 @@ stop_threads:
         * In short, at this point, we need to have called close() on all fds
         * received from the kernel tracer.
         */
-       if (is_root && !config.no_kernel) {
+       if (is_root && !the_config.no_kernel) {
                DBG("Unloading kernel modules");
                modprobe_remove_lttng_all();
        }
@@ -1949,15 +1965,16 @@ stop_threads:
         * session daemon's teardown in order to allow it to be notified
         * of the active session and channels at the moment of the teardown.
         */
-       if (notification_thread_handle) {
-               notification_thread_handle_destroy(notification_thread_handle);
+       if (the_notification_thread_handle) {
+               notification_thread_handle_destroy(
+                               the_notification_thread_handle);
        }
        lttng_pipe_destroy(ust32_channel_monitor_pipe);
        lttng_pipe_destroy(ust64_channel_monitor_pipe);
        lttng_pipe_destroy(kernel_channel_monitor_pipe);
 
-       if (health_sessiond) {
-               health_app_destroy(health_sessiond);
+       if (the_health_sessiond) {
+               health_app_destroy(the_health_sessiond);
        }
 exit_create_run_as_worker_cleanup:
 exit_options:
index b5b77d896573a8dcdcd1c2269baf19d64573f6ab..e2f3ed26a602a1743a5f6ea827366cc8cb82423f 100644 (file)
@@ -54,7 +54,7 @@ static void *thread_application_management(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_MANAGE);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_APP_MANAGE);
 
        if (testpoint(sessiond_thread_manage_apps)) {
                goto error_testpoint;
@@ -190,7 +190,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        DBG("Application communication apps thread cleanup complete");
        rcu_thread_offline();
        rcu_unregister_thread();
index 380cd057c906ba2856881cb238cd517ecd588fd7..de17c325a8099235793cb92f0e958ee44042edf1 100644 (file)
@@ -67,7 +67,7 @@ static void *thread_consumer_management(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_CONSUMER);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_CONSUMER);
 
        health_code_update();
 
@@ -243,7 +243,7 @@ static void *thread_consumer_management(void *data)
        cmd_socket_wrapper->lock = &consumer_data->lock;
 
        pthread_mutex_lock(cmd_socket_wrapper->lock);
-       ret = consumer_init(cmd_socket_wrapper, sessiond_uuid);
+       ret = consumer_init(cmd_socket_wrapper, the_sessiond_uuid);
        if (ret) {
                ERR("Failed to send sessiond uuid to consumer daemon");
                mark_thread_intialization_as_failed(notifiers);
@@ -350,10 +350,10 @@ error:
 
        /* Immediately set the consumerd state to stopped */
        if (consumer_data->type == LTTNG_CONSUMER_KERNEL) {
-               uatomic_set(&kernel_consumerd_state, CONSUMER_ERROR);
+               uatomic_set(&the_kernel_consumerd_state, CONSUMER_ERROR);
        } else if (consumer_data->type == LTTNG_CONSUMER64_UST ||
                        consumer_data->type == LTTNG_CONSUMER32_UST) {
-               uatomic_set(&ust_consumerd_state, CONSUMER_ERROR);
+               uatomic_set(&the_ust_consumerd_state, CONSUMER_ERROR);
        } else {
                /* Code flow error... */
                assert(0);
@@ -406,7 +406,7 @@ error_poll:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        DBG("consumer thread cleanup completed");
 
        rcu_thread_offline();
index 09e47f7db3bef30bd6fd2eb45206df94d2a72471..55ecbf8b3aeae8efec377f764acf0826765c4f3b 100644 (file)
@@ -172,7 +172,7 @@ static void *thread_kernel_management(void *data)
 
        DBG("[thread] Thread manage kernel started");
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_KERNEL);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_KERNEL);
 
        /*
         * This first step of the while is to clean this structure which could free
@@ -305,7 +305,7 @@ error_testpoint:
                WARN("Kernel thread died unexpectedly. "
                                "Kernel tracing can continue but CPU hotplug is disabled.");
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        DBG("Kernel thread dying");
        return NULL;
 }
index 8d162857f6ae88eeec547857d96baf055db99b63..f701ca5f892b684063ec1e834af807a02ae8a4cd 100644 (file)
@@ -718,7 +718,7 @@ int modprobe_lttng_data(void)
         * Base probes: either from command line option, environment
         * variable or default list.
         */
-       list = config.kmod_probes_list.value;
+       list = the_config.kmod_probes_list.value;
        if (list) {
                /* User-specified probes. */
                ret = append_list_to_probes(list);
@@ -754,7 +754,7 @@ int modprobe_lttng_data(void)
        /*
         * Extra modules? Append them to current probes list.
         */
-       list = config.kmod_extra_probes_list.value;
+       list = the_config.kmod_extra_probes_list.value;
        if (list) {
                ret = append_list_to_probes(list);
                if (ret) {
index 5801682962e9add2c57d83c30a8fad3a210201e6..56f1124fbfbfbde93c7a1ba9959182221e58095d 100644 (file)
@@ -238,8 +238,8 @@ int notification_channel_socket_create(void)
        if (getuid() == 0) {
                gid_t gid;
 
-               ret =  utils_get_group_id(config.tracing_group_name.value, true,
-                               &gid);
+               ret = utils_get_group_id(the_config.tracing_group_name.value,
+                               true, &gid);
                if (ret) {
                        /* Default to root group. */
                        gid = 0;
@@ -639,7 +639,7 @@ void *thread_notification(void *data)
 
        DBG("[notification-thread] Started notification thread");
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION);
        rcu_register_thread();
        rcu_thread_online();
 
@@ -778,7 +778,7 @@ error:
 end:
        rcu_thread_offline();
        rcu_unregister_thread();
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        return NULL;
 }
 
index 9a63141dd63a5941f6ea8559fa88883f489aa0ad..55a4b74fd56d2c5b733690784cec3e71b7c7af79 100644 (file)
@@ -41,8 +41,8 @@ static void *thread_application_notification(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(health_sessiond,
-               HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY);
+       health_register(the_health_sessiond,
+                       HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY);
 
        if (testpoint(sessiond_thread_app_manage_notify)) {
                goto error_testpoint;
@@ -185,7 +185,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
        return NULL;
index a9cef051f554d68af7bedea374c422699022593f..2d629b547e396dd1eee8ff1f3c6cc5aecaaa21d5 100644 (file)
@@ -18,15 +18,15 @@ void sessiond_signal_parents(void)
         * for client side.  This ppid is the one from the
         * external process that spawned us.
         */
-       if (config.sig_parent) {
-               kill(ppid, SIGUSR1);
+       if (the_config.sig_parent) {
+               kill(the_ppid, SIGUSR1);
        }
 
        /*
         * Notify the parent of the fork() process that we are
         * ready.
         */
-       if (config.daemonize || config.background) {
-               kill(child_ppid, SIGUSR1);
+       if (the_config.daemonize || the_config.background) {
+               kill(the_child_ppid, SIGUSR1);
        }
 }
index ac1583dc24eb8f3610dfcb481d8cfb19b726d962..bd6cd52dd5a1bc79e4fa0d6da1ed1953e4d30415 100644 (file)
@@ -42,9 +42,11 @@ static int create_application_socket(void)
        const mode_t old_umask = umask(0);
 
        /* Create the application unix socket */
-       apps_sock = lttcomm_create_unix_sock(config.apps_unix_sock_path.value);
+       apps_sock = lttcomm_create_unix_sock(
+                       the_config.apps_unix_sock_path.value);
        if (apps_sock < 0) {
-               ERR("Create unix sock failed: %s", config.apps_unix_sock_path.value);
+               ERR("Create unix sock failed: %s",
+                               the_config.apps_unix_sock_path.value);
                ret = -1;
                goto end;
        }
@@ -58,11 +60,12 @@ static int create_application_socket(void)
        }
 
        /* File permission MUST be 666 */
-       ret = chmod(config.apps_unix_sock_path.value,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+       ret = chmod(the_config.apps_unix_sock_path.value,
+                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
+                                       S_IWOTH);
        if (ret < 0) {
                PERROR("Set file permissions failed on %s",
-                               config.apps_unix_sock_path.value);
+                               the_config.apps_unix_sock_path.value);
                goto error_close_socket;
        }
 
@@ -90,7 +93,8 @@ static int notify_ust_apps(int active, bool is_root)
        DBG("Notifying applications of session daemon state: %d", active);
 
        /* See shm.c for this call implying mmap, shm and futex calls */
-       wait_shm_mmap = shm_ust_get_mmap(config.wait_shm_path.value, is_root);
+       wait_shm_mmap = shm_ust_get_mmap(
+                       the_config.wait_shm_path.value, is_root);
        if (wait_shm_mmap == NULL) {
                goto error;
        }
@@ -166,7 +170,7 @@ static void *thread_application_registration(void *data)
        DBG("[thread] Manage application registration started");
 
        pthread_cleanup_push(thread_init_cleanup, thread_state);
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG);
 
        ret = lttcomm_listen_unix_sock(application_socket);
        if (ret < 0) {
@@ -247,11 +251,11 @@ static void *thread_application_registration(void *data)
                                         * lttcomm_setsockopt_snd_timeout expect msec as
                                         * parameter.
                                         */
-                                       if (config.app_socket_timeout >= 0) {
+                                       if (the_config.app_socket_timeout >= 0) {
                                                (void) lttcomm_setsockopt_rcv_timeout(sock,
-                                                               config.app_socket_timeout * 1000);
+                                                               the_config.app_socket_timeout * 1000);
                                                (void) lttcomm_setsockopt_snd_timeout(sock,
-                                                               config.app_socket_timeout * 1000);
+                                                               the_config.app_socket_timeout * 1000);
                                        }
 
                                        /*
@@ -353,7 +357,7 @@ error:
                }
                lttng_fd_put(LTTNG_FD_APPS, 1);
        }
-       unlink(config.apps_unix_sock_path.value);
+       unlink(the_config.apps_unix_sock_path.value);
 
 error_poll_add:
        lttng_poll_clean(&events);
@@ -364,7 +368,7 @@ error_create_poll:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        return NULL;
 }
 
index c8cf93e592b3e75f714d4c0056508149d5b6a290..81cdb75d8f06fc515fb4be9e1b70820215bf6459 100644 (file)
@@ -771,7 +771,7 @@ void *thread_rotation(void *data)
        DBG("[rotation-thread] Started rotation thread");
        rcu_register_thread();
        rcu_thread_online();
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_ROTATION);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_ROTATION);
        health_code_update();
 
        if (!handle) {
@@ -863,7 +863,7 @@ error:
        DBG("[rotation-thread] Exit");
        fini_thread_state(&thread);
 end:
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
        return NULL;
index 6eda624efad6f784c79cc96f66c5a22c5ceff36b..bb3b63b3a31dc407d7dde1ba3c9680e74e221925 100644 (file)
@@ -954,7 +954,7 @@ void session_release(struct urcu_ref *ref)
         * Must notify the kernel thread here to update it's poll set in order to
         * remove the channel(s)' fd just destroyed.
         */
-       ret = notify_thread_pipe(kernel_poll_pipe[1]);
+       ret = notify_thread_pipe(the_kernel_poll_pipe[1]);
        if (ret < 0) {
                PERROR("write kernel poll pipe");
        }
index f67aac4d0b36a3ac313d46464f2a9750b6ba5fec..bf56d9306449634157951ed690aad73bc8c7ba7d 100644 (file)
@@ -346,7 +346,7 @@ void *thread_timer(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_TIMER);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_TIMER);
        health_code_update();
 
        /* Only self thread will receive signal mask. */
@@ -400,7 +400,7 @@ void *thread_timer(void *data)
 
 end:
        DBG("[timer-thread] Exit");
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_thread_offline();
        rcu_unregister_thread();
        return NULL;
index f779952a0eeb15b44b2a0d7cc94a862663cedffd..dc15829ba5c6488424327404922c665f4bc08f4f 100644 (file)
@@ -946,11 +946,11 @@ void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
        /* Remove from channel list */
        cds_list_del(&channel->list);
 
-       if (notification_thread_handle
-                       && channel->published_to_notification_thread) {
+       if (the_notification_thread_handle &&
+                       channel->published_to_notification_thread) {
                status = notification_thread_command_remove_channel(
-                               notification_thread_handle,
-                               channel->key, LTTNG_DOMAIN_KERNEL);
+                               the_notification_thread_handle, channel->key,
+                               LTTNG_DOMAIN_KERNEL);
                assert(status == LTTNG_OK);
        }
        free(channel->channel->attr.extended.ptr);
index b5ee6126eee1ae214a43ca3a5842bf3a5fdab079..3efda83c194149bedcf68a083db077897297e4dd 100644 (file)
@@ -1011,7 +1011,7 @@ void delete_ust_app(struct ust_app *app)
                                app->event_notifier_group.event_pipe);
 
                ret_code = notification_thread_command_remove_tracer_event_source(
-                               notification_thread_handle,
+                               the_notification_thread_handle,
                                event_notifier_read_fd);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to remove application tracer event source from notification thread");
@@ -3352,11 +3352,12 @@ static int create_channel_per_uid(struct ust_app *app,
        pthread_mutex_unlock(&reg_uid->registry->reg.ust->lock);
 
        notification_ret = notification_thread_command_add_channel(
-                       notification_thread_handle, session->name,
-                       lttng_credentials_get_uid(&ua_sess->effective_credentials),
-                       lttng_credentials_get_gid(&ua_sess->effective_credentials),
-                       ua_chan->name,
-                       ua_chan->key, LTTNG_DOMAIN_UST,
+                       the_notification_thread_handle, session->name,
+                       lttng_credentials_get_uid(
+                                       &ua_sess->effective_credentials),
+                       lttng_credentials_get_gid(
+                                       &ua_sess->effective_credentials),
+                       ua_chan->name, ua_chan->key, LTTNG_DOMAIN_UST,
                        ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
        if (notification_ret != LTTNG_OK) {
                ret = - (int) notification_ret;
@@ -3453,11 +3454,12 @@ static int create_channel_per_pid(struct ust_app *app,
        pthread_mutex_unlock(&registry->lock);
 
        cmd_ret = notification_thread_command_add_channel(
-                       notification_thread_handle, session->name,
-                       lttng_credentials_get_uid(&ua_sess->effective_credentials),
-                       lttng_credentials_get_gid(&ua_sess->effective_credentials),
-                       ua_chan->name,
-                       ua_chan->key, LTTNG_DOMAIN_UST,
+                       the_notification_thread_handle, session->name,
+                       lttng_credentials_get_uid(
+                                       &ua_sess->effective_credentials),
+                       lttng_credentials_get_gid(
+                                       &ua_sess->effective_credentials),
+                       ua_chan->name, ua_chan->key, LTTNG_DOMAIN_UST,
                        ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
        if (cmd_ret != LTTNG_OK) {
                ret = - (int) cmd_ret;
@@ -3850,9 +3852,11 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
        DBG3("UST app creating application for socket %d", sock);
 
        if ((msg->bits_per_long == 64 &&
-                               (uatomic_read(&ust_consumerd64_fd) == -EINVAL))
-                       || (msg->bits_per_long == 32 &&
-                               (uatomic_read(&ust_consumerd32_fd) == -EINVAL))) {
+                           (uatomic_read(&the_ust_consumerd64_fd) ==
+                                           -EINVAL)) ||
+                       (msg->bits_per_long == 32 &&
+                                       (uatomic_read(&the_ust_consumerd32_fd) ==
+                                                       -EINVAL))) {
                ERR("Registration failed: application \"%s\" (pid: %d) has "
                                "%d-bit long, but no consumerd for this size is available.\n",
                                msg->name, msg->pid, msg->bits_per_long);
@@ -4046,8 +4050,9 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
        lttng_fd_put(LTTNG_FD_APPS, 1);
 
        lttng_ret = notification_thread_command_add_tracer_event_source(
-                       notification_thread_handle,
-                       lttng_pipe_get_readfd(app->event_notifier_group.event_pipe),
+                       the_notification_thread_handle,
+                       lttng_pipe_get_readfd(
+                                       app->event_notifier_group.event_pipe),
                        LTTNG_DOMAIN_UST);
        if (lttng_ret != LTTNG_OK) {
                ERR("Failed to add tracer event source to notification thread");
@@ -5646,7 +5651,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
 
        /* Get all triggers using uid 0 (root) */
        ret_code = notification_thread_command_list_triggers(
-                       notification_thread_handle, 0, &triggers);
+                       the_notification_thread_handle, 0, &triggers);
        if (ret_code != LTTNG_OK) {
                ret = -1;
                goto end;
index 7a4cf1537c9c577df02f13cd62e12f9bbbdac679..3dfb562150fe437f4263000fca9e4cc2fde20eae 100644 (file)
@@ -26,7 +26,7 @@
 struct lttng_bytecode;
 struct lttng_ust_filter_bytecode;
 
-extern int ust_consumerd64_fd, ust_consumerd32_fd;
+extern int the_ust_consumerd64_fd, the_ust_consumerd32_fd;
 
 /*
  * Object used to close the notify socket in a call_rcu(). Since the
index 8eee74979e00ea3bf7662f3881b161bb5daaece3..e1984af5f6d68f2290c605929a0bd046a541f953 100644 (file)
@@ -732,8 +732,8 @@ static void destroy_channel(struct ust_registry_channel *chan, bool notif)
 
        if (notif) {
                cmd_ret = notification_thread_command_remove_channel(
-                               notification_thread_handle, chan->consumer_key,
-                               LTTNG_DOMAIN_UST);
+                               the_notification_thread_handle,
+                               chan->consumer_key, LTTNG_DOMAIN_UST);
                if (cmd_ret != LTTNG_OK) {
                        ERR("Failed to remove channel from notification thread");
                }
index f84859fc621645aea1939d7c04648c7ac729682a..e806082e324678c026a5e112ac7b2d3e28ccc272 100644 (file)
@@ -16,7 +16,7 @@
 #include "snapshot.h"
 #include "lttng-sessiond.h"
 
-int ht_cleanup_pipe[2] = { -1, -1 };
+int the_ht_cleanup_pipe[2] = {-1, -1};
 
 /*
  * Write to writable pipe used to notify a thread.
@@ -41,7 +41,7 @@ int notify_thread_pipe(int wpipe)
 void ht_cleanup_push(struct lttng_ht *ht)
 {
        ssize_t ret;
-       int fd = ht_cleanup_pipe[1];
+       int fd = the_ht_cleanup_pipe[1];
 
        if (!ht) {
                return;
index 676ea316e95ab0784ebb8ee9d3a02fde0d1a72d2..e6d9ec8bcc57c2967936dadd7dfa2489527e034f 100644 (file)
@@ -335,7 +335,7 @@ int main(int argc, char **argv)
 
        plan_tests(NUM_TESTS);
 
-       health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
+       the_health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
        ht_cleanup_thread = launch_ht_cleanup_thread();
        assert(ht_cleanup_thread);
        lttng_thread_put(ht_cleanup_thread);
This page took 0.082476 seconds and 4 git commands to generate.