Update lttng ust ABI/API copy
[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
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef _LTT_UST_APP_H
20#define _LTT_UST_APP_H
21
22#include <stdint.h>
23
24#include "trace-ust.h"
25
26/* lttng-ust supported version. */
27#define UST_APP_MAJOR_VERSION 1
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.
49 */
50struct lttng_ht *ust_app_ht;
51
52struct lttng_ht *ust_app_sock_key_map;
53
54struct ust_app_key {
55 pid_t pid;
56 int sock;
57 struct lttng_ht_node_ulong node;
58};
59
60struct ust_app_ctx {
61 int handle;
62 struct lttng_ust_context ctx;
63 struct lttng_ust_object_data *obj;
64 struct lttng_ht_node_ulong node;
65};
66
67struct ust_app_event {
68 int enabled;
69 int handle;
70 struct lttng_ust_object_data *obj;
71 struct lttng_ust_event attr;
72 char name[LTTNG_UST_SYM_NAME_LEN];
73 struct lttng_ht *ctx;
74 struct lttng_ht_node_str node;
75};
76
77struct ust_app_channel {
78 int enabled;
79 int handle;
80 char name[LTTNG_UST_SYM_NAME_LEN];
81 struct lttng_ust_channel attr;
82 struct lttng_ust_object_data *obj;
83 struct ltt_ust_stream_list streams;
84 struct lttng_ht *ctx;
85 struct lttng_ht *events;
86 struct lttng_ht_node_str node;
87};
88
89struct ust_app_session {
90 int enabled;
91 /* started: has the session been in started state at any time ? */
92 int started; /* allows detection of start vs restart. */
93 int handle; /* used has unique identifier for app session */
94 int id; /* session unique identifier */
95 struct ltt_ust_metadata *metadata;
96 struct lttng_ht *channels; /* Registered channels */
97 struct lttng_ht_node_ulong node;
98 char path[PATH_MAX];
99 /* UID/GID of the user owning the session */
100 uid_t uid;
101 gid_t gid;
102};
103
104/*
105 * Registered traceable applications. Libust registers to the session daemon
106 * and a linked list is kept of all running traceable app.
107 */
108struct ust_app {
109 pid_t ppid;
110 uid_t uid; /* User ID that owns the apps */
111 gid_t gid; /* Group ID that owns the apps */
112 int bits_per_long;
113 int compatible; /* If the lttng-ust tracer version does not match the
114 supported version of the session daemon, this flag is
115 set to 0 (NOT compatible) else 1. */
116 struct lttng_ust_tracer_version version;
117 uint32_t v_major; /* Verion major number */
118 uint32_t v_minor; /* Verion minor number */
119 char name[17]; /* Process name (short) */
120 struct lttng_ht *sessions;
121 struct lttng_ht_node_ulong node;
122 struct ust_app_key key;
123};
124
125#ifdef HAVE_LIBLTTNG_UST_CTL
126
127int ust_app_register(struct ust_register_msg *msg, int sock);
128static inline
129int ust_app_register_done(int sock)
130{
131 return ustctl_register_done(sock);
132}
133void ust_app_unregister(int sock);
134unsigned long ust_app_list_count(void);
135int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app);
136int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app);
137int ust_app_start_trace_all(struct ltt_ust_session *usess);
138int ust_app_stop_trace_all(struct ltt_ust_session *usess);
139int ust_app_destroy_trace(struct ltt_ust_session *usess, struct ust_app *app);
140int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
141int ust_app_list_events(struct lttng_event **events);
142int ust_app_create_channel_glb(struct ltt_ust_session *usess,
143 struct ltt_ust_channel *uchan);
144int ust_app_create_event_glb(struct ltt_ust_session *usess,
145 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
146int ust_app_disable_event_pid(struct ltt_ust_session *usess,
147 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
148 pid_t pid);
149int ust_app_enable_event_pid(struct ltt_ust_session *usess,
150 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
151 pid_t pid);
152int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
153 struct ltt_ust_channel *uchan);
154int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
155 struct ltt_ust_channel *uchan);
156int ust_app_enable_event_glb(struct ltt_ust_session *usess,
157 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
158int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
159 struct ltt_ust_channel *uchan);
160int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
161 struct ltt_ust_channel *uchan);
162int ust_app_disable_event_glb(struct ltt_ust_session *usess,
163 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
164int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
165 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
166 struct ltt_ust_context *uctx);
167int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
168 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx);
169void ust_app_global_update(struct ltt_ust_session *usess, int sock);
170
171void ust_app_clean_list(void);
172void ust_app_ht_alloc(void);
173struct lttng_ht *ust_app_get_ht(void);
174struct ust_app *ust_app_find_by_pid(pid_t pid);
175int ust_app_validate_version(int sock);
176
177#else /* HAVE_LIBLTTNG_UST_CTL */
178
179static inline
180int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
181{
182 return 0;
183}
184static inline
185int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
186{
187 return 0;
188}
189static inline
190int ust_app_start_trace_all(struct ltt_ust_session *usess)
191{
192 return 0;
193}
194static inline
195int ust_app_stop_trace_all(struct ltt_ust_session *usess)
196{
197 return 0;
198}
199static inline
200int ust_app_list_events(struct lttng_event **events)
201{
202 return 0;
203}
204static inline
205int ust_app_register(struct ust_register_msg *msg, int sock)
206{
207 return -ENOSYS;
208}
209static inline
210int ust_app_register_done(int sock)
211{
212 return -ENOSYS;
213}
214static inline
215void ust_app_unregister(int sock)
216{
217}
218static inline
219unsigned int ust_app_list_count(void)
220{
221 return 0;
222}
223static inline
224void ust_app_lock_list(void)
225{
226}
227static inline
228void ust_app_unlock_list(void)
229{
230}
231static inline
232void ust_app_clean_list(void)
233{
234}
235static inline
236struct ust_app_list *ust_app_get_list(void)
237{
238 return NULL;
239}
240static inline
241struct ust_app *ust_app_get_by_pid(pid_t pid)
242{
243 return NULL;
244}
245static inline
246struct lttng_ht *ust_app_get_ht(void)
247{
248 return NULL;
249}
250static inline
251void ust_app_ht_alloc(void)
252{}
253static inline
254void ust_app_global_update(struct ltt_ust_session *usess, int sock)
255{}
256static inline
257int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
258 struct ltt_ust_channel *uchan)
259{
260 return 0;
261}
262static inline
263int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
264 struct ltt_ust_channel *uchan)
265{
266 return 0;
267}
268static inline
269int ust_app_create_channel_glb(struct ltt_ust_session *usess,
270 struct ltt_ust_channel *uchan)
271{
272 return 0;
273}
274static inline
275int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
276 struct ltt_ust_channel *uchan)
277{
278 return 0;
279}
280static inline
281int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
282 struct ltt_ust_channel *uchan)
283{
284 return 0;
285}
286static inline
287int ust_app_create_event_glb(struct ltt_ust_session *usess,
288 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
289{
290 return 0;
291}
292static inline
293int ust_app_disable_event_glb(struct ltt_ust_session *usess,
294 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
295{
296 return 0;
297}
298static inline
299int ust_app_enable_event_glb(struct ltt_ust_session *usess,
300 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
301{
302 return 0;
303}
304static inline
305int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
306 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
307 struct ltt_ust_context *uctx)
308{
309 return 0;
310}
311static inline
312int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
313 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx)
314{
315 return 0;
316}
317static inline
318int ust_app_enable_event_pid(struct ltt_ust_session *usess,
319 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
320 pid_t pid)
321{
322 return 0;
323}
324static inline
325int ust_app_disable_event_pid(struct ltt_ust_session *usess,
326 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
327 pid_t pid)
328{
329 return 0;
330}
331static inline
332int ust_app_validate_version(int sock)
333{
334 return 0;
335}
336
337#endif /* HAVE_LIBLTTNG_UST_CTL */
338
339#endif /* _LTT_UST_APP_H */
This page took 0.024421 seconds and 5 git commands to generate.