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
24 #include <lttng/ust-events.h>
25 #include <usterr-signal-safe.h>
26 #include "lttng-tracer-core.h"
29 static CDS_LIST_HEAD(lttng_transport_list
);
31 struct lttng_transport
*lttng_transport_find(const char *name
)
33 struct lttng_transport
*transport
;
35 cds_list_for_each_entry(transport
, <tng_transport_list
, node
) {
36 if (!strcmp(transport
->name
, name
))
43 * lttng_transport_register - LTT transport registration
44 * @transport: transport structure
46 * Registers a transport which can be used as output to extract the data out of
47 * LTTng. Called with ust_lock held.
49 void lttng_transport_register(struct lttng_transport
*transport
)
51 cds_list_add_tail(&transport
->node
, <tng_transport_list
);
55 * lttng_transport_unregister - LTT transport unregistration
56 * @transport: transport structure
57 * Called with ust_lock held.
59 void lttng_transport_unregister(struct lttng_transport
*transport
)
61 cds_list_del(&transport
->node
);
65 * Needed by comm layer.
67 struct lttng_enum
*lttng_ust_enum_get_from_desc(struct lttng_session
*session
,
68 const struct lttng_enum_desc
*enum_desc
)
70 struct lttng_enum
*_enum
;
71 struct cds_hlist_head
*head
;
72 struct cds_hlist_node
*node
;
73 size_t name_len
= strlen(enum_desc
->name
);
76 hash
= jhash(enum_desc
->name
, name_len
, 0);
77 head
= &session
->enums_ht
.table
[hash
& (LTTNG_UST_ENUM_HT_SIZE
- 1)];
78 cds_hlist_for_each_entry(_enum
, node
, head
, hlist
) {
80 if (_enum
->desc
== enum_desc
)
86 size_t lttng_ust_dummy_get_size(struct lttng_ctx_field
*field
, size_t offset
)
90 size
+= lib_ring_buffer_align(offset
, lttng_alignof(char));
91 size
+= sizeof(char); /* tag */
95 void lttng_ust_dummy_record(struct lttng_ctx_field
*field
,
96 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
97 struct lttng_channel
*chan
)
99 char sel_char
= (char) LTTNG_UST_DYNAMIC_TYPE_NONE
;
101 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(sel_char
));
102 chan
->ops
->event_write(ctx
, &sel_char
, sizeof(sel_char
));
105 void lttng_ust_dummy_get_value(struct lttng_ctx_field
*field
,
106 struct lttng_ctx_value
*value
)
108 value
->sel
= LTTNG_UST_DYNAMIC_TYPE_NONE
;
111 int lttng_context_is_app(const char *name
)
113 if (strncmp(name
, "$app.", strlen("$app.")) != 0) {