Rename sessiond internal "uid" fields to "id"
[lttng-tools.git] / lttng-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 23#include <limits.h>
f6a9efaa 24#include <urcu.h>
97ee3a89 25#include <urcu/list.h>
97ee3a89 26#include <lttng/lttng.h>
3bd1e081 27
48842b30 28#include "ust-ctl.h"
97ee3a89 29
f6a9efaa 30#include "../hashtable/rculfhash.h"
0177d773 31
2bdd86d4
MD
32/* UST Stream list */
33struct ltt_ust_stream_list {
34 unsigned int count;
35 struct cds_list_head head;
36};
37
f6a9efaa
DG
38/* Context hash table nodes */
39struct ltt_ust_context {
40 struct lttng_ust_context ctx;
41 struct cds_lfht_node node;
97ee3a89
DG
42};
43
44/* UST event */
45struct ltt_ust_event {
37357452 46 unsigned int enabled;
f6a9efaa
DG
47 struct lttng_ust_event attr;
48 struct cds_lfht *ctx;
49 struct cds_lfht_node node;
2bdd86d4
MD
50};
51
52/* UST stream */
53struct ltt_ust_stream {
48842b30
DG
54 int handle;
55 char pathname[PATH_MAX];
13161846 56 struct lttng_ust_object_data *obj;
5af2f756
MD
57 /* Using a list of streams to keep order. */
58 struct cds_list_head list;
97ee3a89
DG
59};
60
61/* UST channel */
62struct ltt_ust_channel {
37357452 63 unsigned int enabled;
44d3bd01 64 char name[LTTNG_UST_SYM_NAME_LEN];
48842b30 65 char pathname[PATH_MAX];
f6a9efaa
DG
66 struct lttng_ust_channel attr;
67 struct cds_lfht *ctx;
68 struct cds_lfht *events;
69 struct cds_lfht_node node;
97ee3a89
DG
70};
71
72/* UST Metadata */
73struct ltt_ust_metadata {
74 int handle;
13161846 75 struct lttng_ust_object_data *obj;
f6a9efaa 76 char pathname[PATH_MAX]; /* Trace file path name */
44d3bd01 77 struct lttng_ust_channel attr;
13161846 78 struct lttng_ust_object_data *stream_obj;
97ee3a89
DG
79};
80
f6a9efaa
DG
81/* UST domain global (LTTNG_DOMAIN_UST) */
82struct ltt_ust_domain_global {
83 struct cds_lfht *channels;
84};
85
86/* UST domain pid (LTTNG_DOMAIN_UST_PID) */
87struct ltt_ust_domain_pid {
88 pid_t pid;
89 struct cds_lfht *channels;
90 struct cds_lfht_node node;
91};
92
93/* UST domain exec name (LTTNG_DOMAIN_UST_EXEC_NAME) */
94struct ltt_ust_domain_exec {
95 char exec_name[LTTNG_UST_SYM_NAME_LEN];
96 struct cds_lfht *channels;
97 struct cds_lfht_node node;
98};
99
97ee3a89
DG
100/* UST session */
101struct ltt_ust_session {
a991f516 102 int id; /* Unique identifier of session */
36dc12cc 103 int start_trace;
48842b30 104 char pathname[PATH_MAX];
f6a9efaa
DG
105 struct ltt_ust_domain_global domain_global;
106 /*
48842b30
DG
107 * Those two hash tables contains data for a specific UST domain and each
108 * contains a HT of channels. See ltt_ust_domain_exec and
109 * ltt_ust_domain_pid data structures.
f6a9efaa
DG
110 */
111 struct cds_lfht *domain_pid;
112 struct cds_lfht *domain_exec;
97ee3a89
DG
113};
114
74d0b642 115#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081 116
97ee3a89
DG
117/*
118 * Lookup functions. NULL is returned if not found.
119 */
f6a9efaa
DG
120struct ltt_ust_event *trace_ust_find_event_by_name(struct cds_lfht *ht,
121 char *name);
122struct ltt_ust_channel *trace_ust_find_channel_by_name(struct cds_lfht *ht,
123 char *name);
97ee3a89
DG
124
125/*
126 * Create functions malloc() the data structure.
127 */
a991f516 128struct ltt_ust_session *trace_ust_create_session(char *path, int session_id,
44d3bd01
DG
129 struct lttng_domain *domain);
130struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr,
131 char *path);
97ee3a89
DG
132struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev);
133struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
55cc08a6
DG
134struct ltt_ust_context *trace_ust_create_context(
135 struct lttng_event_context *ctx);
97ee3a89
DG
136
137/*
138 * Destroy functions free() the data structure and remove from linked list if
139 * it's applies.
140 */
141void trace_ust_destroy_session(struct ltt_ust_session *session);
142void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
143void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
144void trace_ust_destroy_event(struct ltt_ust_event *event);
145
74d0b642 146#else /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
147
148static inline
f6a9efaa
DG
149struct ltt_ust_event *trace_ust_find_event_by_name(struct cds_lfht *ht,
150 char *name)
3bd1e081
MD
151{
152 return NULL;
153}
f6a9efaa 154
3bd1e081 155static inline
f6a9efaa
DG
156struct ltt_ust_channel *trace_ust_find_channel_by_name(struct cds_lfht *ht,
157 char *name)
3bd1e081
MD
158{
159 return NULL;
160}
f6a9efaa 161
3bd1e081
MD
162static inline
163struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid,
164 struct lttng_domain *domain)
165{
166 return NULL;
167}
168static inline
169struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr,
170 char *path)
171{
172 return NULL;
173}
174static inline
175struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
176{
177 return NULL;
178}
179static inline
180struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
181{
182 return NULL;
183}
184
185static inline
186void trace_ust_destroy_session(struct ltt_ust_session *session)
187{
188}
48842b30 189
3bd1e081
MD
190static inline
191void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
192{
193}
48842b30 194
3bd1e081
MD
195static inline
196void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
197{
198}
48842b30 199
3bd1e081
MD
200static inline
201void trace_ust_destroy_event(struct ltt_ust_event *event)
202{
203}
34378f76
DG
204static inline
205struct ltt_ust_context *trace_ust_create_context(
206 struct lttng_event_context *ctx)
207{
208 return NULL;
209}
3bd1e081 210
74d0b642 211#endif /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081 212
97ee3a89 213#endif /* _LTT_TRACE_UST_H */
This page took 0.035348 seconds and 4 git commands to generate.