2 * Copyright (C) 2011 EfficiOS Inc.
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
9 #ifndef _LTTNG_USTCONSUMER_H
10 #define _LTTNG_USTCONSUMER_H
12 #include <common/compat/errno.h>
13 #include <common/consumer/consumer.h>
16 #ifdef HAVE_LIBLTTNG_UST_CTL
18 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream
*stream
);
19 int lttng_ustconsumer_sample_snapshot_positions(
20 struct lttng_consumer_stream
*stream
);
22 int lttng_ustconsumer_get_produced_snapshot(
23 struct lttng_consumer_stream
*stream
, unsigned long *pos
);
24 int lttng_ustconsumer_get_consumed_snapshot(
25 struct lttng_consumer_stream
*stream
, unsigned long *pos
);
27 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
28 int sock
, struct pollfd
*consumer_sockpoll
);
30 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
);
31 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
);
32 extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel
*chan
);
33 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream
*stream
);
34 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
);
36 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
37 struct lttng_consumer_local_data
*ctx
);
38 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
);
40 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
);
42 int lttng_ust_flush_buffer(struct lttng_consumer_stream
*stream
,
44 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
46 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
);
47 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
);
48 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
);
49 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
);
50 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
51 uint64_t len
, uint64_t version
,
52 struct lttng_consumer_channel
*channel
, bool invoked_by_timer
,
54 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
55 struct lttng_consumer_channel
*channel
, bool invoked_by_timer
,
57 enum sync_metadata_status
lttng_ustconsumer_sync_metadata(
58 struct lttng_consumer_local_data
*ctx
,
59 struct lttng_consumer_stream
*metadata
);
60 int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
62 int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
);
63 int lttng_ustconsumer_get_current_timestamp(
64 struct lttng_consumer_stream
*stream
, uint64_t *ts
);
65 int lttng_ustconsumer_get_sequence_number(
66 struct lttng_consumer_stream
*stream
, uint64_t *seq
);
67 void lttng_ustconsumer_sigbus_handle(void *addr
);
69 #else /* HAVE_LIBLTTNG_UST_CTL */
72 ssize_t
lttng_ustconsumer_on_read_subbuffer_mmap(
73 struct lttng_consumer_local_data
*ctx
,
74 struct lttng_consumer_stream
*stream
, unsigned long len
,
75 unsigned long padding
)
81 ssize_t
lttng_ustconsumer_on_read_subbuffer_splice(
82 struct lttng_consumer_local_data
*ctx
,
83 struct lttng_consumer_stream
*uststream
, unsigned long len
,
84 unsigned long padding
)
90 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream
*stream
)
96 int lttng_ustconsumer_sample_snapshot_positions(
97 struct lttng_consumer_stream
*stream
)
103 int lttng_ustconsumer_get_produced_snapshot(
104 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
110 int lttng_ustconsumer_get_consumed_snapshot(
111 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
117 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
118 int sock
, struct pollfd
*consumer_sockpoll
)
124 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
)
130 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
)
135 void lttng_ustconsumer_free_channel(struct lttng_consumer_channel
*chan
)
140 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream
*stream
)
146 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
)
151 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
152 struct lttng_consumer_local_data
*ctx
)
158 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
)
164 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
)
169 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
)
174 int lttng_ust_flush_buffer(struct lttng_consumer_stream
*stream
,
180 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
)
184 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
)
188 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
)
192 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
193 uint64_t len
, uint64_t version
,
194 struct lttng_consumer_channel
*channel
, int timer
)
199 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
200 struct lttng_consumer_channel
*channel
, int timer
, int wait
)
205 enum sync_metadata_status
lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data
*ctx
,
206 struct lttng_consumer_stream
*metadata
)
208 return SYNC_METADATA_STATUS_ERROR
;
211 int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
217 int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
)
222 int lttng_ustconsumer_get_current_timestamp(
223 struct lttng_consumer_stream
*stream
, uint64_t *ts
)
228 int lttng_ustconsumer_get_sequence_number(
229 struct lttng_consumer_stream
*stream
, uint64_t *seq
)
234 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
240 void lttng_ustconsumer_sigbus_handle(void *addr
)
243 #endif /* HAVE_LIBLTTNG_UST_CTL */
245 #endif /* _LTTNG_USTCONSUMER_H */