Move LTTng-UST buffer ownership from application to consumer
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.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 modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef _LTTNG_USTCONSUMER_H
20 #define _LTTNG_USTCONSUMER_H
21
22 #include <config.h>
23 #include <errno.h>
24
25 #include <common/consumer.h>
26
27 #ifdef HAVE_LIBLTTNG_UST_CTL
28
29 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
30
31 int lttng_ustconsumer_get_produced_snapshot(
32 struct lttng_consumer_stream *stream, unsigned long *pos);
33
34 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
35 int sock, struct pollfd *consumer_sockpoll);
36
37 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
38 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
39 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
40 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
41
42 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
43 struct lttng_consumer_local_data *ctx);
44 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
45
46 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
47
48 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
49 unsigned long *off);
50 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream);
51 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
52
53 #else /* HAVE_LIBLTTNG_UST_CTL */
54
55 static inline
56 ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
57 struct lttng_consumer_local_data *ctx,
58 struct lttng_consumer_stream *stream, unsigned long len,
59 unsigned long padding)
60 {
61 return -ENOSYS;
62 }
63
64 static inline
65 ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
66 struct lttng_consumer_local_data *ctx,
67 struct lttng_consumer_stream *uststream, unsigned long len,
68 unsigned long padding)
69 {
70 return -ENOSYS;
71 }
72
73 static inline
74 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
75 {
76 return -ENOSYS;
77 }
78
79 static inline
80 int lttng_ustconsumer_get_produced_snapshot(
81 struct lttng_consumer_stream *stream, unsigned long *pos)
82 {
83 return -ENOSYS;
84 }
85
86 static inline
87 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
88 int sock, struct pollfd *consumer_sockpoll)
89 {
90 return -ENOSYS;
91 }
92
93 static inline
94 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
95 {
96 return -ENOSYS;
97 }
98
99 static inline
100 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
101 {
102 }
103
104 static inline
105 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
106 {
107 return -ENOSYS;
108 }
109
110 static inline
111 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
112 {
113 }
114
115 static inline
116 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
117 struct lttng_consumer_local_data *ctx)
118 {
119 return -ENOSYS;
120 }
121
122 static inline
123 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
124 {
125 return -ENOSYS;
126 }
127
128 static inline
129 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
130 {
131 }
132
133 static inline
134 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
135 unsigned long *off)
136 {
137 return -ENOSYS;
138 }
139 static inline
140 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
141 {
142 return -ENOSYS;
143 }
144 static inline
145 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream)
146 {
147 return NULL;
148 }
149 #endif /* HAVE_LIBLTTNG_UST_CTL */
150
151 #endif /* _LTTNG_USTCONSUMER_H */
This page took 0.031484 seconds and 4 git commands to generate.