Allow channel mode override in snapshot sessions
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / channel.c
index 0119abf6a3a25e0849446de8de726d12d82fe79e..7bb0ff7e9311b4a043154970eae323dfda2a67d7 100644 (file)
@@ -214,9 +214,20 @@ int channel_kernel_create(struct ltt_kernel_session *ksession,
                attr = defattr;
        }
 
+       /*
+        * Set the overwrite mode for this channel based on the session
+        * type unless the client explicitly overrides the channel mode.
+        */
+       if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) {
+               if (ksession->snapshot_mode) {
+                       attr->attr.overwrite = 1;
+               } else {
+                       attr->attr.overwrite = 0;
+               }
+       }
+
+       /* Enforce mmap output for snapshot sessions. */
        if (ksession->snapshot_mode) {
-               /* Force channel attribute for snapshot mode. */
-               attr->attr.overwrite = 1;
                attr->attr.output = LTTNG_EVENT_MMAP;
        }
 
@@ -318,9 +329,20 @@ int channel_ust_create(struct ltt_ust_session *usess,
                }
        }
 
+       /*
+        * Set the overwrite mode for this channel based on the session
+        * type unless the client explicitly overrides the channel mode.
+        */
+       if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) {
+               if (usess->snapshot_mode) {
+                       attr->attr.overwrite = 1;
+               } else {
+                       attr->attr.overwrite = 0;
+               }
+       }
+
+       /* Enforce mmap output for snapshot sessions. */
        if (usess->snapshot_mode) {
-               /* Force channel attribute for snapshot mode. */
-               attr->attr.overwrite = 1;
                attr->attr.output = LTTNG_EVENT_MMAP;
        }
 
This page took 0.029097 seconds and 5 git commands to generate.