rcu_read_lock();
nb_event = lttng_ht_get_count(agt->events);
- rcu_read_unlock();
if (nb_event == 0) {
ret = nb_event;
*total_size = 0;
* This is only valid because the commands which add events are
* processed in the same thread as the listing.
*/
- rcu_read_lock();
cds_lfht_for_each_entry(agt->events->ht, &iter.iter, event, node.node) {
ret = increment_extended_len(event->filter_expression, NULL, NULL,
&extended_len);
goto error;
}
}
- rcu_read_unlock();
*total_size = nb_event * sizeof(*tmp_events) + extended_len;
tmp_events = zmalloc(*total_size);
extended_at = ((uint8_t *) tmp_events) +
nb_event * sizeof(struct lttng_event);
- rcu_read_lock();
cds_lfht_for_each_entry(agt->events->ht, &iter.iter, event, node.node) {
strncpy(tmp_events[i].name, event->name, sizeof(tmp_events[i].name));
tmp_events[i].name[sizeof(tmp_events[i].name) - 1] = '\0';
return nb_event;
error:
- /* Negate the error code to differentiate the size from an error */
- return -ret;
+ return ret;
}
/*
}
}
+ /*
+ * Open a packet in every stream of the session to ensure that viewers
+ * can correctly identify the boundaries of the periods during which
+ * tracing was active for this session.
+ */
+ ret = session_open_packets(session);
+ if (ret != LTTNG_OK) {
+ goto error;
+ }
+
/*
* Clear the flag that indicates that a rotation was done while the
* session was stopped.
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);
*/
ret = cmd_rotate_session(session, NULL, true,
LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
- if (ret != LTTNG_OK) {
+ /*
+ * Rotation operations may not be supported by the kernel
+ * tracer. Hence, do not consider this implicit rotation as
+ * a session destruction error. The library has already stopped
+ * the session and waited for pending data; there is nothing
+ * left to do but complete the destruction of the session.
+ */
+ if (ret != LTTNG_OK &&
+ ret != -LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL) {
ERR("Failed to perform a quiet rotation as part of the destruction of session \"%s\": %s",
- session->name, lttng_strerror(-ret));
+ session->name, lttng_strerror(ret));
destruction_last_error = -ret;
}
}
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) {