consumer = ksession->consumer;
/* Prep channel message structure */
- consumer_init_add_channel_comm_msg(&lkm, ksession->metadata->key,
- ksession->id, "", ksession->uid, ksession->gid,
- consumer->net_seq_index, DEFAULT_METADATA_NAME, 1,
- DEFAULT_KERNEL_CHANNEL_OUTPUT,
- CONSUMER_CHANNEL_TYPE_METADATA, 0, 0, monitor, 0,
- ksession->is_live_session, 0,
+ consumer_init_add_channel_comm_msg(&lkm,
+ ksession->metadata->key,
+ ksession->id,
+ "",
+ ksession->uid,
+ ksession->gid,
+ consumer->net_seq_index,
+ ksession->metadata->conf->name,
+ 1,
+ ksession->metadata->conf->attr.output,
+ CONSUMER_CHANNEL_TYPE_METADATA,
+ ksession->metadata->conf->attr.tracefile_size,
+ ksession->metadata->conf->attr.tracefile_count,
+ monitor,
+ ksession->metadata->conf->attr.live_timer_interval,
+ ksession->is_live_session,
+ 0,
ksession->current_trace_chunk);
health_code_update();
#include "bin/lttng-sessiond/tracker.h"
#include "common/tracker.h"
#include "common/utils.h"
+#include "lttng/event.h"
#include "lttng/lttng-error.h"
#include "lttng/tracker.h"
#define _LGPL_SOURCE
#include <common/common.h>
#include <common/defaults.h>
#include <common/trace-chunk.h>
+#include <common/macros.h>
#include "consumer.h"
#include "trace-kernel.h"
*/
struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
{
+ int ret;
struct ltt_kernel_metadata *lkm;
struct lttng_channel *chan;
goto error;
}
+ ret = lttng_strncpy(
+ chan->name, DEFAULT_METADATA_NAME, sizeof(chan->name));
+ if (ret) {
+ ERR("Failed to initialize metadata channel name to `%s`",
+ DEFAULT_METADATA_NAME);
+ goto error;
+ }
+
/* Set default attributes */
- chan->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
+ chan->attr.overwrite = DEFAULT_METADATA_OVERWRITE;
chan->attr.subbuf_size = default_get_metadata_subbuf_size();
chan->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
- chan->attr.switch_timer_interval = DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
- chan->attr.read_timer_interval = DEFAULT_KERNEL_CHANNEL_READ_TIMER;
- chan->attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
+ chan->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
+ chan->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;;
+
+
+ /*
+ * The metadata channel of kernel sessions must use the "mmap"
+ * back-end since the consumer daemon accumulates complete
+ * metadata units before sending them to the relay daemon in
+ * live mode. The consumer daemon also needs to extract the contents
+ * of the metadata cache when computing a rotation position.
+ *
+ * In both cases, it is not possible to rely on the splice
+ * back-end as the consumer daemon may need to accumulate more
+ * content than can be backed by the ring buffer's underlying
+ * pages.
+ */
+ chan->attr.output = LTTNG_EVENT_MMAP;
+ chan->attr.tracefile_size = 0;
+ chan->attr.tracefile_count = 0;
+ chan->attr.live_timer_interval = 0;
/* Init metadata */
lkm->fd = -1;
#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE
#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM
#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE
-#define DEFAULT_METADATA_SWITCH_TIMER CONFIG_DEFAULT_METADATA_SWITCH_TIMER
-#define DEFAULT_METADATA_READ_TIMER CONFIG_DEFAULT_METADATA_READ_TIMER
-#define DEFAULT_METADATA_OUTPUT _DEFAULT_CHANNEL_OUTPUT
+#define DEFAULT_METADATA_SWITCH_TIMER 0
+#define DEFAULT_METADATA_READ_TIMER 0
+#define DEFAULT_METADATA_OVERWRITE 0
+#define DEFAULT_METADATA_OUTPUT LTTNG_EVENT_MMAP
/* Kernel has different defaults */
ok(kern->metadata->fd == -1 &&
kern->metadata->conf != NULL &&
kern->metadata->conf->attr.overwrite
- == DEFAULT_CHANNEL_OVERWRITE &&
+ == DEFAULT_METADATA_OVERWRITE &&
kern->metadata->conf->attr.subbuf_size
== default_get_metadata_subbuf_size() &&
kern->metadata->conf->attr.num_subbuf
== DEFAULT_METADATA_SUBBUF_NUM &&
kern->metadata->conf->attr.switch_timer_interval
- == DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER &&
+ == DEFAULT_METADATA_SWITCH_TIMER &&
kern->metadata->conf->attr.read_timer_interval
- == DEFAULT_KERNEL_CHANNEL_READ_TIMER &&
+ == DEFAULT_METADATA_READ_TIMER &&
kern->metadata->conf->attr.output
- == DEFAULT_KERNEL_CHANNEL_OUTPUT,
+ == LTTNG_EVENT_MMAP,
"Validate kernel session metadata");
trace_kernel_destroy_metadata(kern->metadata);