Cygwin: Fix handling of wait pipe hangup by properly detecting EOF
[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 *
d14d33bf
AM
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.
3bd1e081
MD
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
d14d33bf 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3bd1e081
MD
12 * GNU General Public License for more details.
13 *
d14d33bf
AM
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.
3bd1e081
MD
17 */
18
19#ifndef _LTTNG_USTCONSUMER_H
20#define _LTTNG_USTCONSUMER_H
21
22#include <config.h>
3bd1e081
MD
23#include <errno.h>
24
10a8a223
DG
25#include <common/consumer.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 *
4078b776 32 * Returns the number of bytes written, else negative value on error.
3bd1e081 33 */
4078b776 34extern ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
3bd1e081
MD
35 struct lttng_consumer_local_data *ctx,
36 struct lttng_consumer_stream *stream, unsigned long len);
37
38/* Not implemented */
4078b776 39extern ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
3bd1e081
MD
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
060a32b2
CB
75int lttng_ustconsumer_check_pipe(struct lttng_consumer_stream *stream,
76 struct lttng_consumer_local_data *ctx);
77
74d0b642 78#else /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
79
80static inline
4078b776 81ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
3bd1e081
MD
82 struct lttng_consumer_local_data *ctx,
83 struct lttng_consumer_stream *stream, unsigned long len)
84{
85 return -ENOSYS;
86}
87
88static inline
4078b776 89ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
3bd1e081
MD
90 struct lttng_consumer_local_data *ctx,
91 struct lttng_consumer_stream *uststream, unsigned long len)
92{
93 return -ENOSYS;
94}
95
96static inline
97int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx,
98 struct lttng_consumer_stream *stream)
99{
100 return -ENOSYS;
101}
102
103static inline
104int lttng_ustconsumer_get_produced_snapshot(
105 struct lttng_consumer_local_data *ctx,
106 struct lttng_consumer_stream *stream,
107 unsigned long *pos)
108{
109 return -ENOSYS;
110}
111
112static inline
113int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
fbc72522
DG
114 int sock, struct pollfd *consumer_sockpoll)
115{
116 return -ENOSYS;
117}
3bd1e081
MD
118
119static inline
120int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
121{
122 return -ENOSYS;
123}
124
125static inline
126void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
127{
128}
129
130static inline
131int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream)
132{
133 return -ENOSYS;
134}
135
136static inline
137void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
138{
139}
140
d41f73b7
MD
141static inline
142int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
143 struct lttng_consumer_local_data *ctx)
144{
145 return -ENOSYS;
146}
147
148static inline
149int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
150{
151 return -ENOSYS;
152}
153
d056b477
MD
154static inline
155void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
156{
157}
158
060a32b2
CB
159static inline
160int lttng_ustconsumer_check_pipe(struct lttng_consumer_stream *stream,
161 struct lttng_consumer_local_data *ctx)
162{
163 return -ENOSYS;
164}
165
74d0b642 166#endif /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
167
168#endif /* _LTTNG_USTCONSUMER_H */
This page took 0.034661 seconds and 4 git commands to generate.