Support flight recorder mode for a session
authorDavid Goulet <dgoulet@efficios.com>
Wed, 1 May 2013 19:18:50 +0000 (15:18 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 27 Jun 2013 19:01:28 +0000 (15:01 -0400)
This adds the --no-output option to the lttng UI which will flag a
session to not set an output destination meaning that tracing will be in
overwrite mode in the buffers.

This is also the only way for now to snapshot a session, it's to put it
in no output mode.

Signed-off-by: David Goulet <dgoulet@efficios.com>
18 files changed:
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/kernel-consumer.h
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/trace-kernel.h
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/bin/lttng-sessiond/ust-consumer.c
src/bin/lttng/commands/create.c
src/common/consumer.c
src/common/consumer.h
src/common/kernel-consumer/kernel-consumer.c
src/common/sessiond-comm/sessiond-comm.h
src/common/ust-consumer/ust-consumer.c
src/lib/lttng-ctl/lttng-ctl.c

index 6f7c71d0549474746ef78243f3204cd9ba014ab2..211fc5a34df02b70de775c15880d526d26afe050 100644 (file)
@@ -1681,12 +1681,7 @@ int cmd_create_session_uri(char *name, struct lttng_uri *uris,
        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
@@ -1725,9 +1720,15 @@ int cmd_create_session_uri(char *name, struct lttng_uri *uris,
                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;
index d91c3e60bf0e16156232ca3a2f251d0d6ae779e6..d3f6c071c9e5ecd84e01bb6067187e334bcb557d 100644 (file)
@@ -721,7 +721,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                unsigned char *uuid,
                uint32_t chan_id,
                uint64_t tracefile_size,
-               uint64_t tracefile_count)
+               uint64_t tracefile_count,
+               unsigned int monitor)
 {
        assert(msg);
 
@@ -744,6 +745,7 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.ask_channel.chan_id = chan_id;
        msg->u.ask_channel.tracefile_size = tracefile_size;
        msg->u.ask_channel.tracefile_count = tracefile_count;
+       msg->u.ask_channel.monitor = monitor;
 
        memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid));
 
@@ -771,7 +773,8 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                enum lttng_event_output output,
                int type,
                uint64_t tracefile_size,
-               uint64_t tracefile_count)
+               uint64_t tracefile_count,
+               unsigned int monitor)
 {
        assert(msg);
 
@@ -790,6 +793,7 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.channel.type = type;
        msg->u.channel.tracefile_size = tracefile_size;
        msg->u.channel.tracefile_count = tracefile_count;
+       msg->u.channel.monitor = monitor;
 
        strncpy(msg->u.channel.pathname, pathname,
                        sizeof(msg->u.channel.pathname));
index 3c5cf155d07ed14764d9504bbb4f4e0f70d69d95..a954a073eed4c5824b37df9048d30fe0aebdfa96 100644 (file)
@@ -211,7 +211,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                unsigned char *uuid,
                uint32_t chan_id,
                uint64_t tracefile_size,
-               uint64_t tracefile_count);
+               uint64_t tracefile_count,
+               unsigned int monitor);
 void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
                enum lttng_consumer_command cmd,
                uint64_t channel_key,
@@ -230,7 +231,8 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                enum lttng_event_output output,
                int type,
                uint64_t tracefile_size,
