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
26 #include <common/consumer.h>
28 #ifdef HAVE_LIBLTTNG_UST_CTL
31 * Mmap the ring buffer, read it and write the data to the tracefile.
33 * Returns the number of bytes written.
35 extern int lttng_ustconsumer_on_read_subbuffer_mmap(
36 struct lttng_consumer_local_data
*ctx
,
37 struct lttng_consumer_stream
*stream
, unsigned long len
);
40 extern int lttng_ustconsumer_on_read_subbuffer_splice(
41 struct lttng_consumer_local_data
*ctx
,
42 struct lttng_consumer_stream
*stream
, unsigned long len
);
45 * Take a snapshot for a specific fd
47 * Returns 0 on success, < 0 on error
49 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data
*ctx
,
50 struct lttng_consumer_stream
*stream
);
53 * Get the produced position
55 * Returns 0 on success, < 0 on error
57 int lttng_ustconsumer_get_produced_snapshot(
58 struct lttng_consumer_local_data
*ctx
,
59 struct lttng_consumer_stream
*stream
,
62 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
63 int sock
, struct pollfd
*consumer_sockpoll
);
65 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
);
66 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
);
67 extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream
*stream
);
68 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
);
70 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
71 struct lttng_consumer_local_data
*ctx
);
72 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
);
74 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
);
76 #else /* HAVE_LIBLTTNG_UST_CTL */
79 int lttng_ustconsumer_on_read_subbuffer_mmap(
80 struct lttng_consumer_local_data
*ctx
,
81 struct lttng_consumer_stream
*stream
, unsigned long len
)
87 int lttng_ustconsumer_on_read_subbuffer_splice(
88 struct lttng_consumer_local_data
*ctx
,
89 struct lttng_consumer_stream
*uststream
, unsigned long len
)
95 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data
*ctx
,
96 struct lttng_consumer_stream
*stream
)
102 int lttng_ustconsumer_get_produced_snapshot(
103 struct lttng_consumer_local_data
*ctx
,
104 struct lttng_consumer_stream
*stream
,
111 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
112 int sock
, struct pollfd
*consumer_sockpoll
)
118 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
)
124 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
)
129 int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream
*stream
)
135 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
)
140 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
141 struct lttng_consumer_local_data
*ctx
)
147 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
)
153 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
)
157 #endif /* HAVE_LIBLTTNG_UST_CTL */
159 #endif /* _LTTNG_USTCONSUMER_H */