X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-kernel.c;h=dfdc9fd14e96b9b2124034983dc0d1db4525633a;hp=723ffddd33118ebfd639135decc22bbe1b2c54de;hb=e368fb4396b9bdb22de16f0c93512c9f6d7ab0b4;hpb=159b042f34366d0fde5dcd73b4231c558922a664 diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 723ffddd3..dfdc9fd14 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "consumer.h" #include "trace-kernel.h" @@ -390,16 +391,10 @@ enum lttng_error_code trace_kernel_create_event( /* * Save a reference to the probe location used during - * the listing of events. Close its FD since it won't - * be needed for listing. + * the listing of events. */ userspace_probe_location = lttng_userspace_probe_location_copy(location); - ret = lttng_userspace_probe_location_function_set_binary_fd( - userspace_probe_location, -1); - if (ret) { - goto error; - } break; case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT: /* Get the file descriptor on the target binary. */ @@ -408,15 +403,10 @@ enum lttng_error_code trace_kernel_create_event( /* * Save a reference to the probe location used during the listing of - * events. Close its FD since it won't be needed for listing. + * events. */ userspace_probe_location = lttng_userspace_probe_location_copy(location); - ret = lttng_userspace_probe_location_tracepoint_set_binary_fd( - userspace_probe_location, -1); - if (ret) { - goto error; - } break; default: DBG("Unsupported lookup method type"); @@ -485,6 +475,7 @@ error: */ struct ltt_kernel_metadata *trace_kernel_create_metadata(void) { + int ret; struct ltt_kernel_metadata *lkm; struct lttng_channel *chan; @@ -495,13 +486,38 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void) 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;