| 1 | #ifndef _LTTNG_UST_EVENTS_INTERNAL_H |
| 2 | #define _LTTNG_UST_EVENTS_INTERNAL_H |
| 3 | |
| 4 | /* |
| 5 | * ust-events-internal.h |
| 6 | * |
| 7 | * Copyright 2019 (c) - Francis Deslauriers <francis.deslauriers@efficios.com> |
| 8 | * |
| 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: |
| 15 | * |
| 16 | * The above copyright notice and this permission notice shall be included in |
| 17 | * all copies or substantial portions of the Software. |
| 18 | * |
| 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 |
| 25 | * SOFTWARE. |
| 26 | */ |
| 27 | |
| 28 | #include <stdint.h> |
| 29 | |
| 30 | #include <urcu/list.h> |
| 31 | #include <urcu/hlist.h> |
| 32 | |
| 33 | #include <helper.h> |
| 34 | #include <lttng/ust-events.h> |
| 35 | |
| 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; |
| 40 | /* |
| 41 | * Unused, but kept around to make it explicit that the tracer can do |
| 42 | * it. |
| 43 | */ |
| 44 | struct lttng_ctx *ctx; |
| 45 | }; |
| 46 | |
| 47 | struct lttng_trigger_enabler { |
| 48 | struct lttng_enabler base; |
| 49 | uint64_t id; |
| 50 | struct cds_list_head node; /* per-app list of trigger enablers */ |
| 51 | struct lttng_trigger_group *group; /* weak ref */ |
| 52 | }; |
| 53 | |
| 54 | static inline |
| 55 | struct lttng_enabler *lttng_event_enabler_as_enabler( |
| 56 | struct lttng_event_enabler *event_enabler) |
| 57 | { |
| 58 | return &event_enabler->base; |
| 59 | } |
| 60 | |
| 61 | static inline |
| 62 | struct lttng_enabler *lttng_trigger_enabler_as_enabler( |
| 63 | struct lttng_trigger_enabler *trigger_enabler) |
| 64 | { |
| 65 | return &trigger_enabler->base; |
| 66 | } |
| 67 | |
| 68 | /* TODO doc */ |
| 69 | LTTNG_HIDDEN |
| 70 | struct lttng_event_enabler *lttng_event_enabler_create( |
| 71 | enum lttng_enabler_format_type format_type, |
| 72 | struct lttng_ust_event *event_param, |
| 73 | struct lttng_channel *chan); |
| 74 | |
| 75 | /* TODO doc */ |
| 76 | LTTNG_HIDDEN |
| 77 | void lttng_event_enabler_destroy(struct lttng_event_enabler *enabler); |
| 78 | |
| 79 | /* TODO doc */ |
| 80 | LTTNG_HIDDEN |
| 81 | int lttng_event_enabler_enable(struct lttng_event_enabler *enabler); |
| 82 | |
| 83 | /* TODO doc */ |
| 84 | LTTNG_HIDDEN |
| 85 | int lttng_event_enabler_disable(struct lttng_event_enabler *enabler); |
| 86 | |
| 87 | /* TODO doc */ |
| 88 | LTTNG_HIDDEN |
| 89 | int lttng_event_enabler_attach_bytecode(struct lttng_event_enabler *enabler, |
| 90 | struct lttng_ust_filter_bytecode_node *bytecode); |
| 91 | |
| 92 | /* TODO doc */ |
| 93 | LTTNG_HIDDEN |
| 94 | int lttng_event_enabler_attach_context(struct lttng_event_enabler *enabler, |
| 95 | struct lttng_ust_context *ctx); |
| 96 | |
| 97 | /* TODO doc */ |
| 98 | LTTNG_HIDDEN |
| 99 | int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *enabler, |
| 100 | struct lttng_ust_excluder_node *excluder); |
| 101 | |
| 102 | /* TODO doc */ |
| 103 | LTTNG_HIDDEN |
| 104 | void lttng_enabler_link_bytecode(const struct lttng_event_desc *event_desc, |
| 105 | struct lttng_ctx **ctx, |
| 106 | struct cds_list_head *bytecode_runtime_head, |
| 107 | struct lttng_enabler *enabler); |
| 108 | |
| 109 | /* TODO doc */ |
| 110 | LTTNG_HIDDEN |
| 111 | struct lttng_trigger_group *lttng_trigger_group_create(void); |
| 112 | |
| 113 | /* TODO doc */ |
| 114 | LTTNG_HIDDEN |
| 115 | void lttng_trigger_group_destroy( |
| 116 | struct lttng_trigger_group *trigger_group); |
| 117 | |
| 118 | /* TODO doc */ |
| 119 | LTTNG_HIDDEN |
| 120 | struct lttng_trigger_enabler *lttng_trigger_enabler_create( |
| 121 | struct lttng_trigger_group *trigger_group, |
| 122 | enum lttng_enabler_format_type format_type, |
| 123 | struct lttng_ust_trigger *trigger_param); |
| 124 | |
| 125 | /* TODO doc */ |
| 126 | LTTNG_HIDDEN |
| 127 | void lttng_trigger_enabler_destroy(struct lttng_trigger_enabler *trigger_enabler); |
| 128 | |
| 129 | /* TODO doc */ |
| 130 | LTTNG_HIDDEN |
| 131 | int lttng_trigger_enabler_enable(struct lttng_trigger_enabler *trigger_enabler); |
| 132 | |
| 133 | /* TODO doc */ |
| 134 | LTTNG_HIDDEN |
| 135 | int lttng_trigger_enabler_disable(struct lttng_trigger_enabler *trigger_enabler); |
| 136 | |
| 137 | /* TODO doc */ |
| 138 | LTTNG_HIDDEN |
| 139 | int lttng_trigger_enabler_attach_bytecode( |
| 140 | struct lttng_trigger_enabler *trigger_enabler, |
| 141 | struct lttng_ust_filter_bytecode_node *bytecode); |
| 142 | |
| 143 | /* TODO doc */ |
| 144 | LTTNG_HIDDEN |
| 145 | int lttng_trigger_enabler_attach_exclusion( |
| 146 | struct lttng_trigger_enabler *trigger_enabler, |
| 147 | struct lttng_ust_excluder_node *excluder); |
| 148 | |
| 149 | /* TODO doc */ |
| 150 | LTTNG_HIDDEN |
| 151 | void lttng_free_trigger_filter_runtime(struct lttng_trigger *trigger); |
| 152 | |
| 153 | /* TODO doc */ |
| 154 | LTTNG_HIDDEN |
| 155 | int lttng_fix_pending_triggers(void); |
| 156 | |
| 157 | #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */ |