rcu_read_lock();
- /*
- * Don't try to enable a channel if the session has been started at
- * some point in time before. The tracer does not allow it.
- */
- if (session->has_been_started) {
- ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
- goto error;
- }
-
/*
* If the session is a live session, remove the switch timer, the
* live timer does the same thing but sends also synchronisation
kchan = trace_kernel_get_channel_by_name(attr.name,
session->kernel_session);
if (kchan == NULL) {
+ /*
+ * Don't try to create a channel if the session has been started at
+ * some point in time before. The tracer does not allow it.
+ */
+ if (session->has_been_started) {
+ ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
+ goto error;
+ }
+
if (session->snapshot.nb_output > 0 ||
session->snapshot_mode) {
/* Enforce mmap output for snapshot sessions. */
uchan = trace_ust_find_channel_by_name(chan_ht, attr.name);
if (uchan == NULL) {
+ /*
+ * Don't try to create a channel if the session has been started at
+ * some point in time before. The tracer does not allow it.
+ */
+ if (session->has_been_started) {
+ ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
+ goto error;
+ }
+
ret = channel_ust_create(usess, &attr, domain->buf_type);
if (attr.name[0] != '\0') {
usess->has_non_default_channel = 1;
payload_size_before_location = payload.size;
comm_ret = lttng_trace_archive_location_serialize(location,
&payload);
+ lttng_trace_archive_location_put(location);
if (comm_ret < 0) {
ERR("Failed to serialize the location of the trace archive produced during the destruction of session \"%s\"",
session->name);
return ret_code;
}
-int cmd_list_triggers(struct command_ctx *cmd_ctx,
+enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
struct notification_thread_handle *notification_thread,
struct lttng_triggers **return_triggers)
{
- int ret = 0;
+ int ret;
enum lttng_error_code ret_code;
struct lttng_triggers *triggers = NULL;
ret_code = notification_thread_command_list_triggers(
notification_thread, cmd_ctx->creds.uid, &triggers);
if (ret_code != LTTNG_OK) {
- ret = ret_code;
+ goto end;
+ }
+
+ ret = lttng_triggers_remove_hidden_triggers(triggers);
+ if (ret) {
+ ret_code = LTTNG_ERR_UNK;
goto end;
}
*return_triggers = triggers;
triggers = NULL;
- ret = LTTNG_OK;
+ ret_code = LTTNG_OK;
end:
lttng_triggers_destroy(triggers);
- return ret;
+ return ret_code;
}
enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
{
enum lttng_error_code ret_code;
const struct lttng_trigger *query_target_trigger;
- struct lttng_action *query_target_action = NULL;
+ const struct lttng_action *query_target_action = NULL;
struct lttng_trigger *matching_trigger = NULL;
const char *trigger_name;
uid_t trigger_owner;
case LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER:
query_target_trigger = lttng_error_query_trigger_borrow_target(query);
break;
+ case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
+ query_target_trigger =
+ lttng_error_query_condition_borrow_target(query);
+ break;
case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
query_target_trigger = lttng_error_query_action_borrow_trigger_target(
query);
}
break;
+ case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
+ {
+ trigger_status = lttng_trigger_condition_add_error_results(
+ matching_trigger, results);
+
+ switch (trigger_status) {
+ case LTTNG_TRIGGER_STATUS_OK:
+ break;
+ default:
+ ret_code = LTTNG_ERR_UNK;
+ goto end;
+ }
+
+ break;
+ }
case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
{
const enum lttng_action_status action_status =
consumer_copy_output(snapshot_output->consumer);
strcpy(snapshot_kernel_consumer_output->chunk_path,
snapshot_chunk_name);
+
+ /* Copy the original domain subdir. */
+ strcpy(snapshot_kernel_consumer_output->domain_subdir,
+ original_kernel_consumer_output->domain_subdir);
+
ret = consumer_copy_sockets(snapshot_kernel_consumer_output,
original_kernel_consumer_output);
if (ret < 0) {
consumer_copy_output(snapshot_output->consumer);
strcpy(snapshot_ust_consumer_output->chunk_path,
snapshot_chunk_name);
+
+ /* Copy the original domain subdir. */
+ strcpy(snapshot_ust_consumer_output->domain_subdir,
+ original_ust_consumer_output->domain_subdir);
+
ret = consumer_copy_sockets(snapshot_ust_consumer_output,
original_ust_consumer_output);
if (ret < 0) {
session->name);
ret_code = LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER;
}
+
+ lttng_trace_chunk_put(snapshot_trace_chunk);
+ snapshot_trace_chunk = NULL;
error:
if (original_ust_consumer_output) {
session->ust_session->consumer = original_ust_consumer_output;