#include <common/common.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/relayd/relayd.h>
+#include <common/utils.h>
#include "channel.h"
#include "consumer.h"
struct ltt_kernel_channel *kchan;
/* Open kernel metadata */
- if (ksess->metadata == NULL) {
+ if (ksess->metadata == NULL && ksess->output_traces) {
ret = kernel_open_metadata(ksess);
if (ret < 0) {
ret = LTTNG_ERR_KERN_META_FAIL;
}
/* Open kernel metadata stream */
- if (ksess->metadata_stream_fd < 0) {
+ if (ksess->metadata && ksess->metadata_stream_fd < 0) {
ret = kernel_open_metadata_stream(ksess);
if (ret < 0) {
ERR("Kernel create metadata stream failed");
struct ltt_session *session;
assert(name);
-
- /* No URIs is not possible. */
- if (uris == NULL) {
- ret = LTTNG_ERR_SESSION_FAIL;
- goto session_error;
- }
+ assert(creds);
/*
* Verify if the session already exist
goto consumer_error;
}
- ret = cmd_set_consumer_uri(0, session, nb_uri, uris);
- if (ret != LTTNG_OK) {
- goto consumer_error;
+ if (uris) {
+ ret = cmd_set_consumer_uri(0, session, nb_uri, uris);
+ if (ret != LTTNG_OK) {
+ goto consumer_error;
+ }
+ session->output_traces = 1;
+ } else {
+ session->output_traces = 0;
+ DBG2("Session %s created with no output", session->name);
}
session->consumer->enabled = 1;
* snapshot output.
*/
rcu_read_lock();
- cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
- node.node) {
+ cds_lfht_for_each_entry(snap_output->consumer->socks->ht, &iter.iter,
+ socket, node.node) {
ret = send_consumer_relayd_sockets(0, session->id,
snap_output->consumer, socket);
if (ret < 0) {
assert(output);
assert(session);
+ /* Get the datetime for the snapshot output directory. */
+ ret = utils_get_current_time_str("%Y%m%d-%H%M%S", output->datetime,
+ sizeof(output->datetime));
+ if (!ret) {
+ ret = -EINVAL;
+ goto error;
+ }
+
if (!output->kernel_sockets_copied) {
ret = consumer_copy_sockets(output->consumer, ksess->consumer);
if (ret < 0) {
assert(output);
assert(session);
+ /* Get the datetime for the snapshot output directory. */
+ ret = utils_get_current_time_str("%Y%m%d-%H%M%S", output->datetime,
+ sizeof(output->datetime));
+ if (!ret) {
+ ret = -EINVAL;
+ goto error;
+ }
+
if (!output->ust_sockets_copied) {
ret = consumer_copy_sockets(output->consumer, usess->consumer);
if (ret < 0) {
rcu_read_lock();
cds_lfht_for_each_entry(session->snapshot.output_ht->ht,
&iter.iter, sout, node.node) {
- ret = record_ust_snapshot(usess, tmp_sout, session, wait);
+ ret = record_ust_snapshot(usess, sout, session, wait);
if (ret < 0) {
rcu_read_unlock();
goto error;