2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 #include <lttng/ust-events.h>
12 #include <usterr-signal-safe.h>
13 #include "lttng-tracer-core.h"
16 static CDS_LIST_HEAD(lttng_transport_list
);
17 static CDS_LIST_HEAD(lttng_counter_transport_list
);
19 struct lttng_transport
*lttng_transport_find(const char *name
)
21 struct lttng_transport
*transport
;
23 cds_list_for_each_entry(transport
, <tng_transport_list
, node
) {
24 if (!strcmp(transport
->name
, name
))
30 struct lttng_counter_transport
*lttng_counter_transport_find(const char *name
)
32 struct lttng_counter_transport
*transport
;
34 cds_list_for_each_entry(transport
, <tng_counter_transport_list
, node
) {
35 if (!strcmp(transport
->name
, name
))
42 * lttng_transport_register - LTT transport registration
43 * @transport: transport structure
45 * Registers a transport which can be used as output to extract the data out of
46 * LTTng. Called with ust_lock held.
48 void lttng_transport_register(struct lttng_transport
*transport
)
50 cds_list_add_tail(&transport
->node
, <tng_transport_list
);
54 * lttng_transport_unregister - LTT transport unregistration
55 * @transport: transport structure
56 * Called with ust_lock held.
58 void lttng_transport_unregister(struct lttng_transport
*transport
)
60 cds_list_del(&transport
->node
);
64 * lttng_counter_transport_register - LTTng counter transport registration
65 * @transport: transport structure
67 * Registers a counter transport which can be used as output to extract
68 * the data out of LTTng. Called with ust_lock held.
70 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
)
72 cds_list_add_tail(&transport
->node
, <tng_counter_transport_list
);
76 * lttng_counter_transport_unregister - LTTng counter transport unregistration
77 * @transport: transport structure
78 * Called with ust_lock held.
80 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
)
82 cds_list_del(&transport
->node
);
86 * Needed by comm layer.
88 struct lttng_enum
*lttng_ust_enum_get_from_desc(struct lttng_session
*session
,
89 const struct lttng_enum_desc
*enum_desc
)
91 struct lttng_enum
*_enum
;
92 struct cds_hlist_head
*head
;
93 struct cds_hlist_node
*node
;
94 size_t name_len
= strlen(enum_desc
->name
);
97 hash
= jhash(enum_desc
->name
, name_len
, 0);
98 head
= &session
->enums_ht
.table
[hash
& (LTTNG_UST_ENUM_HT_SIZE
- 1)];
99 cds_hlist_for_each_entry(_enum
, node
, head
, hlist
) {
101 if (_enum
->desc
== enum_desc
)
107 size_t lttng_ust_dummy_get_size(struct lttng_ctx_field
*field
, size_t offset
)
111 size
+= lib_ring_buffer_align(offset
, lttng_alignof(char));
112 size
+= sizeof(char); /* tag */
116 void lttng_ust_dummy_record(struct lttng_ctx_field
*field
,
117 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
118 struct lttng_channel
*chan
)
120 char sel_char
= (char) LTTNG_UST_DYNAMIC_TYPE_NONE
;
122 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(sel_char
));
123 chan
->ops
->event_write(ctx
, &sel_char
, sizeof(sel_char
));
126 void lttng_ust_dummy_get_value(struct lttng_ctx_field
*field
,
127 struct lttng_ctx_value
*value
)
129 value
->sel
= LTTNG_UST_DYNAMIC_TYPE_NONE
;
132 int lttng_context_is_app(const char *name
)
134 if (strncmp(name
, "$app.", strlen("$app.")) != 0) {