Commit | Line | Data |
---|---|---|
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_KCONSUMER_H | |
20 | #define _LTTNG_KCONSUMER_H | |
21 | ||
10a8a223 | 22 | #include <common/consumer.h> |
3bd1e081 MD |
23 | |
24 | /* | |
25 | * Mmap the ring buffer, read it and write the data to the tracefile. | |
26 | * | |
4078b776 | 27 | * Returns the number of bytes written, or negative value on error. |
3bd1e081 | 28 | */ |
4078b776 | 29 | extern ssize_t lttng_kconsumer_on_read_subbuffer_mmap( |
3bd1e081 MD |
30 | struct lttng_consumer_local_data *ctx, |
31 | struct lttng_consumer_stream *stream, unsigned long len); | |
32 | ||
33 | /* | |
34 | * Splice the data from the ring buffer to the tracefile. | |
35 | * | |
4078b776 MD |
36 | * Returns the number of bytes spliced, or negative error value on |
37 | * error. | |
3bd1e081 | 38 | */ |
4078b776 | 39 | extern ssize_t lttng_kconsumer_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 | */ | |
48 | int lttng_kconsumer_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_kconsumer_get_produced_snapshot( | |
57 | struct lttng_consumer_local_data *ctx, | |
58 | struct lttng_consumer_stream *stream, | |
59 | unsigned long *pos); | |
60 | ||
61 | int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, | |
62 | int sock, struct pollfd *consumer_sockpoll); | |
63 | ||
d41f73b7 | 64 | |
4078b776 | 65 | ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
d41f73b7 MD |
66 | struct lttng_consumer_local_data *ctx); |
67 | int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream); | |
68 | ||
3bd1e081 | 69 | #endif /* _LTTNG_KCONSUMER_H */ |