UST consumer: implement missing ust-specific callbacks + fixes.
[lttng-tools.git] / include / lttng / lttng-ustconsumer.h
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
27 #ifdef HAVE_LIBLTTNG_UST_CTL
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 */
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);
37
38 /* Not implemented */
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);
42
43 /*
44 * Take a snapshot for a specific fd
45 *
46 * Returns 0 on success, < 0 on error
47 */
48 int 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 */
56 int lttng_ustconsumer_get_produced_snapshot(
57 struct lttng_consumer_local_data *ctx,
58 struct lttng_consumer_stream *stream,
59 unsigned long *pos);
60
61 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
62 int sock, struct pollfd *consumer_sockpoll);
63
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);
68
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);
72
73 #else /* HAVE_LIBLTTNG_UST_CTL */
74
75 static inline
76 int lttng_ustconsumer_on_read_subbuffer_mmap(
77 struct lttng_consumer_local_data *ctx,
78 struct lttng_consumer_stream *stream, unsigned long len)
79 {
80 return -ENOSYS;
81 }
82
83 static inline
84 int lttng_ustconsumer_on_read_subbuffer_splice(
85 struct lttng_consumer_local_data *ctx,
86 struct lttng_consumer_stream *uststream, unsigned long len)
87 {
88 return -ENOSYS;
89 }
90
91 static inline
92 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx,
93 struct lttng_consumer_stream *stream)
94 {
95 return -ENOSYS;
96 }
97
98 static inline
99 int lttng_ustconsumer_get_produced_snapshot(
100 struct lttng_consumer_local_data *ctx,
101 struct lttng_consumer_stream *stream,
102 unsigned long *pos)
103 {
104 return -ENOSYS;
105 }
106
107 static inline
108 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
109 int sock, struct pollfd *consumer_sockpoll)
110 {
111 return -ENOSYS;
112 }
113
114 static inline
115 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
116 {
117 return -ENOSYS;
118 }
119
120 static inline
121 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
122 {
123 }
124
125 static inline
126 int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream)
127 {
128 return -ENOSYS;
129 }
130
131 static inline
132 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
133 {
134 }
135
136 static inline
137 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
138 struct lttng_consumer_local_data *ctx)
139 {
140 return -ENOSYS;
141 }
142
143 static inline
144 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
145 {
146 return -ENOSYS;
147 }
148
149 #endif /* HAVE_LIBLTTNG_UST_CTL */
150
151 #endif /* _LTTNG_USTCONSUMER_H */
This page took 0.032639 seconds and 5 git commands to generate.