1 #ifndef _LTTNG_UST_EVENTS_INTERNAL_H
2 #define _LTTNG_UST_EVENTS_INTERNAL_H
5 * ust-events-internal.h
7 * Copyright 2019 (c) - Francis Deslauriers <francis.deslauriers@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <urcu/list.h>
31 #include <urcu/hlist.h>
34 #include <lttng/ust-events.h>
36 struct lttng_event_enabler
{
37 struct lttng_enabler base
;
38 struct cds_list_head node
; /* per-session list of enablers */
39 struct lttng_channel
*chan
;
41 * Unused, but kept around to make it explicit that the tracer can do
44 struct lttng_ctx
*ctx
;
47 struct lttng_ust_filter_bytecode_node
{
48 struct cds_list_head node
;
49 struct lttng_enabler
*enabler
;
51 * struct lttng_ust_filter_bytecode has var. sized array, must
54 struct lttng_ust_filter_bytecode bc
;
57 struct lttng_ust_excluder_node
{
58 struct cds_list_head node
;
59 struct lttng_enabler
*enabler
;
61 * struct lttng_ust_event_exclusion had variable sized array,
64 struct lttng_ust_event_exclusion excluder
;
68 struct lttng_enabler
*lttng_event_enabler_as_enabler(
69 struct lttng_event_enabler
*event_enabler
)
71 return &event_enabler
->base
;
76 * Allocate and initialize a `struct lttng_event_enabler` object.
78 * On success, returns a `struct lttng_event_enabler`,
79 * On memory error, returns NULL.
82 struct lttng_event_enabler
*lttng_event_enabler_create(
83 enum lttng_enabler_format_type format_type
,
84 struct lttng_ust_event
*event_param
,
85 struct lttng_channel
*chan
);
88 * Destroy a `struct lttng_event_enabler` object.
91 void lttng_event_enabler_destroy(struct lttng_event_enabler
*enabler
);
94 * Enable a `struct lttng_event_enabler` object and all events related to this
98 int lttng_event_enabler_enable(struct lttng_event_enabler
*enabler
);
101 * Disable a `struct lttng_event_enabler` object and all events related to this
105 int lttng_event_enabler_disable(struct lttng_event_enabler
*enabler
);
108 * Attach filter bytecode program to `struct lttng_event_enabler` and all
109 * events related to this enabler.
112 int lttng_event_enabler_attach_bytecode(struct lttng_event_enabler
*enabler
,
113 struct lttng_ust_filter_bytecode_node
*bytecode
);
116 * Attach an application context to an event enabler.
121 int lttng_event_enabler_attach_context(struct lttng_event_enabler
*enabler
,
122 struct lttng_ust_context
*ctx
);
125 * Attach exclusion list to `struct lttng_event_enabler` and all
126 * events related to this enabler.
129 int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler
*enabler
,
130 struct lttng_ust_excluder_node
*excluder
);
133 * Synchronize bytecodes for the enabler and the event.
135 * This function goes over all bytecode programs of the event enabler to ensure
136 * each is linked to the provided event.
139 void lttng_event_enabler_link_bytecode(struct lttng_event
*event
,
140 struct lttng_event_enabler
*enabler
);
142 #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */