2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
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
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.
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.
19 #ifndef _LTT_TRACE_UST_H
20 #define _LTT_TRACE_UST_H
24 #include <urcu/list.h>
25 #include <lttng/lttng.h>
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
33 #ifdef CONFIG_CONFIG_LTTNG_TOOLS_HAVE_UST
34 #include <ust/lttng-ust-abi.h>
36 #include "lttng-ust-abi.h"
42 struct ltt_ust_session_list
{
44 struct cds_list_head head
;
48 struct ltt_ust_event_list
{
50 struct cds_list_head head
;
53 /* UST Channel list */
54 struct ltt_ust_channel_list
{
56 struct cds_list_head head
;
60 struct ltt_ust_event
{
63 struct lttng_ust_context ctx
;
64 struct lttng_ust_event attr
;
65 struct cds_list_head list
;
69 struct ltt_ust_channel
{
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
;
76 struct ltt_ust_event_list events
;
77 struct cds_list_head list
;
81 struct ltt_ust_metadata
{
83 char *trace_path
; /* Trace file path name */
84 struct lttng_ust_channel attr
;
88 struct ltt_ust_session
{
91 int consumer_fds_sent
;
93 struct lttng_domain domain
;
94 struct ltt_ust_metadata
*metadata
;
95 struct ltt_ust_channel_list channels
;
96 struct cds_list_head list
;
99 #ifdef CONFIG_LTTNG_TOOLS_HAVE_UST
102 * Lookup functions. NULL is returned if not found.
104 struct ltt_ust_event
*trace_ust_get_event_by_name(
105 char *name
, struct ltt_ust_channel
*channel
);
106 struct ltt_ust_channel
*trace_ust_get_channel_by_name(
107 char *name
, struct ltt_ust_session
*session
);
108 struct ltt_ust_session
*trace_ust_get_session_by_pid(
109 struct ltt_ust_session_list
*session_list
, pid_t pid
);
112 * Create functions malloc() the data structure.
114 struct ltt_ust_session
*trace_ust_create_session(char *path
, pid_t pid
,
115 struct lttng_domain
*domain
);
116 struct ltt_ust_channel
*trace_ust_create_channel(struct lttng_channel
*attr
,
118 struct ltt_ust_event
*trace_ust_create_event(struct lttng_event
*ev
);
119 struct ltt_ust_metadata
*trace_ust_create_metadata(char *path
);
122 * Destroy functions free() the data structure and remove from linked list if
125 void trace_ust_destroy_session(struct ltt_ust_session
*session
);
126 void trace_ust_destroy_metadata(struct ltt_ust_metadata
*metadata
);
127 void trace_ust_destroy_channel(struct ltt_ust_channel
*channel
);
128 void trace_ust_destroy_event(struct ltt_ust_event
*event
);
133 struct ltt_ust_event
*trace_ust_get_event_by_name(
134 char *name
, struct ltt_ust_channel
*channel
)
139 struct ltt_ust_channel
*trace_ust_get_channel_by_name(
140 char *name
, struct ltt_ust_session
*session
)
145 struct ltt_ust_session
*trace_ust_get_session_by_pid(
146 struct ltt_ust_session_list
*session_list
, pid_t pid
)
152 struct ltt_ust_session
*trace_ust_create_session(char *path
, pid_t pid
,
153 struct lttng_domain
*domain
)
158 struct ltt_ust_channel
*trace_ust_create_channel(struct lttng_channel
*attr
,
164 struct ltt_ust_event
*trace_ust_create_event(struct lttng_event
*ev
)
169 struct ltt_ust_metadata
*trace_ust_create_metadata(char *path
)
175 void trace_ust_destroy_session(struct ltt_ust_session
*session
)
179 void trace_ust_destroy_metadata(struct ltt_ust_metadata
*metadata
)
183 void trace_ust_destroy_channel(struct ltt_ust_channel
*channel
)
187 void trace_ust_destroy_event(struct ltt_ust_event
*event
)
193 #endif /* _LTT_TRACE_UST_H */