Fix: remove mention of trace directory layout in quickstart doc
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index b558988dcf1a2ba4fcf6b6cabdff46c7166bbf25..5581dce191dc760e324a966c331e14b88bc7fc45 100644 (file)
@@ -38,6 +38,7 @@
 #include <common/compat/fcntl.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-timer.h>
+#include <common/utils.h>
 
 #include "ust-consumer.h"
 
@@ -222,7 +223,9 @@ static int send_stream_to_relayd(struct lttng_consumer_stream *stream)
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                /* Add stream on the relayd */
                ret = relayd_add_stream(&relayd->control_sock, stream->name,
-                               stream->chan->pathname, &stream->relayd_stream_id);
+                               stream->chan->pathname, &stream->relayd_stream_id,
+                               stream->chan->tracefile_size,
+                               stream->chan->tracefile_count);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                if (ret < 0) {
                        goto error;
@@ -1283,10 +1286,28 @@ end:
 
 /*
  * Called when a stream is created.
+ *
+ * Return 0 on success or else a negative value.
  */
 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
 {
-       return lttng_create_output_file(stream);
+       int ret;
+
+       /* Don't create anything if this is set for streaming. */
+       if (stream->net_seq_idx == (uint64_t) -1ULL) {
+               ret = utils_create_stream_file(stream->chan->pathname, stream->name,
+                               stream->chan->tracefile_size, stream->tracefile_count_current,
+                               stream->uid, stream->gid);
+               if (ret < 0) {
+                       goto error;
+               }
+               stream->out_fd = ret;
+               stream->tracefile_size_current = 0;
+       }
+       ret = 0;
+
+error:
+       return ret;
 }
 
 /*
This page took 0.024491 seconds and 4 git commands to generate.