X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fkernel-consumer%2Fkernel-consumer.c;h=54314ec75a2c4d7758fd3c3ac2cd4d8492dee893;hb=fd424d99bfddf3581bc55fdf14799a50661beddd;hp=275c963df2305dee886327378f0a6a78e977e8db;hpb=128708c34ee7d054755d110df12940155c2dd781;p=deliverable%2Flttng-tools.git diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 275c963df..54314ec75 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -7,6 +7,7 @@ * */ +#include "common/buffer-view.h" #include #define _LGPL_SOURCE #include @@ -249,9 +250,9 @@ static int lttng_kconsumer_snapshot_channel( ssize_t read_len; unsigned long len, padded_len; const char *subbuf_addr; + struct lttng_buffer_view subbuf_view; health_code_update(); - DBG("Kernel consumer taking snapshot at pos %lu", consumed_pos); ret = kernctl_get_subbuf(stream->wait_fd, &consumed_pos); @@ -283,8 +284,10 @@ static int lttng_kconsumer_snapshot_channel( goto error_put_subbuf; } + subbuf_view = lttng_buffer_view_init( + subbuf_addr, 0, padded_len); read_len = lttng_consumer_on_read_subbuffer_mmap(ctx, - stream, subbuf_addr, len, + stream, &subbuf_view, padded_len - len, NULL); /* * We write the padded len in local tracefiles but the data len @@ -1720,6 +1723,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, case CONSUMER_CHANNEL_MMAP: { const char *subbuf_addr; + struct lttng_buffer_view subbuf_view; /* Get subbuffer size without padding */ err = kernctl_get_subbuf_size(infd, &subbuf_size); @@ -1750,15 +1754,15 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, padding = len - subbuf_size; + subbuf_view = lttng_buffer_view_init(subbuf_addr, 0, len); + /* write the subbuffer to the tracefile */ - ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, - subbuf_addr, - subbuf_size, - padding, &index); + ret = lttng_consumer_on_read_subbuffer_mmap( + ctx, stream, &subbuf_view, padding, &index); /* - * The mmap operation should write subbuf_size amount of data when - * network streaming or the full padding (len) size when we are _not_ - * streaming. + * The mmap operation should write subbuf_size amount of data + * when network streaming or the full padding (len) size when we + * are _not_ streaming. */ if ((ret != subbuf_size && stream->net_seq_idx != (uint64_t) -1ULL) || (ret != len && stream->net_seq_idx == (uint64_t) -1ULL)) {