Commit | Line | Data |
---|---|---|
f3105c67 MD |
1 | /* |
2 | * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> | |
3 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | * | |
e92f3e28 MD |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; version 2 of the License only. | |
f3105c67 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 | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
e92f3e28 MD |
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. | |
f3105c67 MD |
17 | */ |
18 | ||
19 | #ifndef _LTTNG_UST_CTL_H | |
20 | #define _LTTNG_UST_CTL_H | |
21 | ||
4318ae1b | 22 | #include <lttng/ust-abi.h> |
f3105c67 | 23 | |
7bc53e94 MD |
24 | /* |
25 | * Error values: all the following functions return: | |
c7b9470b | 26 | * >= 0: Success (LTTNG_UST_OK) |
7bc53e94 MD |
27 | * < 0: error code. |
28 | */ | |
1c5e467e | 29 | int ustctl_register_done(int sock); |
f3105c67 MD |
30 | int ustctl_create_session(int sock); |
31 | int ustctl_open_metadata(int sock, int session_handle, | |
32 | struct lttng_ust_channel_attr *chops, | |
61f02aea | 33 | struct lttng_ust_object_data **metadata_data); |
f3105c67 MD |
34 | int ustctl_create_channel(int sock, int session_handle, |
35 | struct lttng_ust_channel_attr *chops, | |
61f02aea | 36 | struct lttng_ust_object_data **channel_data); |
f3105c67 | 37 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, |
61f02aea MD |
38 | struct lttng_ust_object_data *channel_data, |
39 | struct lttng_ust_object_data **event_data); | |
f3105c67 | 40 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, |
61f02aea MD |
41 | struct lttng_ust_object_data *obj_data, |
42 | struct lttng_ust_object_data **context_data); | |
cd54f6d9 MD |
43 | int ustctl_set_filter(int sock, struct lttng_ust_filter_bytecode *bytecode, |
44 | struct lttng_ust_object_data *obj_data); | |
f3105c67 | 45 | |
61f02aea MD |
46 | int ustctl_enable(int sock, struct lttng_ust_object_data *object); |
47 | int ustctl_disable(int sock, struct lttng_ust_object_data *object); | |
4a6ca058 MD |
48 | int ustctl_start_session(int sock, int handle); |
49 | int ustctl_stop_session(int sock, int handle); | |
f3105c67 | 50 | |
c7b9470b | 51 | /* |
2f0f435c | 52 | * Return -LTTNG_UST_ERR_NOENT if no more stream is available for creation. |
c7b9470b MD |
53 | * Return 0 on success. |
54 | * Return negative error value on system error. | |
55 | * Return positive error value on UST error. | |
56 | */ | |
57 | int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data, | |
58 | struct lttng_ust_object_data **stream_data); | |
59 | ||
b115631f MD |
60 | /* |
61 | * ustctl_tracepoint_list returns a tracepoint list handle, or negative | |
62 | * error value. | |
63 | */ | |
64 | int ustctl_tracepoint_list(int sock); | |
65 | /* | |
66 | * ustctl_tracepoint_list_get is used to iterate on the tp list | |
7bc53e94 MD |
67 | * handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is |
68 | * returned. | |
b115631f MD |
69 | */ |
70 | int ustctl_tracepoint_list_get(int sock, int tp_list_handle, | |
cbef6901 | 71 | struct lttng_ust_tracepoint_iter *iter); |
b115631f | 72 | |
40003310 MD |
73 | /* |
74 | * ustctl_tracepoint_field_list returns a tracepoint field list handle, | |
75 | * or negative error value. | |
76 | */ | |
77 | int ustctl_tracepoint_field_list(int sock); | |
78 | ||
79 | /* | |
80 | * ustctl_tracepoint_field_list_get is used to iterate on the tp field | |
7bc53e94 MD |
81 | * list handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is |
82 | * returned. | |
40003310 MD |
83 | */ |
84 | int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, | |
85 | struct lttng_ust_field_iter *iter); | |
86 | ||
f3105c67 MD |
87 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v); |
88 | int ustctl_wait_quiescent(int sock); | |
89 | ||
f1fffc57 MD |
90 | int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object); |
91 | ||
f3105c67 MD |
92 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); |
93 | ||
f3105c67 | 94 | /* |
38fae1d3 | 95 | * Map channel lttng_ust_shm_handle and add streams. Typically performed by the |
f3105c67 MD |
96 | * consumer to map the objects into its memory space. |
97 | */ | |
38fae1d3 MD |
98 | struct lttng_ust_shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data); |
99 | int ustctl_add_stream(struct lttng_ust_shm_handle *lttng_ust_shm_handle, | |
61f02aea | 100 | struct lttng_ust_object_data *stream_data); |
5224b5c8 | 101 | /* |
38fae1d3 | 102 | * Note: the lttng_ust_object_data from which the lttng_ust_shm_handle is derived can only |
5224b5c8 MD |
103 | * be released after unmapping the handle. |
104 | */ | |
38fae1d3 | 105 | void ustctl_unmap_channel(struct lttng_ust_shm_handle *lttng_ust_shm_handle); |
f3105c67 MD |
106 | |
107 | /* Buffer operations */ | |
108 | ||
38fae1d3 | 109 | struct lttng_ust_shm_handle; |
4cfec15c | 110 | struct lttng_ust_lib_ring_buffer; |
f3105c67 | 111 | |
6e922b24 | 112 | /* Open/close stream buffers for read */ |
4cfec15c | 113 | struct lttng_ust_lib_ring_buffer *ustctl_open_stream_read(struct lttng_ust_shm_handle *handle, |
6e922b24 | 114 | int cpu); |
38fae1d3 | 115 | void ustctl_close_stream_read(struct lttng_ust_shm_handle *handle, |
4cfec15c | 116 | struct lttng_ust_lib_ring_buffer *buf); |
6e922b24 | 117 | |
f3105c67 | 118 | /* For mmap mode, readable without "get" operation */ |
38fae1d3 | 119 | int ustctl_get_mmap_len(struct lttng_ust_shm_handle *handle, |
4cfec15c | 120 | struct lttng_ust_lib_ring_buffer *buf, |
f3105c67 | 121 | unsigned long *len); |
38fae1d3 | 122 | int ustctl_get_max_subbuf_size(struct lttng_ust_shm_handle *handle, |
4cfec15c | 123 | struct lttng_ust_lib_ring_buffer *buf, |
f3105c67 MD |
124 | unsigned long *len); |
125 | ||
126 | /* | |
127 | * For mmap mode, operate on the current packet (between get/put or | |
128 | * get_next/put_next). | |
129 | */ | |
38fae1d3 | 130 | void *ustctl_get_mmap_base(struct lttng_ust_shm_handle *handle, |
4cfec15c | 131 | struct lttng_ust_lib_ring_buffer *buf); |
38fae1d3 | 132 | int ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle, |
4cfec15c | 133 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *off); |
38fae1d3 | 134 | int ustctl_get_subbuf_size(struct lttng_ust_shm_handle *handle, |
4cfec15c | 135 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *len); |
38fae1d3 | 136 | int ustctl_get_padded_subbuf_size(struct lttng_ust_shm_handle *handle, |
4cfec15c | 137 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *len); |
38fae1d3 | 138 | int ustctl_get_next_subbuf(struct lttng_ust_shm_handle *handle, |
4cfec15c | 139 | struct lttng_ust_lib_ring_buffer *buf); |
38fae1d3 | 140 | int ustctl_put_next_subbuf(struct lttng_ust_shm_handle *handle, |
4cfec15c | 141 | struct lttng_ust_lib_ring_buffer *buf); |
f3105c67 MD |
142 | |
143 | /* snapshot */ | |
144 | ||
38fae1d3 | 145 | int ustctl_snapshot(struct lttng_ust_shm_handle *handle, |
4cfec15c | 146 | struct lttng_ust_lib_ring_buffer *buf); |
38fae1d3 | 147 | int ustctl_snapshot_get_consumed(struct lttng_ust_shm_handle *handle, |
4cfec15c | 148 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); |
38fae1d3 | 149 | int ustctl_snapshot_get_produced(struct lttng_ust_shm_handle *handle, |
4cfec15c | 150 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); |
38fae1d3 | 151 | int ustctl_get_subbuf(struct lttng_ust_shm_handle *handle, |
4cfec15c | 152 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); |
38fae1d3 | 153 | int ustctl_put_subbuf(struct lttng_ust_shm_handle *handle, |
4cfec15c | 154 | struct lttng_ust_lib_ring_buffer *buf); |
f3105c67 | 155 | |
02a15cfb | 156 | void ustctl_flush_buffer(struct lttng_ust_shm_handle *handle, |
b52190f2 MD |
157 | struct lttng_ust_lib_ring_buffer *buf, |
158 | int producer_active); | |
5f9d3dbc | 159 | |
2be0e72c | 160 | /* Release object created by members of this API. */ |
d26228ae | 161 | int ustctl_release_object(int sock, struct lttng_ust_object_data *data); |
2be0e72c MD |
162 | /* Release handle returned by create session. */ |
163 | int ustctl_release_handle(int sock, int handle); | |
f3105c67 MD |
164 | |
165 | #endif /* _LTTNG_UST_CTL_H */ |