*/
#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
struct lttng_channel_attr {
- int overwrite; /* 1: overwrite, 0: discard */
+ int overwrite; /* -1: session default, 1: overwrite, 0: discard */
uint64_t subbuf_size; /* bytes, power of 2 */
uint64_t num_subbuf; /* power of 2 */
unsigned int switch_timer_interval; /* usec */
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) {
+ attr->attr.overwrite = !!ksession->snapshot_mode;
+ }
+
+ /* 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;
}
}
}
+ /*
+ * 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) {
+ attr->attr.overwrite = !!usess->snapshot_mode;
+ }
+
+ /* 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;
}
MSG("Default snapshot output set to: %s", print_str_url);
}
MSG("Snapshot mode set. Every channel enabled for that session will "
- "be set in overwrite mode and mmap output.");
+ "be set to mmap output, and default to overwrite mode.");
}
if (opt_shm_path) {
MSG("Session %s set to shm_path: %s.", session_name,
#define DEFAULT_PYTHON_EVENT_COMPONENT "lttng_python"
#define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*"
-#define DEFAULT_CHANNEL_OVERWRITE 0
+#define DEFAULT_CHANNEL_OVERWRITE -1
#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE
#define DEFAULT_CHANNEL_TRACEFILE_COUNT CONFIG_DEFAULT_CHANNEL_TRACEFILE_COUNT