| 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 | /* |
| 30 | * Take a snapshot for a specific fd |
| 31 | * |
| 32 | * Returns 0 on success, < 0 on error |
| 33 | */ |
| 34 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx, |
| 35 | struct lttng_consumer_stream *stream); |
| 36 | |
| 37 | /* |
| 38 | * Get the produced position |
| 39 | * |
| 40 | * Returns 0 on success, < 0 on error |
| 41 | */ |
| 42 | int lttng_ustconsumer_get_produced_snapshot( |
| 43 | struct lttng_consumer_local_data *ctx, |
| 44 | struct lttng_consumer_stream *stream, |
| 45 | unsigned long *pos); |
| 46 | |
| 47 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, |
| 48 | int sock, struct pollfd *consumer_sockpoll); |
| 49 | |
| 50 | extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan); |
| 51 | extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); |
| 52 | extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream); |
| 53 | extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); |
| 54 | |
| 55 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
| 56 | struct lttng_consumer_local_data *ctx); |
| 57 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); |
| 58 | |
| 59 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); |
| 60 | |
| 61 | extern int lttng_ustctl_get_mmap_read_offset( |
| 62 | struct lttng_ust_shm_handle *handle, |
| 63 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *off); |
| 64 | |
| 65 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
| 66 | |
| 67 | static inline |
| 68 | ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( |
| 69 | struct lttng_consumer_local_data *ctx, |
| 70 | struct lttng_consumer_stream *stream, unsigned long len) |
| 71 | { |
| 72 | return -ENOSYS; |
| 73 | } |
| 74 | |
| 75 | static inline |
| 76 | ssize_t lttng_ustconsumer_on_read_subbuffer_splice( |
| 77 | struct lttng_consumer_local_data *ctx, |
| 78 | struct lttng_consumer_stream *uststream, unsigned long len) |
| 79 | { |
| 80 | return -ENOSYS; |
| 81 | } |
| 82 | |
| 83 | static inline |
| 84 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx, |
| 85 | struct lttng_consumer_stream *stream) |
| 86 | { |
| 87 | return -ENOSYS; |
| 88 | } |
| 89 | |
| 90 | static inline |
| 91 | int lttng_ustconsumer_get_produced_snapshot( |
| 92 | struct lttng_consumer_local_data *ctx, |
| 93 | struct lttng_consumer_stream *stream, |
| 94 | unsigned long *pos) |
| 95 | { |
| 96 | return -ENOSYS; |
| 97 | } |
| 98 | |
| 99 | static inline |
| 100 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, |
| 101 | int sock, struct pollfd *consumer_sockpoll) |
| 102 | { |
| 103 | return -ENOSYS; |
| 104 | } |
| 105 | |
| 106 | static inline |
| 107 | int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan) |
| 108 | { |
| 109 | return -ENOSYS; |
| 110 | } |
| 111 | |
| 112 | static inline |
| 113 | void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan) |
| 114 | { |
| 115 | } |
| 116 | |
| 117 | static inline |
| 118 | int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream) |
| 119 | { |
| 120 | return -ENOSYS; |
| 121 | } |
| 122 | |
| 123 | static inline |
| 124 | void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) |
| 125 | { |
| 126 | } |
| 127 | |
| 128 | static inline |
| 129 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
| 130 | struct lttng_consumer_local_data *ctx) |
| 131 | { |
| 132 | return -ENOSYS; |
| 133 | } |
| 134 | |
| 135 | static inline |
| 136 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream) |
| 137 | { |
| 138 | return -ENOSYS; |
| 139 | } |
| 140 | |
| 141 | static inline |
| 142 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) |
| 143 | { |
| 144 | } |
| 145 | |
| 146 | static inline |
| 147 | int lttng_ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle, |
| 148 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *off) |
| 149 | { |
| 150 | return -ENOSYS; |
| 151 | } |
| 152 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
| 153 | |
| 154 | #endif /* _LTTNG_USTCONSUMER_H */ |