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();
rcu_thread_offline();
rcu_unregister_thread();
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
return NULL;
}
* 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();
*/
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);
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",
}
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;
}
}
*/
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
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);
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;
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;
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;
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;
}
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;
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;
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);
}
/*
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);
}
*/
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;
}
/*
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);
}
rcu_read_unlock();
- lttng_ht_destroy(agent_apps_ht_by_sock);
+ lttng_ht_destroy(the_agent_apps_ht_by_sock);
}
/*
*/
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;
}
/*
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(
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;
* 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;
/*
* 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;
}
/*
* Exec consumerd.
*/
- if (config.verbose_consumer) {
+ if (the_config.verbose_consumer) {
verbosity = "--verbose";
} else if (lttng_opt_quiet) {
verbosity = "--quiet";
* 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;
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);
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;
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);
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;
}
{
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;
}
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 {
/* 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);
}
/*
}
/* 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;
}
}
/* 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;
}
/* 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;
}
/* 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;
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;
}
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;
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:
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;
}
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:
switch (cmd_ctx->lsm.domain.type) {
case LTTNG_DOMAIN_KERNEL:
- cdata = &kconsumer_data;
+ cdata = &the_kconsumer_data;
break;
default:
ret = LTTNG_ERR_UND;
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;
}
ret = cmd_unregister_trigger(&cmd_creds, payload_trigger,
- notification_thread_handle);
+ the_notification_thread_handle);
lttng_trigger_put(payload_trigger);
break;
}
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;
}
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;
}
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;
}
}
/* 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;
rcu_register_thread();
- health_register(health_sessiond, HEALTH_SESSIOND_TYPE_CMD);
+ health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_CMD);
health_code_update();
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");
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);
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);
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",
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);
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);
struct ust_app *app;
/* Consumer is in an ERROR state. Stop any application update. */
- if (uatomic_read(&ust_consumerd_state) == CONSUMER_ERROR) {
+ if (uatomic_read(&the_ust_consumerd_state) == CONSUMER_ERROR) {
/* Stop the update process since the consumer is dead. */
return;
}
rcu_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;
health_error();
ERR("Health error occurred in %s", __func__);
}
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
rcu_unregister_thread();
return NULL;
}
#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,
.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,
.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,
.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();
}
};
/* Application health monitoring */
-extern struct health_app *health_sessiond;
+extern struct health_app *the_health_sessiond;
bool launch_health_management_thread(void);
}
/* 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;
/* 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;
}
* 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;
}
}
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) {
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;
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)
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.");
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;
continue;
}
- if (pollfd == ht_cleanup_pipe[0]) {
+ if (pollfd == the_ht_cleanup_pipe[0]) {
continue;
}
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;
int ret;
struct lttng_thread *thread;
- ret = init_pipe(ht_cleanup_pipe);
+ ret = init_pipe(the_ht_cleanup_pipe);
if (ret) {
goto error;
}
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;
}
/* 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;
}
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");
};
/* 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
* 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[],
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
* 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);
{
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");
}
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);
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();
}
{
DBG("Cleaning up options");
- sessiond_config_fini(&config);
+ sessiond_config_fini(&the_config);
run_as_destroy_worker();
}
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");
}
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;
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");
}
} 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;
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");
}
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");
}
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");
}
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");
}
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");
}
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') {
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;
}
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;
}
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;
}
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;
}
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;
}
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') {
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;
}
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;
}
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;
}
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. */
*/
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);
}
/*
* 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");
}
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;
}
/* 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");
}
{
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;
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");
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;
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)
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;
}
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;
}
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);
* 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;
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,
* 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);
}
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;
* 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.
* 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) {
}
/* 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;
* 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;
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) {
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;
}
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;
}
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
* 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();
}
/* 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;
}
/* 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();
}
/* 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;
/* Create notification thread. */
notification_thread = launch_notification_thread(
- notification_thread_handle);
+ the_notification_thread_handle);
if (!notification_thread) {
retval = -1;
goto stop_threads;
/* 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");
}
/* 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;
}
}
/* 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) {
}
/* 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;
* 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();
}
* 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:
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;
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();
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();
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);
/* 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);
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();
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
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;
}
* 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);
/*
* 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) {
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;
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();
end:
rcu_thread_offline();
rcu_unregister_thread();
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
return NULL;
}
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;
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;
* 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);
}
}
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;
}
}
/* 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;
}
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;
}
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) {
* 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);
}
/*
}
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);
health_error();
ERR("Health error occurred in %s", __func__);
}
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
return NULL;
}
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) {
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;
* 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");
}
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. */
end:
DBG("[timer-thread] Exit");
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
rcu_thread_offline();
rcu_unregister_thread();
return NULL;
/* 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);
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");
pthread_mutex_unlock(®_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;
pthread_mutex_unlock(®istry->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;
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);
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");
/* 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;
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
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");
}
#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.
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;
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);