-               uint64_t tracefile_count);
+               uint64_t tracefile_count,
+               unsigned int monitor);
 int consumer_is_data_pending(uint64_t session_id,
                struct consumer_output *consumer);
 int consumer_close_metadata(struct consumer_socket *socket,
index 044b1a81f58f19540a527370beadade74a6f297c..ef6dccb538219c86b70615b5323c00697f5a510d 100644 (file)
 #include "health.h"
 #include "kernel-consumer.h"
 
-/*
- * Sending a single channel to the consumer with command ADD_CHANNEL.
- */
-int kernel_consumer_add_channel(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session)
+static char *create_channel_path(struct consumer_output *consumer,
+               uid_t uid, gid_t gid)
 {
        int ret;
        char tmp_path[PATH_MAX];
-       const char *pathname;
-       struct lttcomm_consumer_msg lkm;
-       struct consumer_output *consumer;
+       char *pathname = NULL;
 
-       /* Safety net */
-       assert(channel);
-       assert(session);
-       assert(session->consumer);
-
-       consumer = session->consumer;
-
-       DBG("Kernel consumer adding channel %s to kernel consumer",
-                       channel->channel->name);
+       assert(consumer);
 
        /* Get the right path name destination */
        if (consumer->type == CONSUMER_DST_LOCAL) {
@@ -57,14 +44,13 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
                ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
                                consumer->dst.trace_path, consumer->subdir);
                if (ret < 0) {
-                       PERROR("snprintf metadata path");
+                       PERROR("snprintf kernel channel path");
                        goto error;
                }
-               pathname = tmp_path;
+               pathname = strndup(tmp_path, sizeof(tmp_path));
 
                /* Create directory */
-               ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG,
-                               session->uid, session->gid);
+               ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG, uid, gid);
                if (ret < 0) {
                        if (ret != -EEXIST) {
                                ERR("Trace directory creation error");
@@ -75,13 +61,53 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        } else {
                ret = snprintf(tmp_path, sizeof(tmp_path), "%s", consumer->subdir);
                if (ret < 0) {
-                       PERROR("snprintf metadata path");
+                       PERROR("snprintf kernel metadata path");
                        goto error;
                }
-               pathname = tmp_path;
+               pathname = strndup(tmp_path, sizeof(tmp_path));
                DBG3("Kernel network consumer subdir path: %s", pathname);
        }
 
+       return pathname;
+
+error:
+       free(pathname);
+       return NULL;
+}
+
+/*
+ * Sending a single channel to the consumer with command ADD_CHANNEL.
+ */
+int kernel_consumer_add_channel(struct consumer_socket *sock,
+               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
+               unsigned int monitor)
+{
+       int ret;
+       char *pathname;
+       struct lttcomm_consumer_msg lkm;
+       struct consumer_output *consumer;
+
+       /* Safety net */
+       assert(channel);
+       assert(session);
+       assert(session->consumer);
+
+       consumer = session->consumer;
+
+       DBG("Kernel consumer adding channel %s to kernel consumer",
+                       channel->channel->name);
+
+       if (monitor) {
+               pathname = create_channel_path(consumer, session->uid, session->gid);
+               if (!pathname) {
+                       ret = -1;
+                       goto error;
+               }
+       } else {
+               /* Empty path. */
+               pathname = "";
+       }
+
        /* Prep channel message structure */
        consumer_init_channel_comm_msg(&lkm,
                        LTTNG_CONSUMER_ADD_CHANNEL,
@@ -96,7 +122,8 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
                        channel->channel->attr.output,
                        CONSUMER_CHANNEL_TYPE_DATA,
                        channel->channel->attr.tracefile_size,
-                       channel->channel->attr.tracefile_count);
+                       channel->channel->attr.tracefile_count,
+                       monitor);
 
        health_code_update();
 
@@ -115,11 +142,10 @@ error:
  * Sending metadata to the consumer with command ADD_CHANNEL and ADD_STREAM.
  */
 int kernel_consumer_add_metadata(struct consumer_socket *sock,
-               struct ltt_kernel_session *session, int no_monitor)
+               struct ltt_kernel_session *session, unsigned int monitor)
 {
        int ret;
-       char tmp_path[PATH_MAX];
-       const char *pathname;
+       char *pathname;
        struct lttcomm_consumer_msg lkm;
        struct consumer_output *consumer;
 
@@ -133,35 +159,15 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        /* Get consumer output pointer */
        consumer = session->consumer;
 
-       /* Get the right path name destination */
-       if (consumer->type == CONSUMER_DST_LOCAL) {
-               /* Set application path to the destination path */
-               ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
-                               consumer->dst.trace_path, consumer->subdir);
-               if (ret < 0) {
-                       PERROR("snprintf metadata path");
+       if (monitor) {
+               pathname = create_channel_path(consumer, session->uid, session->gid);
+               if (!pathname) {
+                       ret = -1;
                        goto error;
                }
-               pathname = tmp_path;
-
-               /* Create directory */
-               ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG,
-                               session->uid, session->gid);
-               if (ret < 0) {
-                       if (ret != -EEXIST) {
-                               ERR("Trace directory creation error");
-                               goto error;
-                       }
-               }
-               DBG3("Kernel local consumer tracefile path: %s", pathname);
        } else {
-               ret = snprintf(tmp_path, sizeof(tmp_path), "%s", consumer->subdir);
-               if (ret < 0) {
-                       PERROR("snprintf metadata path");
-                       goto error;
-               }
-               pathname = tmp_path;
-               DBG3("Kernel network consumer subdir path: %s", pathname);
+               /* Empty path. */
+               pathname = "";
        }
 
        /* Prep channel message structure */
@@ -177,7 +183,8 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
                        1,
                        DEFAULT_KERNEL_CHANNEL_OUTPUT,
                        CONSUMER_CHANNEL_TYPE_METADATA,
-                       0, 0);
+                       0, 0,
+                       monitor);
 
        health_code_update();
 
