4 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; only
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <lttng/ust-events.h>
26 #include <usterr-signal-safe.h>
27 #include "lttng-tracer-core.h"
30 static CDS_LIST_HEAD(lttng_transport_list
);
31 static CDS_LIST_HEAD(lttng_counter_transport_list
);
33 struct lttng_transport
*lttng_transport_find(const char *name
)
35 struct lttng_transport
*transport
;
37 cds_list_for_each_entry(transport
, <tng_transport_list
, node
) {
38 if (!strcmp(transport
->name
, name
))
44 struct lttng_counter_transport
*lttng_counter_transport_find(const char *name
)
46 struct lttng_counter_transport
*transport
;
48 cds_list_for_each_entry(transport
, <tng_counter_transport_list
, node
) {
49 if (!strcmp(transport
->name
, name
))
56 * lttng_transport_register - LTT transport registration
57 * @transport: transport structure
59 * Registers a transport which can be used as output to extract the data out of
60 * LTTng. Called with ust_lock held.
62 void lttng_transport_register(struct lttng_transport
*transport
)
64 cds_list_add_tail(&transport
->node
, <tng_transport_list
);
68 * lttng_transport_unregister - LTT transport unregistration
69 * @transport: transport structure
70 * Called with ust_lock held.
72 void lttng_transport_unregister(struct lttng_transport
*transport
)
74 cds_list_del(&transport
->node
);
78 * lttng_counter_transport_register - LTTng counter transport registration
79 * @transport: transport structure
81 * Registers a counter transport which can be used as output to extract
82 * the data out of LTTng. Called with ust_lock held.
84 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
)
86 cds_list_add_tail(&transport
->node
, <tng_counter_transport_list
);
90 * lttng_counter_transport_unregister - LTTng counter transport unregistration
91 * @transport: transport structure
92 * Called with ust_lock held.
94 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
)
96 cds_list_del(&transport
->node
);
100 * Needed by comm layer.
102 struct lttng_enum
*lttng_ust_enum_get_from_desc(struct lttng_session
*session
,
103 const struct lttng_enum_desc
*enum_desc
)
105 struct lttng_enum
*_enum
;
106 struct cds_hlist_head
*head
;
107 struct cds_hlist_node
*node
;
108 size_t name_len
= strlen(enum_desc
->name
);
111 hash
= jhash(enum_desc
->name
, name_len
, 0);
112 head
= &session
->enums_ht
.table
[hash
& (LTTNG_UST_ENUM_HT_SIZE
- 1)];
113 cds_hlist_for_each_entry(_enum
, node
, head
, hlist
) {
115 if (_enum
->desc
== enum_desc
)
121 size_t lttng_ust_dummy_get_size(struct lttng_ctx_field
*field
, size_t offset
)
125 size
+= lib_ring_buffer_align(offset
, lttng_alignof(char));
126 size
+= sizeof(char); /* tag */
130 void lttng_ust_dummy_record(struct lttng_ctx_field
*field
,
131 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
132 struct lttng_channel
*chan
)
134 char sel_char
= (char) LTTNG_UST_DYNAMIC_TYPE_NONE
;
136 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(sel_char
));
137 chan
->ops
->event_write(ctx
, &sel_char
, sizeof(sel_char
));
140 void lttng_ust_dummy_get_value(struct lttng_ctx_field
*field
,
141 struct lttng_ctx_value
*value
)
143 value
->sel
= LTTNG_UST_DYNAMIC_TYPE_NONE
;
146 int lttng_context_is_app(const char *name
)
148 if (strncmp(name
, "$app.", strlen("$app.")) != 0) {