UST 2.0 support
[lttng-tools.git] / ltt-sessiond / trace-ust.h
CommitLineData
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
3bd1e081 22#include <config.h>
97ee3a89
DG
23#include <limits.h>
24#include <urcu/list.h>
97ee3a89 25#include <lttng/lttng.h>
3bd1e081
MD
26
27/*
28 * FIXME: temporary workaround: we use a lttng-tools local version of
29 * lttng-ust-abi.h if UST is not found. Eventually, we should use our
30 * own internal structures within lttng-tools instead of relying on the
31 * UST ABI.
32 */
33#ifdef CONFIG_CONFIG_LTTNG_TOOLS_HAVE_UST
34#include <ust/lttng-ust-abi.h>
35#else
36#include "lttng-ust-abi.h"
37#endif
97ee3a89 38
0177d773
DG
39/*
40 * UST session list.
41 */
42struct ltt_ust_session_list {
43 unsigned int count;
44 struct cds_list_head head;
45};
46
97ee3a89
DG
47/* UST event list */
48struct ltt_ust_event_list {
49 unsigned int count;
50 struct cds_list_head head;
51};
52
53/* UST Channel list */
54struct ltt_ust_channel_list {
55 unsigned int count;
56 struct cds_list_head head;
57};
58
59/* UST event */
60struct ltt_ust_event {
61 int handle;
62 int enabled;
44d3bd01
DG
63 struct lttng_ust_context ctx;
64 struct lttng_ust_event attr;
97ee3a89
DG
65 struct cds_list_head list;
66};
67
68/* UST channel */
69struct ltt_ust_channel {
70 int handle;
71 int enabled;
44d3bd01
DG
72 char name[LTTNG_UST_SYM_NAME_LEN];
73 char trace_path[PATH_MAX]; /* Trace file path name */
74 struct lttng_ust_context ctx;
75 struct lttng_ust_channel attr;
97ee3a89
DG
76 struct ltt_ust_event_list events;
77 struct cds_list_head list;
78};
79
80/* UST Metadata */
81struct ltt_ust_metadata {
82 int handle;
83 char *trace_path; /* Trace file path name */
44d3bd01 84 struct lttng_ust_channel attr;
97ee3a89
DG
85};
86
87/* UST session */
88struct ltt_ust_session {
89 int handle;
90 int enabled;
3bd1e081 91 int consumer_fds_sent;
44d3bd01
DG
92 char path[PATH_MAX];
93 struct lttng_domain domain;
97ee3a89
DG
94 struct ltt_ust_metadata *metadata;
95 struct ltt_ust_channel_list channels;
0177d773 96 struct cds_list_head list;
97ee3a89
DG
97};
98
3bd1e081
MD
99#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST
100
97ee3a89
DG
101/*
102 * Lookup functions. NULL is returned if not found.
103 */
104struct ltt_ust_event *trace_ust_get_event_by_name(
105 char *name, struct ltt_ust_channel *channel);
106struct ltt_ust_channel *trace_ust_get_channel_by_name(
107 char *name, struct ltt_ust_session *session);
44d3bd01
DG
108struct ltt_ust_session *trace_ust_get_session_by_pid(
109 struct ltt_ust_session_list *session_list, pid_t pid);
97ee3a89
DG
110
111/*
112 * Create functions malloc() the data structure.
113 */
44d3bd01
DG
114struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid,
115 struct lttng_domain *domain);
116struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr,
117 char *path);
97ee3a89
DG
118struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev);
119struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
120
121/*
122 * Destroy functions free() the data structure and remove from linked list if
123 * it's applies.
124 */
125void trace_ust_destroy_session(struct ltt_ust_session *session);
126void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
127void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
128void trace_ust_destroy_event(struct ltt_ust_event *event);
129
3bd1e081
MD
130#else
131
132static inline
133struct ltt_ust_event *trace_ust_get_event_by_name(
134 char *name, struct ltt_ust_channel *channel)
135{
136 return NULL;
137}
138static inline
139struct ltt_ust_channel *trace_ust_get_channel_by_name(
140 char *name, struct ltt_ust_session *session)
141{
142 return NULL;
143}
144static inline
145struct ltt_ust_session *trace_ust_get_session_by_pid(
146 struct ltt_ust_session_list *session_list, pid_t pid)
147{
148 return NULL;
149}
150
151static inline
152struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid,
153 struct lttng_domain *domain)
154{
155 return NULL;
156}
157static inline
158struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr,
159 char *path)
160{
161 return NULL;
162}
163static inline
164struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
165{
166 return NULL;
167}
168static inline
169struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
170{
171 return NULL;
172}
173
174static inline
175void trace_ust_destroy_session(struct ltt_ust_session *session)
176{
177}
178static inline
179void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
180{
181}
182static inline
183void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
184{
185}
186static inline
187void trace_ust_destroy_event(struct ltt_ust_event *event)
188{
189}
190
191#endif
192
97ee3a89 193#endif /* _LTT_TRACE_UST_H */
This page took 0.029948 seconds and 4 git commands to generate.