Commit | Line | Data |
---|---|---|
97ee3a89 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 | |
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_TRACE_UST_H | |
20 | #define _LTT_TRACE_UST_H | |
21 | ||
22 | #include <limits.h> | |
23 | #include <urcu/list.h> | |
24 | ||
25 | #include <lttng/lttng.h> | |
26 | #include <lttng-ust.h> | |
27 | ||
0177d773 DG |
28 | /* |
29 | * UST session list. | |
30 | */ | |
31 | struct ltt_ust_session_list { | |
32 | unsigned int count; | |
33 | struct cds_list_head head; | |
34 | }; | |
35 | ||
97ee3a89 DG |
36 | /* UST event list */ |
37 | struct ltt_ust_event_list { | |
38 | unsigned int count; | |
39 | struct cds_list_head head; | |
40 | }; | |
41 | ||
42 | /* UST Channel list */ | |
43 | struct ltt_ust_channel_list { | |
44 | unsigned int count; | |
45 | struct cds_list_head head; | |
46 | }; | |
47 | ||
48 | /* UST event */ | |
49 | struct ltt_ust_event { | |
50 | int handle; | |
51 | int enabled; | |
44d3bd01 DG |
52 | struct lttng_ust_context ctx; |
53 | struct lttng_ust_event attr; | |
97ee3a89 DG |
54 | struct cds_list_head list; |
55 | }; | |
56 | ||
57 | /* UST channel */ | |
58 | struct ltt_ust_channel { | |
59 | int handle; | |
60 | int enabled; | |
44d3bd01 DG |
61 | char name[LTTNG_UST_SYM_NAME_LEN]; |
62 | char trace_path[PATH_MAX]; /* Trace file path name */ | |
63 | struct lttng_ust_context ctx; | |
64 | struct lttng_ust_channel attr; | |
97ee3a89 DG |
65 | struct ltt_ust_event_list events; |
66 | struct cds_list_head list; | |
67 | }; | |
68 | ||
69 | /* UST Metadata */ | |
70 | struct ltt_ust_metadata { | |
71 | int handle; | |
72 | char *trace_path; /* Trace file path name */ | |
44d3bd01 | 73 | struct lttng_ust_channel attr; |
97ee3a89 DG |
74 | }; |
75 | ||
76 | /* UST session */ | |
77 | struct ltt_ust_session { | |
78 | int handle; | |
79 | int enabled; | |
80 | int uconsumer_fds_sent; | |
44d3bd01 DG |
81 | char path[PATH_MAX]; |
82 | struct lttng_domain domain; | |
97ee3a89 DG |
83 | struct ltt_ust_metadata *metadata; |
84 | struct ltt_ust_channel_list channels; | |
0177d773 | 85 | struct cds_list_head list; |
97ee3a89 DG |
86 | }; |
87 | ||
88 | /* | |
89 | * Lookup functions. NULL is returned if not found. | |
90 | */ | |
91 | struct ltt_ust_event *trace_ust_get_event_by_name( | |
92 | char *name, struct ltt_ust_channel *channel); | |
93 | struct ltt_ust_channel *trace_ust_get_channel_by_name( | |
94 | char *name, struct ltt_ust_session *session); | |
44d3bd01 DG |
95 | struct ltt_ust_session *trace_ust_get_session_by_pid( |
96 | struct ltt_ust_session_list *session_list, pid_t pid); | |
97ee3a89 DG |
97 | |
98 | /* | |
99 | * Create functions malloc() the data structure. | |
100 | */ | |
44d3bd01 DG |
101 | struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid, |
102 | struct lttng_domain *domain); | |
103 | struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr, | |
104 | char *path); | |
97ee3a89 DG |
105 | struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev); |
106 | struct ltt_ust_metadata *trace_ust_create_metadata(char *path); | |
107 | ||
108 | /* | |
109 | * Destroy functions free() the data structure and remove from linked list if | |
110 | * it's applies. | |
111 | */ | |
112 | void trace_ust_destroy_session(struct ltt_ust_session *session); | |
113 | void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata); | |
114 | void trace_ust_destroy_channel(struct ltt_ust_channel *channel); | |
115 | void trace_ust_destroy_event(struct ltt_ust_event *event); | |
116 | ||
117 | #endif /* _LTT_TRACE_UST_H */ |