2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #include <lttng/trigger/trigger-internal.h>
9 #include <lttng/condition/condition-internal.h>
10 #include <lttng/condition/on-event-internal.h>
11 #include <lttng/condition/on-event.h>
12 #include <lttng/condition/on-event-internal.h>
13 #include <lttng/condition/buffer-usage.h>
14 #include <lttng/event-rule/event-rule-internal.h>
15 #include <lttng/event-expr-internal.h>
16 #include <lttng/action/action-internal.h>
17 #include <common/credentials.h>
18 #include <common/payload.h>
19 #include <common/payload-view.h>
20 #include <lttng/domain.h>
21 #include <common/error.h>
22 #include <common/dynamic-array.h>
23 #include <common/optional.h>
28 bool lttng_trigger_validate(const struct lttng_trigger
*trigger
)
37 if (!trigger
->creds
.uid
.is_set
) {
42 valid
= lttng_condition_validate(trigger
->condition
) &&
43 lttng_action_validate(trigger
->action
);
48 struct lttng_trigger
*lttng_trigger_create(
49 struct lttng_condition
*condition
,
50 struct lttng_action
*action
)
52 struct lttng_trigger
*trigger
= NULL
;
54 if (!condition
|| !action
) {
58 trigger
= zmalloc(sizeof(struct lttng_trigger
));
63 urcu_ref_init(&trigger
->ref
);
65 trigger
->firing_policy
.type
= LTTNG_TRIGGER_FIRING_POLICY_EVERY_N
;
66 trigger
->firing_policy
.threshold
= 1;
68 lttng_condition_get(condition
);
69 trigger
->condition
= condition
;
71 lttng_action_get(action
);
72 trigger
->action
= action
;
79 * Note: the lack of reference counting 'get' on the condition object is normal.
80 * This API was exposed as such in 2.11. The client is not expected to call
81 * lttng_condition_destroy on the returned object.
83 struct lttng_condition
*lttng_trigger_get_condition(
84 struct lttng_trigger
*trigger
)
86 return trigger
? trigger
->condition
: NULL
;
89 const struct lttng_condition
*lttng_trigger_get_const_condition(
90 const struct lttng_trigger
*trigger
)
92 return trigger
? trigger
->condition
: NULL
;
96 * Note: the lack of reference counting 'get' on the action object is normal.
97 * This API was exposed as such in 2.11. The client is not expected to call
98 * lttng_action_destroy on the returned object.
100 struct lttng_action
*lttng_trigger_get_action(
101 struct lttng_trigger
*trigger
)
103 return trigger
? trigger
->action
: NULL
;
106 const struct lttng_action
*lttng_trigger_get_const_action(
107 const struct lttng_trigger
*trigger
)
109 return trigger
? trigger
->action
: NULL
;
112 static void trigger_destroy_ref(struct urcu_ref
*ref
)
114 struct lttng_trigger
*trigger
=
115 container_of(ref
, struct lttng_trigger
, ref
);
116 struct lttng_action
*action
= lttng_trigger_get_action(trigger
);
117 struct lttng_condition
*condition
=
118 lttng_trigger_get_condition(trigger
);
123 /* Release ownership. */
124 lttng_action_put(action
);
125 lttng_condition_put(condition
);
131 void lttng_trigger_destroy(struct lttng_trigger
*trigger
)
133 lttng_trigger_put(trigger
);
136 static bool is_firing_policy_valid(enum lttng_trigger_firing_policy policy
)
141 case LTTNG_TRIGGER_FIRING_POLICY_EVERY_N
:
142 case LTTNG_TRIGGER_FIRING_POLICY_ONCE_AFTER_N
:
154 ssize_t
lttng_trigger_create_from_payload(
155 struct lttng_payload_view
*src_view
,
156 struct lttng_trigger
**_trigger
)
158 ssize_t ret
, offset
= 0, condition_size
, action_size
, name_size
= 0;
159 struct lttng_condition
*condition
= NULL
;
160 struct lttng_action
*action
= NULL
;
161 const struct lttng_trigger_comm
*trigger_comm
;
162 const char *name
= NULL
;
163 uint64_t firing_policy_threshold
;
164 enum lttng_trigger_firing_policy firing_policy
;
165 struct lttng_credentials creds
= {
166 .uid
= LTTNG_OPTIONAL_INIT_UNSET
,
167 .gid
= LTTNG_OPTIONAL_INIT_UNSET
,
169 struct lttng_trigger
*trigger
= NULL
;
170 const struct lttng_payload_view trigger_comm_view
=
171 lttng_payload_view_from_view(
172 src_view
, 0, sizeof(*trigger_comm
));
174 if (!src_view
|| !_trigger
) {
179 if (!lttng_payload_view_is_valid(&trigger_comm_view
)) {
180 /* Payload not large enough to contain the header. */
185 /* lttng_trigger_comm header */
186 trigger_comm
= (typeof(trigger_comm
)) trigger_comm_view
.buffer
.data
;
188 /* Set the trigger's creds. */
189 if (trigger_comm
->uid
> (uint64_t) ((uid_t
) -1)) {
190 /* UID out of range for this platform. */
195 LTTNG_OPTIONAL_SET(&creds
.uid
, trigger_comm
->uid
);
197 offset
+= sizeof(*trigger_comm
);
199 firing_policy
= trigger_comm
->firing_policy_type
;
200 if (!is_firing_policy_valid(firing_policy
)) {
205 firing_policy_threshold
= trigger_comm
->firing_policy_threshold
;
206 if (trigger_comm
->name_length
!= 0) {
208 const struct lttng_payload_view name_view
=
209 lttng_payload_view_from_view(
211 trigger_comm
->name_length
);
213 if (!lttng_payload_view_is_valid(&name_view
)) {
218 name
= name_view
.buffer
.data
;
219 if (!lttng_buffer_view_contains_string(&name_view
.buffer
, name
,
220 trigger_comm
->name_length
)) {
225 offset
+= trigger_comm
->name_length
;
226 name_size
= trigger_comm
->name_length
;
230 /* struct lttng_condition */
231 struct lttng_payload_view condition_view
=
232 lttng_payload_view_from_view(
233 src_view
, offset
, -1);
235 condition_size
= lttng_condition_create_from_payload(&condition_view
,
239 if (condition_size
< 0) {
240 ret
= condition_size
;
244 offset
+= condition_size
;
246 /* struct lttng_action */
247 struct lttng_payload_view action_view
=
248 lttng_payload_view_from_view(
249 src_view
, offset
, -1);
251 action_size
= lttng_action_create_from_payload(&action_view
, &action
);
254 if (action_size
< 0) {
258 offset
+= action_size
;
260 /* Unexpected size of inner-elements; the buffer is corrupted. */
261 if ((ssize_t
) trigger_comm
->length
!= condition_size
+ action_size
+ name_size
) {
266 trigger
= lttng_trigger_create(condition
, action
);
272 lttng_trigger_set_credentials(trigger
, &creds
);
275 * The trigger object owns references to the action and condition
278 lttng_condition_put(condition
);
281 lttng_action_put(action
);
285 const enum lttng_trigger_status status
=
286 lttng_trigger_set_name(trigger
, name
);
288 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
294 /* Set the policy. */
296 const enum lttng_trigger_status status
=
297 lttng_trigger_set_firing_policy(trigger
,
299 firing_policy_threshold
);
301 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
310 lttng_condition_put(condition
);
311 lttng_action_put(action
);
316 lttng_trigger_put(trigger
);
323 * Both elements are stored contiguously, see their "*_comm" structure
324 * for the detailed format.
327 int lttng_trigger_serialize(const struct lttng_trigger
*trigger
,
328 struct lttng_payload
*payload
)
331 size_t header_offset
, size_before_payload
, size_name
;
332 struct lttng_trigger_comm trigger_comm
= {};
333 struct lttng_trigger_comm
*header
;
334 const struct lttng_credentials
*creds
= NULL
;
336 creds
= lttng_trigger_get_credentials(trigger
);
339 trigger_comm
.uid
= LTTNG_OPTIONAL_GET(creds
->uid
);
341 if (trigger
->name
!= NULL
) {
342 size_name
= strlen(trigger
->name
) + 1;
347 trigger_comm
.name_length
= size_name
;
348 trigger_comm
.firing_policy_type
= (uint8_t) trigger
->firing_policy
.type
;
349 trigger_comm
.firing_policy_threshold
= (uint64_t) trigger
->firing_policy
.threshold
;
351 header_offset
= payload
->buffer
.size
;
352 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &trigger_comm
,
353 sizeof(trigger_comm
));
358 size_before_payload
= payload
->buffer
.size
;
361 ret
= lttng_dynamic_buffer_append(
362 &payload
->buffer
, trigger
->name
, size_name
);
367 ret
= lttng_condition_serialize(trigger
->condition
, payload
);
372 ret
= lttng_action_serialize(trigger
->action
, payload
);
377 /* Update payload size. */
378 header
= (typeof(header
)) (payload
->buffer
.data
+ header_offset
);
379 header
->length
= payload
->buffer
.size
- size_before_payload
;
385 bool lttng_trigger_is_equal(
386 const struct lttng_trigger
*a
, const struct lttng_trigger
*b
)
388 if (a
->firing_policy
.type
!= b
->firing_policy
.type
) {
392 if (a
->firing_policy
.threshold
!= b
->firing_policy
.threshold
) {
396 if (strcmp(a
->name
, b
->name
) != 0) {
400 if (!lttng_condition_is_equal(a
->condition
, b
->condition
)) {
404 if (!lttng_action_is_equal(a
->action
, b
->action
)) {
408 if (!lttng_credentials_is_equal(lttng_trigger_get_credentials(a
),
409 lttng_trigger_get_credentials(b
))) {
416 enum lttng_trigger_status
lttng_trigger_set_name(struct lttng_trigger
*trigger
,
419 char *name_copy
= NULL
;
420 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
422 if (!trigger
|| !name
||
424 status
= LTTNG_TRIGGER_STATUS_INVALID
;
428 name_copy
= strdup(name
);
430 status
= LTTNG_TRIGGER_STATUS_ERROR
;
436 trigger
->name
= name_copy
;
442 enum lttng_trigger_status
lttng_trigger_get_name(
443 const struct lttng_trigger
*trigger
, const char **name
)
445 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
447 if (!trigger
|| !name
) {
448 status
= LTTNG_TRIGGER_STATUS_INVALID
;
452 if (!trigger
->name
) {
453 status
= LTTNG_TRIGGER_STATUS_UNSET
;
456 *name
= trigger
->name
;
462 int lttng_trigger_assign_name(struct lttng_trigger
*dst
,
463 const struct lttng_trigger
*src
)
466 enum lttng_trigger_status status
;
468 status
= lttng_trigger_set_name(dst
, src
->name
);
469 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
471 ERR("Failed to set name for trigger");
479 void lttng_trigger_set_tracer_token(struct lttng_trigger
*trigger
,
483 LTTNG_OPTIONAL_SET(&trigger
->tracer_token
, token
);
487 uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger
*trigger
)
491 return LTTNG_OPTIONAL_GET(trigger
->tracer_token
);
495 int lttng_trigger_generate_name(struct lttng_trigger
*trigger
,
499 char *generated_name
= NULL
;
501 ret
= asprintf(&generated_name
, "T%" PRIu64
"", unique_id
);
503 ERR("Failed to generate trigger name");
510 trigger
->name
= generated_name
;
516 void lttng_trigger_get(struct lttng_trigger
*trigger
)
518 urcu_ref_get(&trigger
->ref
);
522 void lttng_trigger_put(struct lttng_trigger
*trigger
)
528 urcu_ref_put(&trigger
->ref
, trigger_destroy_ref
);
531 static void delete_trigger_array_element(void *ptr
)
533 struct lttng_trigger
*trigger
= ptr
;
535 lttng_trigger_put(trigger
);
539 struct lttng_triggers
*lttng_triggers_create(void)
541 struct lttng_triggers
*triggers
= NULL
;
543 triggers
= zmalloc(sizeof(*triggers
));
548 lttng_dynamic_pointer_array_init(&triggers
->array
, delete_trigger_array_element
);
555 struct lttng_trigger
*lttng_triggers_borrow_mutable_at_index(
556 const struct lttng_triggers
*triggers
, unsigned int index
)
558 struct lttng_trigger
*trigger
= NULL
;
561 if (index
>= lttng_dynamic_pointer_array_get_count(&triggers
->array
)) {
565 trigger
= (struct lttng_trigger
*)
566 lttng_dynamic_pointer_array_get_pointer(
567 &triggers
->array
, index
);
573 int lttng_triggers_add(
574 struct lttng_triggers
*triggers
, struct lttng_trigger
*trigger
)
581 lttng_trigger_get(trigger
);
583 ret
= lttng_dynamic_pointer_array_add_pointer(&triggers
->array
, trigger
);
585 lttng_trigger_put(trigger
);
591 const struct lttng_trigger
*lttng_triggers_get_at_index(
592 const struct lttng_triggers
*triggers
, unsigned int index
)
594 return lttng_triggers_borrow_mutable_at_index(triggers
, index
);
597 enum lttng_trigger_status
lttng_triggers_get_count(const struct lttng_triggers
*triggers
, unsigned int *count
)
599 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
601 if (!triggers
|| !count
) {
602 status
= LTTNG_TRIGGER_STATUS_INVALID
;
606 *count
= lttng_dynamic_pointer_array_get_count(&triggers
->array
);
611 void lttng_triggers_destroy(struct lttng_triggers
*triggers
)
617 lttng_dynamic_pointer_array_reset(&triggers
->array
);
621 int lttng_triggers_serialize(const struct lttng_triggers
*triggers
,
622 struct lttng_payload
*payload
)
625 unsigned int i
, count
;
626 size_t size_before_payload
;
627 struct lttng_triggers_comm triggers_comm
= {};
628 struct lttng_triggers_comm
*header
;
629 enum lttng_trigger_status status
;
630 const size_t header_offset
= payload
->buffer
.size
;
632 status
= lttng_triggers_get_count(triggers
, &count
);
633 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
634 ret
= LTTNG_ERR_INVALID
;
638 triggers_comm
.count
= count
;
640 /* Placeholder header; updated at the end. */
641 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &triggers_comm
,
642 sizeof(triggers_comm
));
647 size_before_payload
= payload
->buffer
.size
;
649 for (i
= 0; i
< count
; i
++) {
650 const struct lttng_trigger
*trigger
=
651 lttng_triggers_get_at_index(triggers
, i
);
655 ret
= lttng_trigger_serialize(trigger
, payload
);
661 /* Update payload size. */
662 header
= (struct lttng_triggers_comm
*) ((char *) payload
->buffer
.data
+ header_offset
);
663 header
->length
= payload
->buffer
.size
- size_before_payload
;
669 ssize_t
lttng_triggers_create_from_payload(
670 struct lttng_payload_view
*src_view
,
671 struct lttng_triggers
**triggers
)
673 ssize_t ret
, offset
= 0, triggers_size
= 0;
675 const struct lttng_triggers_comm
*triggers_comm
;
676 struct lttng_triggers
*local_triggers
= NULL
;
678 if (!src_view
|| !triggers
) {
683 /* lttng_trigger_comms header */
684 triggers_comm
= (const struct lttng_triggers_comm
*) src_view
->buffer
.data
;
685 offset
+= sizeof(*triggers_comm
);
687 local_triggers
= lttng_triggers_create();
688 if (!local_triggers
) {
693 for (i
= 0; i
< triggers_comm
->count
; i
++) {
694 struct lttng_trigger
*trigger
= NULL
;
695 struct lttng_payload_view trigger_view
=
696 lttng_payload_view_from_view(src_view
, offset
, -1);
697 ssize_t trigger_size
;
699 trigger_size
= lttng_trigger_create_from_payload(
700 &trigger_view
, &trigger
);
701 if (trigger_size
< 0) {
706 /* Transfer ownership of the trigger to the collection. */
707 ret
= lttng_triggers_add(local_triggers
, trigger
);
708 lttng_trigger_put(trigger
);
714 offset
+= trigger_size
;
715 triggers_size
+= trigger_size
;
718 /* Unexpected size of inner-elements; the buffer is corrupted. */
719 if ((ssize_t
) triggers_comm
->length
!= triggers_size
) {
724 /* Pass ownership to caller. */
725 *triggers
= local_triggers
;
726 local_triggers
= NULL
;
731 lttng_triggers_destroy(local_triggers
);
736 const struct lttng_credentials
*lttng_trigger_get_credentials(
737 const struct lttng_trigger
*trigger
)
739 return &trigger
->creds
;
743 void lttng_trigger_set_credentials(struct lttng_trigger
*trigger
,
744 const struct lttng_credentials
*creds
)
747 trigger
->creds
= *creds
;
750 enum lttng_trigger_status
lttng_trigger_set_owner_uid(
751 struct lttng_trigger
*trigger
, uid_t uid
)
753 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
754 const struct lttng_credentials creds
= {
755 .uid
= LTTNG_OPTIONAL_INIT_VALUE(uid
),
756 .gid
= LTTNG_OPTIONAL_INIT_UNSET
,
760 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
764 /* Client-side validation only to report a clearer error. */
765 if (geteuid() != 0) {
766 ret
= LTTNG_TRIGGER_STATUS_PERMISSION_DENIED
;
770 lttng_trigger_set_credentials(trigger
, &creds
);
776 enum lttng_trigger_status
lttng_trigger_get_owner_uid(
777 const struct lttng_trigger
*trigger
, uid_t
*uid
)
779 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
780 const struct lttng_credentials
*creds
= NULL
;
782 if (!trigger
|| !uid
) {
783 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
787 if (!trigger
->creds
.uid
.is_set
) {
788 ret
= LTTNG_TRIGGER_STATUS_UNSET
;
792 creds
= lttng_trigger_get_credentials(trigger
);
793 *uid
= lttng_credentials_get_uid(creds
);
799 enum lttng_trigger_status
lttng_trigger_set_firing_policy(
800 struct lttng_trigger
*trigger
,
801 enum lttng_trigger_firing_policy policy_type
,
804 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
808 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
812 trigger
->firing_policy
.type
= policy_type
;
813 trigger
->firing_policy
.threshold
= threshold
;
819 enum lttng_trigger_status
lttng_trigger_get_firing_policy(
820 const struct lttng_trigger
*trigger
,
821 enum lttng_trigger_firing_policy
*policy_type
,
824 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
826 if (!trigger
|| !policy_type
|| !threshold
) {
827 status
= LTTNG_TRIGGER_STATUS_INVALID
;
831 *policy_type
= trigger
->firing_policy
.type
;
832 *threshold
= trigger
->firing_policy
.threshold
;
839 bool lttng_trigger_should_fire(const struct lttng_trigger
*trigger
)
841 bool ready_to_fire
= false;
845 switch (trigger
->firing_policy
.type
) {
846 case LTTNG_TRIGGER_FIRING_POLICY_EVERY_N
:
847 if (trigger
->firing_policy
.current_count
< trigger
->firing_policy
.threshold
) {
848 ready_to_fire
= true;
851 case LTTNG_TRIGGER_FIRING_POLICY_ONCE_AFTER_N
:
852 if (trigger
->firing_policy
.current_count
< trigger
->firing_policy
.threshold
) {
853 ready_to_fire
= true;
860 return ready_to_fire
;
864 void lttng_trigger_fire(struct lttng_trigger
*trigger
)
868 trigger
->firing_policy
.current_count
++;
870 switch (trigger
->firing_policy
.type
) {
871 case LTTNG_TRIGGER_FIRING_POLICY_EVERY_N
:
872 if (trigger
->firing_policy
.current_count
== trigger
->firing_policy
.threshold
) {
873 trigger
->firing_policy
.current_count
= 0;
877 case LTTNG_TRIGGER_FIRING_POLICY_ONCE_AFTER_N
:
880 * As an optimisation, deactivate the trigger condition and
881 * remove any checks in the traced application or kernel since
882 * the trigger will never fire again.
891 enum lttng_domain_type
lttng_trigger_get_underlying_domain_type_restriction(
892 const struct lttng_trigger
*trigger
)
894 enum lttng_domain_type type
= LTTNG_DOMAIN_NONE
;
895 const struct lttng_event_rule
*event_rule
;
896 enum lttng_condition_status c_status
;
897 enum lttng_condition_type c_type
;
900 assert(trigger
->condition
);
902 c_type
= lttng_condition_get_type(trigger
->condition
);
903 assert (c_type
!= LTTNG_CONDITION_TYPE_UNKNOWN
);
906 case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE
:
907 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING
:
908 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED
:
909 /* Apply to any domain. */
910 type
= LTTNG_DOMAIN_NONE
;
912 case LTTNG_CONDITION_TYPE_ON_EVENT
:
913 /* Return the domain of the event rule. */
914 c_status
= lttng_condition_on_event_get_rule(
915 trigger
->condition
, &event_rule
);
916 assert(c_status
== LTTNG_CONDITION_STATUS_OK
);
917 type
= lttng_event_rule_get_domain_type(event_rule
);
919 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH
:
920 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW
:
921 /* Return the domain of the channel being monitored. */
922 c_status
= lttng_condition_buffer_usage_get_domain_type(
923 trigger
->condition
, &type
);
924 assert(c_status
== LTTNG_CONDITION_STATUS_OK
);
934 * Generate bytecode related to the trigger.
935 * On success LTTNG_OK. On error, returns lttng_error code.
938 enum lttng_error_code
lttng_trigger_generate_bytecode(
939 struct lttng_trigger
*trigger
,
940 const struct lttng_credentials
*creds
)
942 enum lttng_error_code ret
;
943 struct lttng_condition
*condition
= NULL
;
945 condition
= lttng_trigger_get_condition(trigger
);
947 ret
= LTTNG_ERR_INVALID_TRIGGER
;
951 switch (lttng_condition_get_type(condition
)) {
952 case LTTNG_CONDITION_TYPE_ON_EVENT
:
954 struct lttng_event_rule
*event_rule
;
955 const enum lttng_condition_status condition_status
=
956 lttng_condition_on_event_borrow_rule_mutable(
957 condition
, &event_rule
);
959 assert(condition_status
== LTTNG_CONDITION_STATUS_OK
);
961 /* Generate the filter bytecode. */
962 ret
= lttng_event_rule_generate_filter_bytecode(
964 if (ret
!= LTTNG_OK
) {
968 /* Generate the capture bytecode. */
969 ret
= lttng_condition_on_event_generate_capture_descriptor_bytecode(
971 if (ret
!= LTTNG_OK
) {
987 struct lttng_trigger
*lttng_trigger_copy(const struct lttng_trigger
*trigger
)
990 struct lttng_payload copy_buffer
;
991 struct lttng_trigger
*copy
= NULL
;
993 lttng_payload_init(©_buffer
);
995 ret
= lttng_trigger_serialize(trigger
, ©_buffer
);
1001 struct lttng_payload_view view
=
1002 lttng_payload_view_from_payload(
1003 ©_buffer
, 0, -1);
1004 ret
= lttng_trigger_create_from_payload(
1013 lttng_payload_reset(©_buffer
);
1018 bool lttng_trigger_needs_tracer_notifier(const struct lttng_trigger
*trigger
)
1020 bool needs_tracer_notifier
= false;
1021 const struct lttng_condition
*condition
=
1022 lttng_trigger_get_const_condition(trigger
);
1024 switch (lttng_condition_get_type(condition
)) {
1025 case LTTNG_CONDITION_TYPE_ON_EVENT
:
1026 needs_tracer_notifier
= true;
1028 case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE
:
1029 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH
:
1030 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW
:
1031 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING
:
1032 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED
:
1034 case LTTNG_CONDITION_TYPE_UNKNOWN
:
1039 return needs_tracer_notifier
;