Mi: mi backend + mi for command version
[lttng-tools.git] / src / bin / lttng / commands / enable_channels.c
index 18f8d020eef5089ef4309ec9608a3ebd5589fcd7..1fdaada99f625a9418683b3e24ecd763a5437da1 100644 (file)
@@ -130,12 +130,14 @@ static void usage(FILE *ofp)
                        DEFAULT_UST_PID_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
                        DEFAULT_KERNEL_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
                        DEFAULT_METADATA_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice);
-       fprintf(ofp, "      --buffers-uid        Use per UID buffer (-u/-j only)\n");
-       fprintf(ofp, "      --buffers-pid        Use per PID buffer (-u/-j only)\n");
+       fprintf(ofp, "      --buffers-uid        Use per UID buffer (-u only)\n");
+       fprintf(ofp, "      --buffers-pid        Use per PID buffer (-u only)\n");
        fprintf(ofp, "      --buffers-global     Use shared buffer for the whole system (-k only)\n");
        fprintf(ofp, "  -C, --tracefile-size SIZE\n");
        fprintf(ofp, "                           Maximum size of each tracefile within a stream (in bytes). 0 means unlimited.\n");
        fprintf(ofp, "                               (default: %u)\n", DEFAULT_CHANNEL_TRACEFILE_SIZE);
+       fprintf(ofp, "                           Note: traces generated with this option may inaccurately report\n");
+       fprintf(ofp, "                           discarded events as per CTF 1.8.\n");
        fprintf(ofp, "  -W, --tracefile-count COUNT\n");
        fprintf(ofp, "                           Used in conjunction with -C option, this will limit the number\n");
        fprintf(ofp, "                           of files created to the specified count. 0 means unlimited.\n");
@@ -169,7 +171,7 @@ static void set_default_attr(struct lttng_domain *dom)
        if (chan.attr.read_timer_interval == -1) {
                chan.attr.read_timer_interval = default_attr.read_timer_interval;
        }
-       if (chan.attr.output == -1) {
+       if ((int) chan.attr.output == -1) {
                chan.attr.output = default_attr.output;
        }
        if (chan.attr.tracefile_count == -1) {
@@ -327,6 +329,13 @@ int cmd_enable_channels(int argc, const char **argv)
        pc = poptGetContext(NULL, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
 
+       /* TODO: mi support */
+       if (lttng_opt_mi) {
+               ret = -LTTNG_ERR_MI_NOT_IMPLEMENTED;
+               ERR("mi option not supported");
+               goto end;
+       }
+
        while ((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                case OPT_HELP:
@@ -356,6 +365,13 @@ int cmd_enable_channels(int argc, const char **argv)
                        order = get_count_order_u64(chan.attr.subbuf_size);
                        assert(order >= 0);
                        rounded_size = 1ULL << order;
+                       if (rounded_size < chan.attr.subbuf_size) {
+                               ERR("The subbuf size (%" PRIu64 ") is rounded and overflows!",
+                                               chan.attr.subbuf_size);
+                               ret = CMD_ERROR;
+                               goto end;
+                       }
+
                        if (rounded_size != chan.attr.subbuf_size) {
                                WARN("The subbuf size (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
                                                chan.attr.subbuf_size, rounded_size);
@@ -385,6 +401,13 @@ int cmd_enable_channels(int argc, const char **argv)
                        order = get_count_order_u64(chan.attr.num_subbuf);
                        assert(order >= 0);
                        rounded_size = 1ULL << order;
+                       if (rounded_size < chan.attr.num_subbuf) {
+                               ERR("The number of subbuffers (%" PRIu64 ") is rounded and overflows!",
+                                               chan.attr.num_subbuf);
+                               ret = CMD_ERROR;
+                               goto end;
+                       }
+
                        if (rounded_size != chan.attr.num_subbuf) {
                                WARN("The number of subbuffers (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
                                                chan.attr.num_subbuf, rounded_size);
This page took 0.024983 seconds and 5 git commands to generate.