Update lttng-ust header copy for disabled UST compilation
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#ifndef _LTT_UST_APP_H
19#define _LTT_UST_APP_H
20
21#include <stdint.h>
22
23#include "trace-ust.h"
24
25/* lttng-ust supported version. */
26#define LTTNG_UST_COMM_MAJOR 2 /* comm protocol major version */
27#define UST_APP_MAJOR_VERSION 2 /* UST version supported */
28
29#define UST_APP_EVENT_LIST_SIZE 32
30
31extern int ust_consumerd64_fd, ust_consumerd32_fd;
32
33/*
34 * Application registration data structure.
35 */
36struct ust_register_msg {
37 uint32_t major;
38 uint32_t minor;
39 pid_t pid;
40 pid_t ppid;
41 uid_t uid;
42 gid_t gid;
43 uint32_t bits_per_long;
44 char name[16];
45};
46
47/*
48 * Global applications HT used by the session daemon. This table is indexed by
49 * PID using the pid_n node and pid value of an ust_app.
50 */
51struct lttng_ht *ust_app_ht;
52
53/*
54 * Global applications HT used by the session daemon. This table is indexed by
55 * socket using the sock_n node and sock value of an ust_app.
56 */
57struct lttng_ht *ust_app_ht_by_sock;
58
59struct ust_app_ctx {
60 int handle;
61 struct lttng_ust_context ctx;
62 struct lttng_ust_object_data *obj;
63 struct lttng_ht_node_ulong node;
64};
65
66struct ust_app_event {
67 int enabled;
68 int handle;
69 struct lttng_ust_object_data *obj;
70 struct lttng_ust_event attr;
71 char name[LTTNG_UST_SYM_NAME_LEN];
72 struct lttng_ht *ctx;
73 struct lttng_ht_node_str node;
74};
75
76struct ust_app_channel {
77 int enabled;
78 int handle;
79 char name[LTTNG_UST_SYM_NAME_LEN];
80 struct lttng_ust_channel attr;
81 struct lttng_ust_object_data *obj;
82 struct ltt_ust_stream_list streams;
83 struct lttng_ht *ctx;
84 struct lttng_ht *events;
85 struct lttng_ht_node_str node;
86};
87
88struct ust_app_session {
89 int enabled;
90 /* started: has the session been in started state at any time ? */
91 int started; /* allows detection of start vs restart. */
92 int handle; /* used has unique identifier for app session */
93 int id; /* session unique identifier */
94 struct ltt_ust_metadata *metadata;
95 struct lttng_ht *channels; /* Registered channels */
96 struct lttng_ht_node_ulong node;
97 char path[PATH_MAX];
98 /* UID/GID of the user owning the session */
99 uid_t uid;
100 gid_t gid;
101};
102
103/*
104 * Registered traceable applications. Libust registers to the session daemon
105 * and a linked list is kept of all running traceable app.
106 */
107struct ust_app {
108 int sock;
109 pid_t pid;
110 pid_t ppid;
111 uid_t uid; /* User ID that owns the apps */
112 gid_t gid; /* Group ID that owns the apps */
113 int bits_per_long;
114 int compatible; /* If the lttng-ust tracer version does not match the
115 supported version of the session daemon, this flag is
116 set to 0 (NOT compatible) else 1. */
117 struct lttng_ust_tracer_version version;
118 uint32_t v_major; /* Verion major number */
119 uint32_t v_minor; /* Verion minor number */
120 char name[17]; /* Process name (short) */
121 struct lttng_ht *sessions;
122 struct lttng_ht_node_ulong pid_n;
123 struct lttng_ht_node_ulong sock_n;
124};
125
126#ifdef HAVE_LIBLTTNG_UST_CTL
127
128int ust_app_register(struct ust_register_msg *msg, int sock);
129static inline
130int ust_app_register_done(int sock)
131{
132 return ustctl_register_done(sock);
133}
134void ust_app_unregister(int sock);
135unsigned long ust_app_list_count(void);
136int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app);
137int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app);
138int ust_app_start_trace_all(struct ltt_ust_session *usess);
139int ust_app_stop_trace_all(struct ltt_ust_session *usess);
140int ust_app_destroy_trace(struct ltt_ust_session *usess, struct ust_app *app);
141int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
142int ust_app_list_events(struct lttng_event **events);
143int ust_app_list_event_fields(struct lttng_event_field **fields);
144int ust_app_create_channel_glb(struct ltt_ust_session *usess,
145 struct ltt_ust_channel *uchan);
146int ust_app_create_event_glb(struct ltt_ust_session *usess,
147 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
148int ust_app_disable_event_pid(struct ltt_ust_session *usess,
149 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
150 pid_t pid);
151int ust_app_enable_event_pid(struct ltt_ust_session *usess,
152 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
153 pid_t pid);
154int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
155 struct ltt_ust_channel *uchan);
156int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
157 struct ltt_ust_channel *uchan);
158int ust_app_enable_event_glb(struct ltt_ust_session *usess,
159 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
160int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
161 struct ltt_ust_channel *uchan);
162int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
163 struct ltt_ust_channel *uchan);
164int ust_app_disable_event_glb(struct ltt_ust_session *usess,
165 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
166int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
167 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
168 struct ltt_ust_context *uctx);
169int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
170 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx);
171void ust_app_global_update(struct ltt_ust_session *usess, int sock);
172
173void ust_app_clean_list(void);
174void ust_app_ht_alloc(void);
175struct lttng_ht *ust_app_get_ht(void);
176struct ust_app *ust_app_find_by_pid(pid_t pid);
177int ust_app_validate_version(int sock);
178int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate);
179
180#else /* HAVE_LIBLTTNG_UST_CTL */
181
182static inline
183int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
184{
185 return 0;
186}
187static inline
188int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
189{
190 return 0;
191}
192static inline
193int ust_app_start_trace_all(struct ltt_ust_session *usess)
194{
195 return 0;
196}
197static inline
198int ust_app_stop_trace_all(struct ltt_ust_session *usess)
199{
200 return 0;
201}
202static inline
203int ust_app_list_events(struct lttng_event **events)
204{
205 return -ENOSYS;
206}
207static inline
208int ust_app_list_event_fields(struct lttng_event_field **fields)
209{
210 return -ENOSYS;
211}
212static inline
213int ust_app_register(struct ust_register_msg *msg, int sock)
214{
215 return -ENOSYS;
216}
217static inline
218int ust_app_register_done(int sock)
219{
220 return -ENOSYS;
221}
222static inline
223void ust_app_unregister(int sock)
224{
225}
226static inline
227unsigned int ust_app_list_count(void)
228{
229 return 0;
230}
231static inline
232void ust_app_lock_list(void)
233{
234}
235static inline
236void ust_app_unlock_list(void)
237{
238}
239static inline
240void ust_app_clean_list(void)
241{
242}
243static inline
244struct ust_app_list *ust_app_get_list(void)
245{
246 return NULL;
247}
248static inline
249struct ust_app *ust_app_get_by_pid(pid_t pid)
250{
251 return NULL;
252}
253static inline
254struct lttng_ht *ust_app_get_ht(void)
255{
256 return NULL;
257}
258static inline
259void ust_app_ht_alloc(void)
260{}
261static inline
262void ust_app_global_update(struct ltt_ust_session *usess, int sock)
263{}
264static inline
265int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
266 struct ltt_ust_channel *uchan)
267{
268 return 0;
269}
270static inline
271int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
272 struct ltt_ust_channel *uchan)
273{
274 return 0;
275}
276static inline
277int ust_app_create_channel_glb(struct ltt_ust_session *usess,
278 struct ltt_ust_channel *uchan)
279{
280 return 0;
281}
282static inline
283int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
284 struct ltt_ust_channel *uchan)
285{
286 return 0;
287}
288static inline
289int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
290 struct ltt_ust_channel *uchan)
291{
292 return 0;
293}
294static inline
295int ust_app_create_event_glb(struct ltt_ust_session *usess,
296 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
297{
298 return 0;
299}
300static inline
301int ust_app_disable_event_glb(struct ltt_ust_session *usess,
302 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
303{
304 return 0;
305}
306static inline
307int ust_app_enable_event_glb(struct ltt_ust_session *usess,
308 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
309{
310 return 0;
311}
312static inline
313int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
314 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
315 struct ltt_ust_context *uctx)
316{
317 return 0;
318}
319static inline
320int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
321 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx)
322{
323 return 0;
324}
325static inline
326int ust_app_enable_event_pid(struct ltt_ust_session *usess,
327 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
328 pid_t pid)
329{
330 return 0;
331}
332static inline
333int ust_app_disable_event_pid(struct ltt_ust_session *usess,
334 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
335 pid_t pid)
336{
337 return 0;
338}
339static inline
340int ust_app_validate_version(int sock)
341{
342 return 0;
343}
344static inline
345int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate)
346{
347 return 0;
348}
349
350#endif /* HAVE_LIBLTTNG_UST_CTL */
351
352#endif /* _LTT_UST_APP_H */
This page took 0.023157 seconds and 4 git commands to generate.