X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-kernel.c;h=0c472c00f9188677743aac78e266ab1e786a297c;hb=17136d8c6c88034daa1f214ee1716c59d6e4fd95;hp=dcb1bd647b9a0a622b6cbd39c94979d1e0d30e1a;hpb=dcabc1905756b2999886313ec33705f7571a3fb9;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index dcb1bd647..0c472c00f 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -28,6 +28,8 @@ #include #include +#include +#include #include "consumer.h" #include "trace-kernel.h" @@ -38,7 +40,7 @@ * Find the channel name for the given kernel session. */ struct ltt_kernel_channel *trace_kernel_get_channel_by_name( - char *name, struct ltt_kernel_session *session) + const char *name, struct ltt_kernel_session *session) { struct ltt_kernel_channel *chan; @@ -328,8 +330,8 @@ enum lttng_error_code trace_kernel_create_event( break; case LTTNG_EVENT_USERSPACE_PROBE: { - struct lttng_userspace_probe_location* location = NULL; - struct lttng_userspace_probe_location_lookup_method *lookup = NULL; + const struct lttng_userspace_probe_location* location = NULL; + const struct lttng_userspace_probe_location_lookup_method *lookup = NULL; location = lttng_event_get_userspace_probe_location(ev); if (!location) { @@ -464,6 +466,7 @@ error: */ struct ltt_kernel_metadata *trace_kernel_create_metadata(void) { + int ret; struct ltt_kernel_metadata *lkm; struct lttng_channel *chan; @@ -474,13 +477,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; @@ -709,7 +737,11 @@ void trace_kernel_destroy_session(struct ltt_kernel_session *session) cds_list_for_each_entry_safe(channel, ctmp, &session->channel_list.head, list) { trace_kernel_destroy_channel(channel); } +} +/* Free elements needed by destroy notifiers. */ +void trace_kernel_free_session(struct ltt_kernel_session *session) +{ /* Wipe consumer output object */ consumer_output_put(session->consumer);