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