Commit | Line | Data |
---|---|---|
f3105c67 MD |
1 | /* |
2 | * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> | |
74d81a6c | 3 | * Copyright (C) 2011-2013 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
f3105c67 | 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 | |
74d81a6c MD |
24 | #ifndef LTTNG_PACKED |
25 | #define LTTNG_PACKED __attribute__((packed)) | |
26 | #endif | |
27 | ||
28 | #ifndef LTTNG_UST_UUID_LEN | |
29 | #define LTTNG_UST_UUID_LEN 16 | |
30 | #endif | |
31 | ||
32 | struct lttng_ust_shm_handle; | |
33 | struct lttng_ust_lib_ring_buffer; | |
34 | ||
35 | struct ustctl_consumer_channel_attr { | |
36 | enum lttng_ust_chan_type type; | |
37 | uint64_t subbuf_size; /* bytes */ | |
38 | uint64_t num_subbuf; /* power of 2 */ | |
39 | int overwrite; /* 1: overwrite, 0: discard */ | |
40 | unsigned int switch_timer_interval; /* usec */ | |
41 | unsigned int read_timer_interval; /* usec */ | |
42 | enum lttng_ust_output output; /* splice, mmap */ | |
43 | unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ | |
44 | } LTTNG_PACKED; | |
45 | ||
46 | /* | |
47 | * API used by sessiond. | |
48 | */ | |
49 | ||
7bc53e94 MD |
50 | /* |
51 | * Error values: all the following functions return: | |
c354a72c | 52 | * >= 0: Success (LTTNG_UST_OK) |
7bc53e94 MD |
53 | * < 0: error code. |
54 | */ | |
1c5e467e | 55 | int ustctl_register_done(int sock); |
f3105c67 | 56 | int ustctl_create_session(int sock); |
f3105c67 | 57 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, |
61f02aea MD |
58 | struct lttng_ust_object_data *channel_data, |
59 | struct lttng_ust_object_data **event_data); | |
f3105c67 | 60 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, |
61f02aea MD |
61 | struct lttng_ust_object_data *obj_data, |
62 | struct lttng_ust_object_data **context_data); | |
cd54f6d9 MD |
63 | int ustctl_set_filter(int sock, struct lttng_ust_filter_bytecode *bytecode, |
64 | struct lttng_ust_object_data *obj_data); | |
f3105c67 | 65 | |
61f02aea MD |
66 | int ustctl_enable(int sock, struct lttng_ust_object_data *object); |
67 | int ustctl_disable(int sock, struct lttng_ust_object_data *object); | |
4a6ca058 MD |
68 | int ustctl_start_session(int sock, int handle); |
69 | int ustctl_stop_session(int sock, int handle); | |
f3105c67 | 70 | |
b115631f MD |
71 | /* |
72 | * ustctl_tracepoint_list returns a tracepoint list handle, or negative | |
73 | * error value. | |
74 | */ | |
75 | int ustctl_tracepoint_list(int sock); | |
74d81a6c | 76 | |
b115631f MD |
77 | /* |
78 | * ustctl_tracepoint_list_get is used to iterate on the tp list | |
7bc53e94 MD |
79 | * handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is |
80 | * returned. | |
b115631f MD |
81 | */ |
82 | int ustctl_tracepoint_list_get(int sock, int tp_list_handle, | |
cbef6901 | 83 | struct lttng_ust_tracepoint_iter *iter); |
b115631f | 84 | |
40003310 MD |
85 | /* |
86 | * ustctl_tracepoint_field_list returns a tracepoint field list handle, | |
87 | * or negative error value. | |
88 | */ | |
89 | int ustctl_tracepoint_field_list(int sock); | |
90 | ||
91 | /* | |
92 | * ustctl_tracepoint_field_list_get is used to iterate on the tp field | |
7bc53e94 MD |
93 | * list handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is |
94 | * returned. | |
40003310 MD |
95 | */ |
96 | int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, | |
97 | struct lttng_ust_field_iter *iter); | |
98 | ||
f3105c67 MD |
99 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v); |
100 | int ustctl_wait_quiescent(int sock); | |
101 | ||
f1fffc57 MD |
102 | int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object); |
103 | ||
f3105c67 MD |
104 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); |
105 | ||
74d81a6c MD |
106 | /* Release object created by members of this API. */ |
107 | int ustctl_release_object(int sock, struct lttng_ust_object_data *data); | |
108 | /* Release handle returned by create session. */ | |
109 | int ustctl_release_handle(int sock, int handle); | |
110 | ||
111 | int ustctl_recv_channel_from_consumer(int sock, | |
112 | struct lttng_ust_object_data **channel_data); | |
113 | int ustctl_recv_stream_from_consumer(int sock, | |
114 | struct lttng_ust_object_data **stream_data); | |
115 | int ustctl_send_channel_to_ust(int sock, int session_handle, | |
116 | struct lttng_ust_object_data *channel_data); | |
117 | int ustctl_send_stream_to_ust(int sock, | |
118 | struct lttng_ust_object_data *channel_data, | |
119 | struct lttng_ust_object_data *stream_data); | |
120 | ||
f3105c67 | 121 | /* |
74d81a6c | 122 | * API used by consumer. |
f3105c67 | 123 | */ |
74d81a6c MD |
124 | |
125 | struct ustctl_consumer_channel; | |
126 | struct ustctl_consumer_stream; | |
127 | struct ustctl_consumer_channel_attr; | |
128 | ||
129 | struct ustctl_consumer_channel * | |
130 | ustctl_create_channel(struct ustctl_consumer_channel_attr *attr); | |
5224b5c8 | 131 | /* |
74d81a6c MD |
132 | * Each stream created needs to be destroyed before calling |
133 | * ustctl_destroy_channel(). | |
5224b5c8 | 134 | */ |
74d81a6c | 135 | void ustctl_destroy_channel(struct ustctl_consumer_channel *chan); |
f3105c67 | 136 | |
74d81a6c MD |
137 | int ustctl_send_channel_to_sessiond(int sock, |
138 | struct ustctl_consumer_channel *channel); | |
139 | /* | |
140 | * Send a NULL stream to finish iteration over all streams of a given | |
141 | * channel. | |
142 | */ | |
143 | int ustctl_send_stream_to_sessiond(int sock, | |
144 | struct ustctl_consumer_stream *stream); | |
145 | int ustctl_stream_close_wait_fd(struct ustctl_consumer_stream *stream); | |
146 | int ustctl_stream_close_wakeup_fd(struct ustctl_consumer_stream *stream); | |
f3105c67 | 147 | |
74d81a6c MD |
148 | /* Create/destroy stream buffers for read */ |
149 | struct ustctl_consumer_stream * | |
150 | ustctl_create_stream(struct ustctl_consumer_channel *channel, | |
151 | int cpu); | |
152 | void ustctl_destroy_stream(struct ustctl_consumer_stream *stream); | |
f3105c67 | 153 | |
74d81a6c MD |
154 | int ustctl_get_wait_fd(struct ustctl_consumer_stream *stream); |
155 | int ustctl_get_wakeup_fd(struct ustctl_consumer_stream *stream); | |
6e922b24 | 156 | |
f3105c67 | 157 | /* For mmap mode, readable without "get" operation */ |
74d81a6c | 158 | int ustctl_get_mmap_len(struct ustctl_consumer_stream *stream, |
f3105c67 | 159 | unsigned long *len); |
74d81a6c | 160 | int ustctl_get_max_subbuf_size(struct ustctl_consumer_stream *stream, |
f3105c67 MD |
161 | unsigned long *len); |
162 | ||
163 | /* | |
164 | * For mmap mode, operate on the current packet (between get/put or | |
165 | * get_next/put_next). | |
166 | */ | |
74d81a6c MD |
167 | void *ustctl_get_mmap_base(struct ustctl_consumer_stream *stream); |
168 | int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream, | |
169 | unsigned long *off); | |
170 | int ustctl_get_subbuf_size(struct ustctl_consumer_stream *stream, | |
171 | unsigned long *len); | |
172 | int ustctl_get_padded_subbuf_size(struct ustctl_consumer_stream *stream, | |
173 | unsigned long *len); | |
174 | int ustctl_get_next_subbuf(struct ustctl_consumer_stream *stream); | |
175 | int ustctl_put_next_subbuf(struct ustctl_consumer_stream *stream); | |
f3105c67 MD |
176 | |
177 | /* snapshot */ | |
178 | ||
74d81a6c MD |
179 | int ustctl_snapshot(struct ustctl_consumer_stream *stream); |
180 | int ustctl_snapshot_get_consumed(struct ustctl_consumer_stream *stream, | |
181 | unsigned long *pos); | |
182 | int ustctl_snapshot_get_produced(struct ustctl_consumer_stream *stream, | |
183 | unsigned long *pos); | |
184 | int ustctl_get_subbuf(struct ustctl_consumer_stream *stream, | |
185 | unsigned long *pos); | |
186 | int ustctl_put_subbuf(struct ustctl_consumer_stream *stream); | |
5f9d3dbc | 187 | |
74d81a6c MD |
188 | void ustctl_flush_buffer(struct ustctl_consumer_stream *stream, |
189 | int producer_active); | |
f3105c67 MD |
190 | |
191 | #endif /* _LTTNG_UST_CTL_H */ |