@@ -223,7 +230,7 @@ error:
  */
 int kernel_consumer_add_stream(struct consumer_socket *sock,
                struct ltt_kernel_channel *channel, struct ltt_kernel_stream *stream,
-               struct ltt_kernel_session *session)
+               struct ltt_kernel_session *session, unsigned int monitor)
 {
        int ret;
        struct lttcomm_consumer_msg lkm;
@@ -266,7 +273,8 @@ error:
  * Send all stream fds of kernel channel to the consumer.
  */
 int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session)
+               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
+               unsigned int monitor)
 {
        int ret;
        struct ltt_kernel_stream *stream;
@@ -286,7 +294,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
        DBG("Sending streams of channel %s to kernel consumer",
                        channel->channel->name);
 
-       ret = kernel_consumer_add_channel(sock, channel, session);
+       ret = kernel_consumer_add_channel(sock, channel, session, monitor);
        if (ret < 0) {
                goto error;
        }
@@ -298,7 +306,8 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
                }
 
                /* Add stream on the kernel consumer side. */
-               ret = kernel_consumer_add_stream(sock, channel, stream, session);
+               ret = kernel_consumer_add_stream(sock, channel, stream, session,
+                               monitor);
                if (ret < 0) {
                        goto error;
                }
@@ -314,7 +323,7 @@ error:
 int kernel_consumer_send_session(struct consumer_socket *sock,
                struct ltt_kernel_session *session)
 {
-       int ret;
+       int ret, monitor = 0;
        struct ltt_kernel_channel *chan;
 
        /* Safety net */
@@ -328,10 +337,15 @@ int kernel_consumer_send_session(struct consumer_socket *sock,
                goto error;
        }
 
+       /* Don't monitor the streams on the consumer if in flight recorder. */
+       if (session->output_traces) {
+               monitor = 1;
+       }
+
        DBG("Sending session stream to kernel consumer");
 
        if (session->metadata_stream_fd >= 0) {
-               ret = kernel_consumer_add_metadata(sock, session, 0);
+               ret = kernel_consumer_add_metadata(sock, session, monitor);
                if (ret < 0) {
                        goto error;
                }
@@ -342,7 +356,8 @@ int kernel_consumer_send_session(struct consumer_socket *sock,
 
        /* Send channel and streams of it */
        cds_list_for_each_entry(chan, &session->channel_list.head, list) {
-               ret = kernel_consumer_send_channel_stream(sock, chan, session);
+               ret = kernel_consumer_send_channel_stream(sock, chan, session,
+                               monitor);
                if (ret < 0) {
                        goto error;
                }
index 9deb6b949803f0cb728b7be2af13fffedb2a1f9a..64795111a86af0a114dbcd365e1c1183c9a665fb 100644 (file)
 #include "trace-kernel.h"
 
 int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session);
+               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
+               unsigned int monitor);
 
 int kernel_consumer_send_session(struct consumer_socket *sock,
                struct ltt_kernel_session *session);
 
 int kernel_consumer_add_stream(struct consumer_socket *sock,
                struct ltt_kernel_channel *channel, struct ltt_kernel_stream *stream,
-               struct ltt_kernel_session *session);
+               struct ltt_kernel_session *session, unsigned int monitor);
 
 int kernel_consumer_add_metadata(struct consumer_socket *sock,
-               struct ltt_kernel_session *session, int no_monitor);
+               struct ltt_kernel_session *session, unsigned int monitor);
 
 int kernel_consumer_add_channel(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session);
