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