Add new API call lttng_channel_set_default_attr
[lttng-tools.git] / include / lttng / lttng-ustconsumer.h
CommitLineData
3bd1e081
MD
1/*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
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
8 * of the License.
9 *
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.
14 *
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.
18 */
19
20#ifndef _LTTNG_USTCONSUMER_H
21#define _LTTNG_USTCONSUMER_H
22
23#include <config.h>
24#include <lttng/lttng-consumer.h>
25#include <errno.h>
26
74d0b642 27#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081
MD
28
29/*
30 * Mmap the ring buffer, read it and write the data to the tracefile.
31 *
32 * Returns the number of bytes written.
33 */
34extern int lttng_ustconsumer_on_read_subbuffer_mmap(
35 struct lttng_consumer_local_data *ctx,
36 struct lttng_consumer_stream *stream, unsigned long len);
37
38/* Not implemented */
39extern int lttng_ustconsumer_on_read_subbuffer_splice(
40 struct lttng_consumer_local_data *ctx,
41 struct lttng_consumer_stream *stream, unsigned long len);
42
43/*
44 * Take a snapshot for a specific fd
45 *
46 * Returns 0 on success, < 0 on error
47 */
48int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx,
49 struct lttng_consumer_stream *stream);
50
51/*
52 * Get the produced position
53 *
54 * Returns 0 on success, < 0 on error
55 */
56int lttng_ustconsumer_get_produced_snapshot(
57 struct lttng_consumer_local_data *ctx,
58 struct lttng_consumer_stream *stream,
59 unsigned long *pos);
60
61int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
62 int sock, struct pollfd *consumer_sockpoll);
63
64extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
65extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
66extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream);
67extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
68
d41f73b7
MD
69int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
70 struct lttng_consumer_local_data *ctx);
71int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
72
d056b477
MD
73void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
74
74d0b642 75#else /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
76
77static inline
78int lttng_ustconsumer_on_read_subbuffer_mmap(
79 struct lttng_consumer_local_data *ctx,
80 struct lttng_consumer_stream *stream, unsigned long len)
81{
82 return -ENOSYS;
83}
84
85static inline
86int lttng_ustconsumer_on_read_subbuffer_splice(
87 struct lttng_consumer_local_data *ctx,
88 struct lttng_consumer_stream *uststream, unsigned long len)
89{
90 return -ENOSYS;
91}
92
93static inline
94int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx,
95 struct lttng_consumer_stream *stream)
96{
97 return -ENOSYS;
98}
99
100static inline
101int lttng_ustconsumer_get_produced_snapshot(
102 struct lttng_consumer_local_data *ctx,
103 struct lttng_consumer_stream *stream,
104 unsigned long *pos)
105{
106 return -ENOSYS;
107}
108
109static inline
110int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
fbc72522
DG
111 int sock, struct pollfd *consumer_sockpoll)
112{
113 return -ENOSYS;
114}
3bd1e081
MD
115
116static inline
117int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
118{
119 return -ENOSYS;
120}
121
122static inline
123void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
124{
125}
126
127static inline
128int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream)
129{
130 return -ENOSYS;
131}
132
133static inline
134void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
135{
136}
137
d41f73b7
MD
138static inline
139int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
140 struct lttng_consumer_local_data *ctx)
141{
142 return -ENOSYS;
143}
144
145static inline
146int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
147{
148 return -ENOSYS;
149}
150
d056b477
MD
151static inline
152void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
153{
154}
155
74d0b642 156#endif /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
157
158#endif /* _LTTNG_USTCONSUMER_H */
This page took 0.028504 seconds and 4 git commands to generate.