+               struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
+               unsigned int monitor);
index 3b27c6f36fee19ca345add26ba6f427c2a253f27..c02f6d91e2ba904819c58f3058d83efef218c6fd 100644 (file)
@@ -646,7 +646,8 @@ static int update_kernel_stream(struct consumer_data *consumer_data, int fd)
 
                                                pthread_mutex_lock(socket->lock);
                                                ret = kernel_consumer_send_channel_stream(socket,
-                                                               channel, ksess);
+                                                               channel, ksess,
+                                                               session->output_traces ? 1 : 0);
                                                pthread_mutex_unlock(socket->lock);
                                                if (ret < 0) {
                                                        rcu_read_unlock();
@@ -2377,7 +2378,7 @@ static int create_ust_session(struct ltt_session *session,
 
        lus->uid = session->uid;
        lus->gid = session->gid;
-
+       lus->output_traces = session->output_traces;
        session->ust_session = lus;
 
        /* Copy session output to the newly created UST session */
@@ -2434,6 +2435,7 @@ static int create_kernel_session(struct ltt_session *session)
 
        session->kernel_session->uid = session->uid;
        session->kernel_session->gid = session->gid;
+       session->kernel_session->output_traces = session->output_traces;
 
        return LTTNG_OK;
 
index d1f6e5f00a82b42ff177a7883a59ef4f29143c4e..21ffd336d51b90b77f0c31b36ab8105e2f4b5b10 100644 (file)
@@ -111,6 +111,8 @@ struct ltt_kernel_session {
        unsigned int id;
        /* Session is started and active */
        unsigned int started;
+       /* Tell or not if the session has to output the traces. */
+       unsigned int output_traces;
 };
 
 /*
index dcb45c2373d802fa92d04adbedd393d3d310b6ad..03f37abaa6900723422fca8762bf5ea893d020a7 100644 (file)
@@ -105,6 +105,8 @@ struct ltt_ust_session {
        uint64_t next_channel_id;
        /* Once this value reaches UINT32_MAX, no more id can be allocated. */
        uint64_t used_channel_id;
+       /* Tell or not if the session has to output the traces. */
+       unsigned int output_traces;
 };
 
 /*
index dd0f6f8db96c81fcf1e2cf643c951c725857c272..56cbb8578544fa56c9f2e6bdf8085483f22064ec 100644 (file)
@@ -1440,6 +1440,7 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
        ua_sess->bits_per_long = app->bits_per_long;
        /* There is only one consumer object per session possible. */
        ua_sess->consumer = usess->consumer;
+       ua_sess->output_traces = usess->output_traces;
 
        switch (ua_sess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
index 29866944057acaa8f491e372bff081908ac71eb3..74d4cd6a2619c40d4b9acd52dbcc12049b34f241 100644 (file)
@@ -197,6 +197,8 @@ struct ust_app_session {
        uint32_t bits_per_long;
        /* For delayed reclaim */
        struct rcu_head rcu_head;
+       /* If the channel's streams have to be outputed or not. */
+       unsigned int output_traces;
 };
 
 /*
index 367e92cd32368b2b4b522834bad22010c1668cf7..72b68bb7f7bed39d03ed5860381ef70d94df5ad8 100644 (file)
@@ -157,7 +157,8 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                        registry->uuid,
                        chan_id,
                        ua_chan->tracefile_size,
-                       ua_chan->tracefile_count);
+                       ua_chan->tracefile_count,
+                       ua_sess->output_traces);
 
        health_code_update();
 
index ddd2983e238208a0888a90638c539bda692111cf..72702d5a54743a1d91a652ebb6707ff428f156bd 100644 (file)
@@ -40,6 +40,7 @@ static char *opt_url;
 static char *opt_ctrl_url;
 static char *opt_data_url;
 static int opt_no_consumer;
+static int opt_no_output;
 static int opt_disable_consumer;
 
 enum {
@@ -55,7 +56,8 @@ static struct poptOption long_options[] = {
        {"set-url",        'U', POPT_ARG_STRING, &opt_url, 0, 0, 0},
        {"ctrl-url",       'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0},
        {"data-url",       'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0},
-       {"no-consumer",      0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0},
+       {"no-output",       0, POPT_ARG_VAL, &opt_no_output, 1, 0, 0},
+       {"no-consumer",     0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0},
        {"disable-consumer", 0, POPT_ARG_VAL, &opt_disable_consumer, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
 };
@@ -80,6 +82,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "  -h, --help           Show this help\n");
        fprintf(ofp, "      --list-options   Simple listing of options\n");
        fprintf(ofp, "  -o, --output PATH    Specify output path for traces\n");
+       fprintf(ofp, "      --no-output      Traces will not be outputed\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Extended Options:\n");
        fprintf(ofp, "\n");
@@ -248,7 +251,7 @@ static int create_session(void)
        } else if (opt_url) { /* Handling URL (-U opt) */
                url = opt_url;
                print_str_url = url;
-       } else {
+       } else if (!opt_no_output) {
                /* Auto output path */
                alloc_path = utils_get_home_dir();
                if (alloc_path == NULL) {
@@ -272,6 +275,9 @@ static int create_session(void)
                if (!opt_data_url && !opt_ctrl_url) {
                        print_str_url = alloc_url + strlen("file://");
                }
+       } else {
+               /* No output means --no-output. */
+               url = NULL;
        }
 
        if ((!opt_ctrl_url && opt_data_url) || (opt_ctrl_url && !opt_data_url)) {
@@ -357,7 +363,7 @@ int cmd_create(int argc, const char **argv)
        }
 
        if (opt_no_consumer) {
-               MSG("The option --no-consumer is obsolete.");
+               MSG("The option --no-consumer is obsolete. Use --no-output now.");
                ret = CMD_WARNING;
                goto end;
        }
index b9b5818808203332f220d97f21a23b30dff982b6..e3b6cd5bfd3d3673063b12c0d1900808a5258758 100644 (file)
@@ -747,7 +747,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                uint64_t relayd_id,
                enum lttng_event_output output,
                uint64_t tracefile_size,
-               uint64_t tracefile_count)
+               uint64_t tracefile_count,
+               unsigned int monitor)
 {
        struct lttng_consumer_channel *channel;
 
@@ -766,6 +767,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        channel->output = output;
        channel->tracefile_size = tracefile_size;
        channel->tracefile_count = tracefile_count;
+       channel->monitor = monitor;
 
        strncpy(channel->pathname, pathname, sizeof(channel->pathname));
        channel->pathname[sizeof(channel->pathname) - 1] = '\0';
index d0986ef1e3203a420f2054b75da65ab94cdfcd77..9fadc5a06e9cc21743854829c57832550a11f958 100644 (file)
@@ -156,6 +156,12 @@ struct lttng_consumer_channel {
        /* On-disk circular buffer */
        uint64_t tracefile_size;
        uint64_t tracefile_count;
+       /*
+        * Monitor or not the streams of this channel meaning this indicates if the
+        * streams should be sent to the data/metadata thread or added to the no
+        * monitor list of the channel.
+        */
+       unsigned int monitor;
 };
 
 /*
@@ -476,7 +482,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                uint64_t relayd_id,
                enum lttng_event_output output,
                uint64_t tracefile_size,
-               uint64_t tracefile_count);
+               uint64_t tracefile_count,
+               unsigned int monitor);
 void consumer_del_stream(struct lttng_consumer_stream *stream,
                struct lttng_ht *ht);
 void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
index d4a0d7c67c2810a649821cda28a2dc6748d0388d..86428f0663141fa250905e269d7ceea22c5cb43d 100644 (file)
@@ -144,7 +144,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                msg.u.channel.name, msg.u.channel.uid, msg.u.channel.gid,
                                msg.u.channel.relayd_id, msg.u.channel.output,
                                msg.u.channel.tracefile_size,
-                               msg.u.channel.tracefile_count);
+                               msg.u.channel.tracefile_count,
+                               msg.u.channel.monitor);
                if (new_channel == NULL) {
                        lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
                        goto end_nosignal;
@@ -317,7 +318,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        }
                }
 
-               if (msg.u.stream.no_monitor) {
+               /* Do not monitor this stream. */
+               if (!channel->monitor) {
                        DBG("Kernel consumer add stream %s in no monitor mode with"
                                        "relayd id %" PRIu64, new_stream->name,
                                        new_stream->relayd_stream_id);
@@ -561,8 +563,11 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
 
        assert(stream);
 
-       /* Don't create anything if this is set for streaming. */
-       if (stream->net_seq_idx == (uint64_t) -1ULL) {
+       /*
+        * Don't create anything if this is set for streaming or should not be
+        * monitored.
+        */
+       if (stream->net_seq_idx == (uint64_t) -1ULL && stream->chan->monitor) {
                ret = utils_create_stream_file(stream->chan->pathname, stream->name,
                                stream->chan->tracefile_size, stream->tracefile_count_current,
                                stream->uid, stream->gid);
index 07c645cc77c93ec021b503ae39eb030a96015a06..07c3ff1f5249146d311df90b44664a38b36d16c8 100644 (file)
@@ -319,6 +319,8 @@ struct lttcomm_consumer_msg {
                        int type; /* Per cpu or metadata. */
                        uint64_t tracefile_size; /* bytes */
                        uint32_t tracefile_count; /* number of tracefiles */
+                       /* If the channel's streams have to be monitored or not. */
+                       uint32_t monitor;
                } LTTNG_PACKED channel; /* Only used by Kernel. */
                struct {
                        uint64_t stream_key;
@@ -360,6 +362,8 @@ struct lttcomm_consumer_msg {
                        uint32_t chan_id;                       /* Channel ID on the tracer side. */
                        uint64_t tracefile_size;        /* bytes */
                        uint32_t tracefile_count;       /* number of tracefiles */
+                       /* Tells the consumer if the stream should be or not monitored. */
+                       uint32_t monitor;
                } LTTNG_PACKED ask_channel;
                struct {
                        uint64_t key;
index 8ade3b35f272bfd6a0d77eb42094f8e521cbb026..f24b5fa3e2587039a57e4fca3eef192bc80ed6c3 100644 (file)
@@ -114,13 +114,14 @@ error:
 static struct lttng_consumer_channel *allocate_channel(uint64_t session_id,
                const char *pathname, const char *name, uid_t uid, gid_t gid,
                int relayd_id, uint64_t key, enum lttng_event_output output,
-               uint64_t tracefile_size, uint64_t tracefile_count)
+               uint64_t tracefile_size, uint64_t tracefile_count,
+               unsigned int monitor)
 {
        assert(pathname);
        assert(name);
 
        return consumer_allocate_channel(key, session_id, pathname, name, uid, gid,
-                       relayd_id, output, tracefile_size, tracefile_count);
+                       relayd_id, output, tracefile_size, tracefile_count, monitor);
 }
 
 /*
@@ -924,7 +925,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                msg.u.ask_channel.relayd_id, msg.u.ask_channel.key,
                                (enum lttng_event_output) msg.u.ask_channel.output,
                                msg.u.ask_channel.tracefile_size,
-                               msg.u.ask_channel.tracefile_count);
+                               msg.u.ask_channel.tracefile_count,
+                               msg.u.ask_channel.monitor);
                if (!channel) {
                        goto end_channel_error;
                }
index c9693f711f5140f26f63c2b34fa99bb578ca321c..3863aa1ceb9de16836d4edc6c55d908fd289e08f 100644 (file)
@@ -1471,7 +1471,7 @@ int _lttng_create_session_ext(const char *name, const char *url,
        struct lttcomm_session_msg lsm;
        struct lttng_uri *uris = NULL;
 
-       if (name == NULL || datetime == NULL || url == NULL) {
+       if (name == NULL || datetime == NULL) {
                return -LTTNG_ERR_INVALID;
        }
 
This page took 0.040488 seconds and 4 git commands to generate.