X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=liblttng-ust-ctl%2Fustctl.c;h=89b566bdccaceade94a553f235a6f1d36f7f0b7a;hb=f574bfb4d81b26d3cfc0243868d138e33470a950;hp=84476a97966a7eae18f767c6f6683e269b80b603;hpb=5198080d2234eb06e95d245d0a9747810f496475;p=lttng-ust.git diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 84476a97..89b566bd 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -45,7 +45,7 @@ * Channel representation within consumer. */ struct ustctl_consumer_channel { - struct lttng_channel *chan; /* lttng channel buffers */ + struct lttng_ust_channel_buffer *chan; /* lttng channel buffers */ /* initial attributes */ struct ustctl_consumer_channel_attr attr; @@ -587,9 +587,10 @@ int ustctl_create_event_notifier(int sock, struct lttng_ust_abi_event_notifier * free(event_notifier_data); return ret; } - /* Send struct lttng_ust_event_notifier */ + /* Send struct lttng_ust_abi_event_notifier */ len = ustcomm_send_unix_sock(sock, event_notifier, sizeof(*event_notifier)); if (len != sizeof(*event_notifier)) { + free(event_notifier_data); if (len < 0) return len; else @@ -1279,7 +1280,7 @@ struct ustctl_consumer_channel * if (!chan) return NULL; - chan->chan = transport->ops.channel_create(transport_name, NULL, + chan->chan = transport->ops.priv->channel_create(transport_name, NULL, attr->subbuf_size, attr->num_subbuf, attr->switch_timer_interval, attr->read_timer_interval, @@ -1304,7 +1305,7 @@ void ustctl_destroy_channel(struct ustctl_consumer_channel *chan) { (void) ustctl_channel_close_wait_fd(chan); (void) ustctl_channel_close_wakeup_fd(chan); - chan->chan->ops->channel_destroy(chan->chan); + chan->chan->ops->priv->channel_destroy(chan->chan); free(chan); } @@ -1343,17 +1344,17 @@ int ustctl_write_metadata_to_channel( size_t len) /* metadata length */ { struct lttng_ust_lib_ring_buffer_ctx ctx; - struct lttng_channel *chan = channel->chan; + struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; const char *str = metadata_str; int ret = 0, waitret; size_t reserve_len, pos; for (pos = 0; pos < len; pos += reserve_len) { reserve_len = min_t(size_t, - chan->ops->packet_avail_size(chan->chan, chan->handle), + lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len - pos); - lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len, - sizeof(char), -1, chan->handle); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, + sizeof(char), -1, lttng_chan_buf->handle); /* * We don't care about metadata buffer's records lost * count, because we always retry here. Report error if @@ -1362,7 +1363,7 @@ int ustctl_write_metadata_to_channel( */ waitret = wait_cond_interruptible_timeout( ({ - ret = chan->ops->event_reserve(&ctx, 0); + ret = lttng_chan_buf->ops->event_reserve(&ctx, 0); ret != -ENOBUFS || !ret; }), LTTNG_METADATA_TIMEOUT_MSEC); @@ -1374,8 +1375,8 @@ int ustctl_write_metadata_to_channel( ret = waitret; goto end; } - chan->ops->event_write(&ctx, &str[pos], reserve_len); - chan->ops->event_commit(&ctx); + lttng_chan_buf->ops->event_write(&ctx, &str[pos], reserve_len); + lttng_chan_buf->ops->event_commit(&ctx); } end: return ret; @@ -1391,25 +1392,25 @@ ssize_t ustctl_write_one_packet_to_channel( size_t len) /* metadata length */ { struct lttng_ust_lib_ring_buffer_ctx ctx; - struct lttng_channel *chan = channel->chan; + struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; const char *str = metadata_str; ssize_t reserve_len; int ret; reserve_len = min_t(ssize_t, - chan->ops->packet_avail_size(chan->chan, chan->handle), + lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len); - lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len, - sizeof(char), -1, chan->handle); - ret = chan->ops->event_reserve(&ctx, 0); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, + sizeof(char), -1, lttng_chan_buf->handle); + ret = lttng_chan_buf->ops->event_reserve(&ctx, 0); if (ret != 0) { DBG("LTTng: event reservation failed"); assert(ret < 0); reserve_len = ret; goto end; } - chan->ops->event_write(&ctx, str, reserve_len); - chan->ops->event_commit(&ctx); + lttng_chan_buf->ops->event_write(&ctx, str, reserve_len); + lttng_chan_buf->ops->event_commit(&ctx); end: return reserve_len; @@ -2004,7 +2005,7 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, return client_cb->instance_id(buf, handle, id); } -#ifdef HAVE_PERF_EVENT +#ifdef HAVE_LINUX_PERF_EVENT_H int ustctl_has_perf_counters(void) {