2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; only version 2
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef _LTTNG_USTCONSUMER_H
21 #define _LTTNG_USTCONSUMER_H
24 #include <lttng/lttng-consumer.h>
27 #ifdef HAVE_LIBLTTNG_UST_CTL
30 * Mmap the ring buffer, read it and write the data to the tracefile.
32 * Returns the number of bytes written.
34 extern int lttng_ustconsumer_on_read_subbuffer_mmap(
35 struct lttng_consumer_local_data
*ctx
,
36 struct lttng_consumer_stream
*stream
, unsigned long len
);
39 extern int lttng_ustconsumer_on_read_subbuffer_splice(
40 struct lttng_consumer_local_data
*ctx
,
41 struct lttng_consumer_stream
*stream
, unsigned long len
);
44 * Take a snapshot for a specific fd
46 * Returns 0 on success, < 0 on error
48 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data
*ctx
,
49 struct lttng_consumer_stream
*stream
);
52 * Get the produced position
54 * Returns 0 on success, < 0 on error
56 int lttng_ustconsumer_get_produced_snapshot(
57 struct lttng_consumer_local_data
*ctx
,
58 struct lttng_consumer_stream
*stream
,
61 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
62 int sock
, struct pollfd
*consumer_sockpoll
);
64 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
);
65 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
);
66 extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream
*stream
);
67 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
);
69 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
70 struct lttng_consumer_local_data
*ctx
);
71 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
);
73 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
);
75 #else /* HAVE_LIBLTTNG_UST_CTL */
78 int lttng_ustconsumer_on_read_subbuffer_mmap(
79 struct lttng_consumer_local_data
*ctx
,
80 struct lttng_consumer_stream
*stream
, unsigned long len
)
86 int lttng_ustconsumer_on_read_subbuffer_splice(
87 struct lttng_consumer_local_data
*ctx
,
88 struct lttng_consumer_stream
*uststream
, unsigned long len
)
94 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data
*ctx
,
95 struct lttng_consumer_stream
*stream
)
101 int lttng_ustconsumer_get_produced_snapshot(
102 struct lttng_consumer_local_data
*ctx
,
103 struct lttng_consumer_stream
*stream
,
110 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
111 int sock
, struct pollfd
*consumer_sockpoll
)
117 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
)
123 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
)
128 int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream
*stream
)
134 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
)
139 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
140 struct lttng_consumer_local_data
*ctx
)
146 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
)
152 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
)
156 #endif /* HAVE_LIBLTTNG_UST_CTL */
158 #endif /* _LTTNG_USTCONSUMER_H */