2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
9 #include <common/error.h>
10 #include <common/event-expr-to-bytecode.h>
11 #include <common/macros.h>
13 #include <lttng/condition/condition-internal.h>
14 #include <lttng/event-rule/event-rule-internal.h>
15 #include <lttng/condition/event-rule-internal.h>
16 #include <lttng/condition/event-rule.h>
17 #include <lttng/event-expr-internal.h>
18 #include <lttng/event-expr.h>
19 #include <lttng/lttng-error.h>
22 #include <vendor/msgpack/msgpack.h>
24 #define IS_EVENT_RULE_CONDITION(condition) \
25 (lttng_condition_get_type(condition) == \
26 LTTNG_CONDITION_TYPE_EVENT_RULE_HIT)
28 static bool is_event_rule_evaluation(const struct lttng_evaluation
*evaluation
)
30 enum lttng_condition_type type
= lttng_evaluation_get_type(evaluation
);
32 return type
== LTTNG_CONDITION_TYPE_EVENT_RULE_HIT
;
35 static bool lttng_condition_event_rule_validate(
36 const struct lttng_condition
*condition
);
37 static int lttng_condition_event_rule_serialize(
38 const struct lttng_condition
*condition
,
39 struct lttng_payload
*payload
);
40 static bool lttng_condition_event_rule_is_equal(
41 const struct lttng_condition
*_a
,
42 const struct lttng_condition
*_b
);
43 static void lttng_condition_event_rule_destroy(
44 struct lttng_condition
*condition
);
46 static bool lttng_condition_event_rule_validate(
47 const struct lttng_condition
*condition
)
50 struct lttng_condition_event_rule
*event_rule
;
56 event_rule
= container_of(
57 condition
, struct lttng_condition_event_rule
, parent
);
58 if (!event_rule
->rule
) {
59 ERR("Invalid event rule condition: a rule must be set.");
63 valid
= lttng_event_rule_validate(event_rule
->rule
);
69 * Serializes the C string `str` into `buf`.
71 * Encoding is the length of `str` plus one (for the null character),
72 * and then the string, including its null terminator.
75 int serialize_cstr(const char *str
, struct lttng_dynamic_buffer
*buf
)
78 const uint32_t len
= strlen(str
) + 1;
80 /* Serialize the length, including the null terminator. */
81 DBG("Serializing C string's length (including null terminator): "
83 ret
= lttng_dynamic_buffer_append(buf
, &len
, sizeof(len
));
88 /* Serialize the string. */
89 DBG("Serializing C string: '%s'", str
);
90 ret
= lttng_dynamic_buffer_append(buf
, str
, len
);
100 * Serializes the event expression `expr` into `buf`.
103 int serialize_event_expr(const struct lttng_event_expr
*expr
,
104 struct lttng_payload
*payload
)
106 const uint8_t type
= expr
->type
;
109 /* Serialize the expression's type. */
110 DBG("Serializing event expression's type: %d", expr
->type
);
111 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &type
, sizeof(type
));
116 /* Serialize the expression */
117 switch (expr
->type
) {
118 case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD
:
119 case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD
:
121 const struct lttng_event_expr_field
*field_expr
=
123 const struct lttng_event_expr_field
,
126 /* Serialize the field name. */
127 DBG("Serializing field event expression's field name: '%s'",
129 ret
= serialize_cstr(field_expr
->name
, &payload
->buffer
);
136 case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD
:
138 const struct lttng_event_expr_app_specific_context_field
*field_expr
=
140 const struct lttng_event_expr_app_specific_context_field
,
143 /* Serialize the provider name. */
144 DBG("Serializing app-specific context field event expression's "
145 "provider name: '%s'",
146 field_expr
->provider_name
);
147 ret
= serialize_cstr(field_expr
->provider_name
, &payload
->buffer
);
152 /* Serialize the type name. */
153 DBG("Serializing app-specific context field event expression's "
155 field_expr
->provider_name
);
156 ret
= serialize_cstr(field_expr
->type_name
, &payload
->buffer
);
163 case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT
:
165 const struct lttng_event_expr_array_field_element
*elem_expr
=
167 const struct lttng_event_expr_array_field_element
,
169 const uint32_t index
= elem_expr
->index
;
171 /* Serialize the index. */
172 DBG("Serializing array field element event expression's "
173 "index: %u", elem_expr
->index
);
174 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &index
, sizeof(index
));
179 /* Serialize the parent array field expression. */
180 DBG("Serializing array field element event expression's "
181 "parent array field event expression.");
182 ret
= serialize_event_expr(elem_expr
->array_field_expr
, payload
);
198 struct lttng_capture_descriptor
*
199 lttng_condition_event_rule_get_internal_capture_descriptor_at_index(
200 const struct lttng_condition
*condition
, unsigned int index
)
202 const struct lttng_condition_event_rule
*event_rule_cond
=
203 container_of(condition
,
204 const struct lttng_condition_event_rule
,
206 struct lttng_capture_descriptor
*desc
= NULL
;
208 enum lttng_condition_status status
;
210 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
)) {
214 status
= lttng_condition_event_rule_get_capture_descriptor_count(
216 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
220 if (index
>= count
) {
224 desc
= lttng_dynamic_pointer_array_get_pointer(
225 &event_rule_cond
->capture_descriptors
, index
);
230 static int lttng_condition_event_rule_serialize(
231 const struct lttng_condition
*condition
,
232 struct lttng_payload
*payload
)
235 struct lttng_condition_event_rule
*event_rule
;
236 enum lttng_condition_status status
;
237 /* Used for iteration and communication (size matters). */
238 uint32_t i
, capture_descr_count
;
240 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
)) {
245 DBG("Serializing event rule condition");
246 event_rule
= container_of(
247 condition
, struct lttng_condition_event_rule
, parent
);
249 DBG("Serializing event rule condition's event rule");
250 ret
= lttng_event_rule_serialize(event_rule
->rule
, payload
);
255 status
= lttng_condition_event_rule_get_capture_descriptor_count(
256 condition
, &capture_descr_count
);
257 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
262 DBG("Serializing event rule condition's capture descriptor count: %" PRIu32
,
263 capture_descr_count
);
264 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &capture_descr_count
,
265 sizeof(capture_descr_count
));
270 for (i
= 0; i
< capture_descr_count
; i
++) {
271 const struct lttng_capture_descriptor
*desc
=
272 lttng_condition_event_rule_get_internal_capture_descriptor_at_index(
275 DBG("Serializing event rule condition's capture descriptor %" PRIu32
,
277 ret
= serialize_event_expr(desc
->event_expression
, payload
);
288 bool capture_descriptors_are_equal(
289 const struct lttng_condition
*condition_a
,
290 const struct lttng_condition
*condition_b
)
292 bool is_equal
= true;
293 unsigned int capture_descr_count_a
;
294 unsigned int capture_descr_count_b
;
296 enum lttng_condition_status status
;
298 status
= lttng_condition_event_rule_get_capture_descriptor_count(
299 condition_a
, &capture_descr_count_a
);
300 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
304 status
= lttng_condition_event_rule_get_capture_descriptor_count(
305 condition_b
, &capture_descr_count_b
);
306 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
310 if (capture_descr_count_a
!= capture_descr_count_b
) {
314 for (i
= 0; i
< capture_descr_count_a
; i
++) {
315 const struct lttng_event_expr
*expr_a
=
316 lttng_condition_event_rule_get_capture_descriptor_at_index(
319 const struct lttng_event_expr
*expr_b
=
320 lttng_condition_event_rule_get_capture_descriptor_at_index(
324 if (!lttng_event_expr_is_equal(expr_a
, expr_b
)) {
338 static bool lttng_condition_event_rule_is_equal(
339 const struct lttng_condition
*_a
,
340 const struct lttng_condition
*_b
)
342 bool is_equal
= false;
343 struct lttng_condition_event_rule
*a
, *b
;
345 a
= container_of(_a
, struct lttng_condition_event_rule
, parent
);
346 b
= container_of(_b
, struct lttng_condition_event_rule
, parent
);
348 /* Both event rules must be set or both must be unset. */
349 if ((a
->rule
&& !b
->rule
) || (!a
->rule
&& b
->rule
)) {
350 WARN("Comparing event_rule conditions with uninitialized rule");
354 is_equal
= lttng_event_rule_is_equal(a
->rule
, b
->rule
);
359 is_equal
= capture_descriptors_are_equal(_a
, _b
);
365 static void lttng_condition_event_rule_destroy(
366 struct lttng_condition
*condition
)
368 struct lttng_condition_event_rule
*event_rule
;
370 event_rule
= container_of(
371 condition
, struct lttng_condition_event_rule
, parent
);
373 lttng_event_rule_put(event_rule
->rule
);
374 lttng_dynamic_pointer_array_reset(&event_rule
->capture_descriptors
);
379 void destroy_capture_descriptor(void *ptr
)
381 struct lttng_capture_descriptor
*desc
=
382 (struct lttng_capture_descriptor
*) ptr
;
384 lttng_event_expr_destroy(desc
->event_expression
);
385 free(desc
->bytecode
);
389 struct lttng_condition
*lttng_condition_event_rule_create(
390 struct lttng_event_rule
*rule
)
392 struct lttng_condition
*parent
= NULL
;
393 struct lttng_condition_event_rule
*condition
= NULL
;
399 condition
= zmalloc(sizeof(struct lttng_condition_event_rule
));
404 lttng_condition_init(&condition
->parent
,
405 LTTNG_CONDITION_TYPE_EVENT_RULE_HIT
);
406 condition
->parent
.validate
= lttng_condition_event_rule_validate
,
407 condition
->parent
.serialize
= lttng_condition_event_rule_serialize
,
408 condition
->parent
.equal
= lttng_condition_event_rule_is_equal
,
409 condition
->parent
.destroy
= lttng_condition_event_rule_destroy
,
411 lttng_event_rule_get(rule
);
412 condition
->rule
= rule
;
415 lttng_dynamic_pointer_array_init(&condition
->capture_descriptors
,
416 destroy_capture_descriptor
);
418 parent
= &condition
->parent
;
424 uint64_t uint_from_buffer(const struct lttng_buffer_view
*view
, size_t size
,
428 const struct lttng_buffer_view uint_view
=
429 lttng_buffer_view_from_view(view
, *offset
, size
);
431 if (!lttng_buffer_view_is_valid(&uint_view
)) {
438 ret
= (uint64_t) *uint_view
.data
;
440 case sizeof(uint32_t):
444 memcpy(&u32
, uint_view
.data
, sizeof(u32
));
445 ret
= (uint64_t) u32
;
449 memcpy(&ret
, uint_view
.data
, sizeof(ret
));
462 const char *str_from_buffer(const struct lttng_buffer_view
*view
,
468 len
= uint_from_buffer(view
, sizeof(uint32_t), offset
);
469 if (len
== UINT64_C(-1)) {
473 ret
= &view
->data
[*offset
];
475 if (!lttng_buffer_view_contains_string(view
, ret
, len
)) {
490 struct lttng_event_expr
*event_expr_from_payload(
491 struct lttng_payload_view
*view
, size_t *offset
)
493 struct lttng_event_expr
*expr
= NULL
;
497 type
= uint_from_buffer(&view
->buffer
, sizeof(uint8_t), offset
);
498 if (type
== UINT64_C(-1)) {
503 case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD
:
504 str
= str_from_buffer(&view
->buffer
, offset
);
509 expr
= lttng_event_expr_event_payload_field_create(str
);
511 case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD
:
512 str
= str_from_buffer(&view
->buffer
, offset
);
517 expr
= lttng_event_expr_channel_context_field_create(str
);
519 case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD
:
521 const char *provider_name
;
522 const char *type_name
;
524 provider_name
= str_from_buffer(&view
->buffer
, offset
);
525 if (!provider_name
) {
529 type_name
= str_from_buffer(&view
->buffer
, offset
);
534 expr
= lttng_event_expr_app_specific_context_field_create(
535 provider_name
, type_name
);
538 case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT
:
540 struct lttng_event_expr
*array_field_expr
;
541 const uint64_t index
= uint_from_buffer(
542 &view
->buffer
, sizeof(uint32_t), offset
);
544 if (index
== UINT64_C(-1)) {
548 /* Array field expression is the encoded after this. */
549 array_field_expr
= event_expr_from_payload(view
, offset
);
550 if (!array_field_expr
) {
554 /* Move ownership of `array_field_expr` to new expression. */
555 expr
= lttng_event_expr_array_field_element_create(
556 array_field_expr
, (unsigned int) index
);
558 /* `array_field_expr` not moved: destroy it. */
559 lttng_event_expr_destroy(array_field_expr
);
571 lttng_event_expr_destroy(expr
);
579 ssize_t
lttng_condition_event_rule_create_from_payload(
580 struct lttng_payload_view
*view
,
581 struct lttng_condition
**_condition
)
583 ssize_t consumed_length
;
585 ssize_t event_rule_length
;
586 uint32_t i
, capture_descr_count
;
587 struct lttng_condition
*condition
= NULL
;
588 struct lttng_event_rule
*event_rule
= NULL
;
590 if (!view
|| !_condition
) {
594 /* Struct lttng_event_rule. */
596 struct lttng_payload_view event_rule_view
=
597 lttng_payload_view_from_view(view
, offset
, -1);
599 event_rule_length
= lttng_event_rule_create_from_payload(
600 &event_rule_view
, &event_rule
);
603 if (event_rule_length
< 0 || !event_rule
) {
607 /* Create condition (no capture descriptors yet) at this point. */
608 condition
= lttng_condition_event_rule_create(event_rule
);
614 /* Capture descriptor count. */
615 assert(event_rule_length
>= 0);
616 offset
+= (size_t) event_rule_length
;
617 capture_descr_count
= uint_from_buffer(&view
->buffer
, sizeof(uint32_t), &offset
);
618 if (capture_descr_count
== UINT32_C(-1)) {
622 /* Capture descriptors. */
623 for (i
= 0; i
< capture_descr_count
; i
++) {
624 enum lttng_condition_status status
;
625 struct lttng_event_expr
*expr
= event_expr_from_payload(
632 /* Move ownership of `expr` to `condition`. */
633 status
= lttng_condition_event_rule_append_capture_descriptor(
635 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
636 /* `expr` not moved: destroy it. */
637 lttng_event_expr_destroy(expr
);
642 consumed_length
= (ssize_t
) offset
;
643 *_condition
= condition
;
648 consumed_length
= -1;
651 lttng_event_rule_put(event_rule
);
652 lttng_condition_put(condition
);
653 return consumed_length
;
657 enum lttng_condition_status
lttng_condition_event_rule_borrow_rule_mutable(
658 const struct lttng_condition
*condition
,
659 struct lttng_event_rule
**rule
)
661 struct lttng_condition_event_rule
*event_rule
;
662 enum lttng_condition_status status
= LTTNG_CONDITION_STATUS_OK
;
664 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
) || !rule
) {
665 status
= LTTNG_CONDITION_STATUS_INVALID
;
669 event_rule
= container_of(
670 condition
, struct lttng_condition_event_rule
, parent
);
671 if (!event_rule
->rule
) {
672 status
= LTTNG_CONDITION_STATUS_UNSET
;
676 *rule
= event_rule
->rule
;
681 enum lttng_condition_status
lttng_condition_event_rule_get_rule(
682 const struct lttng_condition
*condition
,
683 const struct lttng_event_rule
**rule
)
685 struct lttng_event_rule
*mutable_rule
= NULL
;
686 const enum lttng_condition_status status
=
687 lttng_condition_event_rule_borrow_rule_mutable(
688 condition
, &mutable_rule
);
690 *rule
= mutable_rule
;
694 enum lttng_condition_status
695 lttng_condition_event_rule_append_capture_descriptor(
696 struct lttng_condition
*condition
,
697 struct lttng_event_expr
*expr
)
700 enum lttng_condition_status status
= LTTNG_CONDITION_STATUS_OK
;
701 struct lttng_condition_event_rule
*event_rule_cond
=
702 container_of(condition
,
703 struct lttng_condition_event_rule
, parent
);
704 struct lttng_capture_descriptor
*descriptor
= NULL
;
706 /* Only accept l-values. */
707 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
) || !expr
||
708 !lttng_event_expr_is_lvalue(expr
)) {
709 status
= LTTNG_CONDITION_STATUS_INVALID
;
713 descriptor
= malloc(sizeof(*descriptor
));
714 if (descriptor
== NULL
) {
715 status
= LTTNG_CONDITION_STATUS_ERROR
;
719 descriptor
->event_expression
= expr
;
720 descriptor
->bytecode
= NULL
;
722 ret
= lttng_dynamic_pointer_array_add_pointer(
723 &event_rule_cond
->capture_descriptors
, descriptor
);
725 status
= LTTNG_CONDITION_STATUS_ERROR
;
729 /* Ownership is transfered to the internal capture_descriptors array */
736 enum lttng_condition_status
737 lttng_condition_event_rule_get_capture_descriptor_count(
738 const struct lttng_condition
*condition
, unsigned int *count
)
740 enum lttng_condition_status status
= LTTNG_CONDITION_STATUS_OK
;
741 const struct lttng_condition_event_rule
*event_rule_cond
=
742 container_of(condition
,
743 const struct lttng_condition_event_rule
,
746 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
) || !count
) {
747 status
= LTTNG_CONDITION_STATUS_INVALID
;
751 *count
= lttng_dynamic_pointer_array_get_count(
752 &event_rule_cond
->capture_descriptors
);
758 const struct lttng_event_expr
*
759 lttng_condition_event_rule_get_capture_descriptor_at_index(
760 const struct lttng_condition
*condition
, unsigned int index
)
762 const struct lttng_event_expr
*expr
= NULL
;
763 const struct lttng_capture_descriptor
*desc
= NULL
;
765 desc
= lttng_condition_event_rule_get_internal_capture_descriptor_at_index(
770 expr
= desc
->event_expression
;
777 ssize_t
lttng_evaluation_event_rule_create_from_payload(
778 struct lttng_payload_view
*view
,
779 struct lttng_evaluation
**_evaluation
)
781 ssize_t ret
, offset
= 0;
782 const char *trigger_name
;
783 struct lttng_evaluation
*evaluation
= NULL
;
784 const struct lttng_evaluation_event_rule_comm
*header
;
785 const struct lttng_payload_view header_view
=
786 lttng_payload_view_from_view(
787 view
, 0, sizeof(*header
));
794 if (!lttng_payload_view_is_valid(&header_view
)) {
795 ERR("Failed to initialize from malformed event rule evaluation: buffer too short to contain header");
800 header
= (typeof(header
)) header_view
.buffer
.data
;
802 /* Map the originating trigger's name. */
803 offset
+= sizeof(*header
);
805 struct lttng_payload_view current_view
=
806 lttng_payload_view_from_view(view
, offset
,
807 header
->trigger_name_length
);
809 if (!lttng_payload_view_is_valid(¤t_view
)) {
810 ERR("Failed to initialize from malformed event rule evaluation: buffer too short to contain trigger name");
815 trigger_name
= current_view
.buffer
.data
;
816 if (!lttng_buffer_view_contains_string(¤t_view
.buffer
,
817 trigger_name
, header
->trigger_name_length
)) {
818 ERR("Failed to initialize from malformed event rule evaluation: invalid trigger name");
824 offset
+= header
->trigger_name_length
;
826 evaluation
= lttng_evaluation_event_rule_create(trigger_name
);
832 *_evaluation
= evaluation
;
837 lttng_evaluation_destroy(evaluation
);
841 static int lttng_evaluation_event_rule_serialize(
842 const struct lttng_evaluation
*evaluation
,
843 struct lttng_payload
*payload
)
846 struct lttng_evaluation_event_rule
*hit
;
847 struct lttng_evaluation_event_rule_comm comm
;
850 evaluation
, struct lttng_evaluation_event_rule
, parent
);
853 comm
.trigger_name_length
= strlen(hit
->name
) + 1;
855 ret
= lttng_dynamic_buffer_append(
856 &payload
->buffer
, &comm
, sizeof(comm
));
861 ret
= lttng_dynamic_buffer_append(
862 &payload
->buffer
, hit
->name
, comm
.trigger_name_length
);
867 static void lttng_evaluation_event_rule_destroy(
868 struct lttng_evaluation
*evaluation
)
870 struct lttng_evaluation_event_rule
*hit
;
873 evaluation
, struct lttng_evaluation_event_rule
, parent
);
879 struct lttng_evaluation
*lttng_evaluation_event_rule_create(
880 const char *trigger_name
)
882 struct lttng_evaluation_event_rule
*hit
;
883 struct lttng_evaluation
*evaluation
= NULL
;
885 hit
= zmalloc(sizeof(struct lttng_evaluation_event_rule
));
890 hit
->name
= strdup(trigger_name
);
895 hit
->parent
.type
= LTTNG_CONDITION_TYPE_EVENT_RULE_HIT
;
896 hit
->parent
.serialize
= lttng_evaluation_event_rule_serialize
;
897 hit
->parent
.destroy
= lttng_evaluation_event_rule_destroy
;
899 evaluation
= &hit
->parent
;
904 lttng_evaluation_event_rule_destroy(&hit
->parent
);
910 enum lttng_evaluation_status
lttng_evaluation_event_rule_get_trigger_name(
911 const struct lttng_evaluation
*evaluation
, const char **name
)
913 struct lttng_evaluation_event_rule
*hit
;
914 enum lttng_evaluation_status status
= LTTNG_EVALUATION_STATUS_OK
;
916 if (!evaluation
|| !is_event_rule_evaluation(evaluation
) || !name
) {
917 status
= LTTNG_EVALUATION_STATUS_INVALID
;
922 evaluation
, struct lttng_evaluation_event_rule
, parent
);
929 enum lttng_error_code
930 lttng_condition_event_rule_generate_capture_descriptor_bytecode(
931 struct lttng_condition
*condition
)
933 enum lttng_error_code ret
;
934 enum lttng_condition_status status
;
935 unsigned int capture_count
, i
;
937 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
)) {
938 ret
= LTTNG_ERR_FATAL
;
942 status
= lttng_condition_event_rule_get_capture_descriptor_count(
943 condition
, &capture_count
);
944 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
945 ret
= LTTNG_ERR_FATAL
;
949 for (i
= 0; i
< capture_count
; i
++) {
950 struct lttng_capture_descriptor
*local_capture_desc
=
951 lttng_condition_event_rule_get_internal_capture_descriptor_at_index(
954 if (local_capture_desc
== NULL
) {
955 ret
= LTTNG_ERR_FATAL
;
959 /* Generate the bytecode. */
960 status
= lttng_event_expr_to_bytecode(
961 local_capture_desc
->event_expression
,
962 &local_capture_desc
->bytecode
);
963 if (status
< 0 || local_capture_desc
->bytecode
== NULL
) {
964 ret
= LTTNG_ERR_INVALID_CAPTURE_EXPRESSION
;
969 /* Everything went better than expected */
977 const struct lttng_bytecode
*
978 lttng_condition_event_rule_get_capture_bytecode_at_index(
979 const struct lttng_condition
*condition
, unsigned int index
)
981 const struct lttng_condition_event_rule
*event_rule_cond
=
982 container_of(condition
,
983 const struct lttng_condition_event_rule
,
985 struct lttng_capture_descriptor
*desc
= NULL
;
986 struct lttng_bytecode
*bytecode
= NULL
;
988 enum lttng_condition_status status
;
990 if (!condition
|| !IS_EVENT_RULE_CONDITION(condition
)) {
994 status
= lttng_condition_event_rule_get_capture_descriptor_count(
996 if (status
!= LTTNG_CONDITION_STATUS_OK
) {
1000 if (index
>= count
) {
1004 desc
= lttng_dynamic_pointer_array_get_pointer(
1005 &event_rule_cond
->capture_descriptors
, index
);
1010 bytecode
= desc
->bytecode
;