Remove CLONE_VM flag
[lttng-tools.git] / lttng-sessiond / ust-app.h
CommitLineData
91d76f53
DG
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
82a3637f
DG
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
91d76f53
DG
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
f6a9efaa
DG
19#ifndef _LTT_UST_APP_H
20#define _LTT_UST_APP_H
91d76f53 21
099e26bd 22#include <stdint.h>
1e307fab
DG
23#include <urcu/list.h>
24
44d3bd01
DG
25#include "trace-ust.h"
26
b551a063
DG
27#define UST_APP_EVENT_LIST_SIZE 32
28
7753dea8 29extern int ust_consumerd64_fd, ust_consumerd32_fd;
ba5d816e 30
099e26bd
DG
31/*
32 * Application registration data structure.
33 */
34struct ust_register_msg {
35 uint32_t major;
36 uint32_t minor;
37 pid_t pid;
38 pid_t ppid;
39 uid_t uid;
40 gid_t gid;
0df502fd 41 uint32_t bits_per_long;
099e26bd
DG
42 char name[16];
43};
44
48842b30
DG
45/*
46 * Global applications HT used by the session daemon.
47 */
bec39940 48struct lttng_ht *ust_app_ht;
f6a9efaa 49
bec39940 50struct lttng_ht *ust_app_sock_key_map;
f6a9efaa
DG
51
52struct ust_app_key {
53 pid_t pid;
54 int sock;
bec39940 55 struct lttng_ht_node_ulong node;
91d76f53
DG
56};
57
55cc08a6
DG
58struct ust_app_ctx {
59 int handle;
60 struct lttng_ust_context ctx;
61 struct lttng_ust_object_data *obj;
bec39940 62 struct lttng_ht_node_ulong node;
55cc08a6
DG
63};
64
48842b30
DG
65struct ust_app_event {
66 int enabled;
67 int handle;
13161846 68 struct lttng_ust_object_data *obj;
284d8f55 69 struct lttng_ust_event attr;
48842b30 70 char name[LTTNG_UST_SYM_NAME_LEN];
bec39940
DG
71 struct lttng_ht *ctx;
72 struct lttng_ht_node_str node;
48842b30
DG
73};
74
75struct ust_app_channel {
76 int enabled;
77 int handle;
78 char name[LTTNG_UST_SYM_NAME_LEN];
79 struct lttng_ust_channel attr;
13161846 80 struct lttng_ust_object_data *obj;
5af2f756 81 struct ltt_ust_stream_list streams;
bec39940
DG
82 struct lttng_ht *ctx;
83 struct lttng_ht *events;
84 struct lttng_ht_node_str node;
48842b30
DG
85};
86
87struct ust_app_session {
88 int enabled;
8be98f9a
MD
89 /* started: has the session been in started state at any time ? */
90 int started; /* allows detection of start vs restart. */
a991f516
MD
91 int handle; /* used has unique identifier for app session */
92 int id; /* session unique identifier */
48842b30 93 struct ltt_ust_metadata *metadata;
bec39940
DG
94 struct lttng_ht *channels; /* Registered channels */
95 struct lttng_ht_node_ulong node;
96 char path[PATH_MAX];
6df2e2c9
MD
97 /* UID/GID of the user owning the session */
98 uid_t uid;
99 gid_t gid;
48842b30
DG
100};
101
f6a9efaa
DG
102/*
103 * Registered traceable applications. Libust registers to the session daemon
050349bb 104 * and a linked list is kept of all running traceable app.
91d76f53 105 */
56fff090 106struct ust_app {
099e26bd
DG
107 pid_t ppid;
108 uid_t uid; /* User ID that owns the apps */
aea829b3 109 gid_t gid; /* Group ID that owns the apps */
7753dea8 110 int bits_per_long;
099e26bd
DG
111 uint32_t v_major; /* Verion major number */
112 uint32_t v_minor; /* Verion minor number */
113 char name[17]; /* Process name (short) */
bec39940
DG
114 struct lttng_ht *sessions;
115 struct lttng_ht_node_ulong node;
f6a9efaa 116 struct ust_app_key key;
91d76f53
DG
117};
118
74d0b642 119#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081 120
56fff090 121int ust_app_register(struct ust_register_msg *msg, int sock);
f2ca2e25
GF
122static inline
123int ust_app_register_done(int sock)
124{
125 return ustctl_register_done(sock);
126}
56fff090 127void ust_app_unregister(int sock);
f6a9efaa 128unsigned long ust_app_list_count(void);
421cb601 129int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app);
8be98f9a 130int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app);
421cb601 131int ust_app_start_trace_all(struct ltt_ust_session *usess);
8be98f9a 132int ust_app_stop_trace_all(struct ltt_ust_session *usess);
84cd17c6
MD
133int ust_app_destroy_trace(struct ltt_ust_session *usess, struct ust_app *app);
134int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
b551a063 135int ust_app_list_events(struct lttng_event **events);
35a9059d
DG
136int ust_app_create_channel_glb(struct ltt_ust_session *usess,
137 struct ltt_ust_channel *uchan);
138int ust_app_create_event_glb(struct ltt_ust_session *usess,
139 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
7f79d3a1
DG
140int ust_app_disable_event_pid(struct ltt_ust_session *usess,
141 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
142 pid_t pid);
76d45b40
DG
143int ust_app_enable_event_pid(struct ltt_ust_session *usess,
144 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
145 pid_t pid);
35a9059d 146int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
78f0bacd 147 struct ltt_ust_channel *uchan);
35a9059d 148int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
78f0bacd 149 struct ltt_ust_channel *uchan);
35a9059d 150int ust_app_enable_event_glb(struct ltt_ust_session *usess,
edb67388 151 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
35a9059d
DG
152int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
153 struct ltt_ust_channel *uchan);
154int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
9730260e 155 struct ltt_ust_channel *uchan);
35a9059d
DG
156int ust_app_disable_event_glb(struct ltt_ust_session *usess,
157 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
55cc08a6
DG
158int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
159 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
160 struct ltt_ust_context *uctx);
161int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
162 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx);
487cf67c 163void ust_app_global_update(struct ltt_ust_session *usess, int sock);
91d76f53 164
56fff090 165void ust_app_clean_list(void);
f6a9efaa 166void ust_app_ht_alloc(void);
bec39940 167struct lttng_ht *ust_app_get_ht(void);
f6a9efaa 168struct ust_app *ust_app_find_by_pid(pid_t pid);
44d3bd01 169
74d0b642 170#else /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081 171
cc920def
DG
172static inline
173int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
174{
175 return 0;
176}
d974f197 177static inline
421cb601
DG
178int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
179{
180 return 0;
181}
182static inline
183int ust_app_start_trace_all(struct ltt_ust_session *usess)
d974f197 184{
5cf5d0e7 185 return 0;
d974f197 186}
3bd1e081 187static inline
cc920def
DG
188int ust_app_stop_trace_all(struct ltt_ust_session *usess)
189{
190 return 0;
191}
192static inline
b551a063
DG
193int ust_app_list_events(struct lttng_event **events)
194{
195 return 0;
196}
197static inline
3bd1e081
MD
198int ust_app_register(struct ust_register_msg *msg, int sock)
199{
200 return -ENOSYS;
201}
202static inline
f2ca2e25
GF
203int ust_app_register_done(int sock)
204{
205 return -ENOSYS;
206}
207static inline
3bd1e081
MD
208void ust_app_unregister(int sock)
209{
210}
211static inline
212unsigned int ust_app_list_count(void)
213{
214 return 0;
215}
3bd1e081
MD
216static inline
217void ust_app_lock_list(void)
218{
219}
220static inline
221void ust_app_unlock_list(void)
222{
223}
224static inline
225void ust_app_clean_list(void)
226{
227}
228static inline
229struct ust_app_list *ust_app_get_list(void)
230{
231 return NULL;
232}
233static inline
234struct ust_app *ust_app_get_by_pid(pid_t pid)
235{
236 return NULL;
237}
48842b30 238static inline
bec39940 239struct lttng_ht *ust_app_get_ht(void)
d974f197
DG
240{
241 return NULL;
242}
243static inline
244void ust_app_ht_alloc(void)
cc920def
DG
245{}
246static inline
247void ust_app_global_update(struct ltt_ust_session *usess, int sock)
248{}
249static inline
35a9059d 250int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
cc920def 251 struct ltt_ust_channel *uchan)
d974f197 252{
cc920def 253 return 0;
d974f197 254}
487cf67c 255static inline
35a9059d 256int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
cc920def 257 struct ltt_ust_channel *uchan)
487cf67c 258{
cc920def
DG
259 return 0;
260}
261static inline
35a9059d 262int ust_app_create_channel_glb(struct ltt_ust_session *usess,
cc920def
DG
263 struct ltt_ust_channel *uchan)
264{
265 return 0;
266}
267static inline
35a9059d
DG
268int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
269 struct ltt_ust_channel *uchan)
cc920def
DG
270{
271 return 0;
272}
273static inline
35a9059d 274int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
cc920def
DG
275 struct ltt_ust_channel *uchan)
276{
277 return 0;
278}
279static inline
35a9059d
DG
280int ust_app_create_event_glb(struct ltt_ust_session *usess,
281 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
282{
283 return 0;
284}
285static inline
286int ust_app_disable_event_glb(struct ltt_ust_session *usess,
cc920def
DG
287 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
288{
289 return 0;
487cf67c 290}
edb67388 291static inline
35a9059d 292int ust_app_enable_event_glb(struct ltt_ust_session *usess,
edb67388
DG
293 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
294{
295 return 0;
296}
55cc08a6
DG
297static inline
298int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
299 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
300 struct ltt_ust_context *uctx)
301{
302 return 0;
303}
304static inline
305int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
306 struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx)
307{
308 return 0;
309}
76d45b40
DG
310static inline
311int ust_app_enable_event_pid(struct ltt_ust_session *usess,
312 struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
313 pid_t pid)
314{
315 return 0;
316}
7f79d3a1
DG
317static inline
318int ust_app_disable_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}
48842b30 324
74d0b642 325#endif /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081 326
f6a9efaa 327#endif /* _LTT_UST_APP_H */
This page took 0.042564 seconds and 4 git commands to generate.