X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libust%2Fltt-events.c;h=94d57c3372b5c7b7a58a43899c0c658272c0c35f;hb=2629549eb1e9a5d9673123a8e9b09e3b6703a47b;hp=d28a430d4c649776af1abb4ae02f9d441dcb3216;hpb=403c40b4b90356fddbb18cd12c6e6891c8bd317b;p=lttng-ust.git diff --git a/libust/ltt-events.c b/libust/ltt-events.c index d28a430d..94d57c33 100644 --- a/libust/ltt-events.c +++ b/libust/ltt-events.c @@ -18,11 +18,14 @@ #include #include #include -#include "usterr_signal_safe.h" +#include +#include +#include +#include #include "ust/core.h" -#include "ltt-events.h" #include "ltt-tracer.h" #include "ust/wait.h" +#include "../libringbuffer/shm.h" static CDS_LIST_HEAD(sessions); static CDS_LIST_HEAD(ltt_transport_list); @@ -47,10 +50,10 @@ struct ltt_session *ltt_session_create(void) { struct ltt_session *session; - pthread_mutex_lock(&sessions_mutex); session = zmalloc(sizeof(struct ltt_session)); if (!session) return NULL; + pthread_mutex_lock(&sessions_mutex); CDS_INIT_LIST_HEAD(&session->chan); CDS_INIT_LIST_HEAD(&session->events); uuid_generate(session->uuid); @@ -194,8 +197,7 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, - unsigned int read_timer_interval, - int *shmid) + unsigned int read_timer_interval) { struct ltt_channel *chan; struct ltt_transport *transport; @@ -219,9 +221,9 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, * headers. Therefore the "chan" information used as input * should be already accessible. */ - chan->chan = transport->ops.channel_create("[lttng]", chan, buf_addr, + transport->ops.channel_create("[lttng]", chan, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, - read_timer_interval, shmid); + read_timer_interval); if (!chan->chan) goto create_error; chan->enabled = 1; @@ -245,7 +247,7 @@ active: static void _ltt_channel_destroy(struct ltt_channel *chan) { - chan->ops->channel_destroy(chan->chan); + chan->ops->channel_destroy(chan); cds_list_del(&chan->list); lttng_destroy_context(chan->ctx); free(chan); @@ -384,10 +386,10 @@ int lttng_metadata_printf(struct ltt_session *session, for (pos = 0; pos < len; pos += reserve_len) { reserve_len = min_t(size_t, - chan->ops->packet_avail_size(chan->chan), + chan->ops->packet_avail_size(chan->chan, chan->handle), len - pos); lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len, - sizeof(char), -1); + sizeof(char), -1, chan->handle); /* * We don't care about metadata buffer's records lost * count, because we always retry here. Report error if @@ -400,7 +402,7 @@ int lttng_metadata_printf(struct ltt_session *session, ret != -ENOBUFS || !ret; }), LTTNG_METADATA_TIMEOUT_MSEC); - if (!waitret || waitret == -EINTR || ret) { + if (waitret == -ETIMEDOUT || waitret == -EINTR || ret) { DBG("LTTng: Failure to write metadata to buffers (%s)\n", waitret == -EINTR ? "interrupted" : (ret == -ENOBUFS ? "timeout" : "I/O error")); @@ -750,8 +752,8 @@ int _ltt_event_header_declare(struct ltt_session *session) " } extended;\n" " } v;\n" "} align(%u);\n\n", - ltt_alignof(uint32_t) * CHAR_BIT, - ltt_alignof(uint16_t) * CHAR_BIT + lttng_alignof(uint32_t) * CHAR_BIT, + lttng_alignof(uint16_t) * CHAR_BIT ); } @@ -802,10 +804,10 @@ int _ltt_session_metadata_statedump(struct ltt_session *session) " uint32_t stream_id;\n" " };\n" "};\n\n", - ltt_alignof(uint8_t) * CHAR_BIT, - ltt_alignof(uint16_t) * CHAR_BIT, - ltt_alignof(uint32_t) * CHAR_BIT, - ltt_alignof(uint64_t) * CHAR_BIT, + lttng_alignof(uint8_t) * CHAR_BIT, + lttng_alignof(uint16_t) * CHAR_BIT, + lttng_alignof(uint32_t) * CHAR_BIT, + lttng_alignof(uint64_t) * CHAR_BIT, CTF_VERSION_MAJOR, CTF_VERSION_MINOR, uuid_s, @@ -868,8 +870,7 @@ void ltt_transport_unregister(struct ltt_transport *transport) pthread_mutex_unlock(&sessions_mutex); } -static -void __attribute__((destructor)) ltt_events_exit(void) +void ltt_events_exit(void) { struct ltt_session *session, *tmpsession;