#include <assert.h>
#include <common/error.h>
-#include <common/event-expr-to-bytecode.h>
#include <common/macros.h>
+#include <common/mi-lttng.h>
#include <inttypes.h>
#include <limits.h>
#include <lttng/condition/condition-internal.h>
#include <stdint.h>
#include <vendor/msgpack/msgpack.h>
-#define IS_ON_EVENT_CONDITION(condition) \
- (lttng_condition_get_type(condition) == \
- LTTNG_CONDITION_TYPE_ON_EVENT)
+#define IS_EVENT_RULE_MATCHES_CONDITION(condition) \
+ (lttng_condition_get_type(condition) == \
+ LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES)
-static bool is_on_event_evaluation(const struct lttng_evaluation *evaluation)
+static bool is_event_rule_matches_evaluation(
+ const struct lttng_evaluation *evaluation)
{
enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
- return type == LTTNG_CONDITION_TYPE_ON_EVENT;
+ return type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES;
}
-static bool lttng_condition_on_event_validate(
+static bool lttng_condition_event_rule_matches_validate(
const struct lttng_condition *condition);
-static int lttng_condition_on_event_serialize(
+static int lttng_condition_event_rule_matches_serialize(
const struct lttng_condition *condition,
struct lttng_payload *payload);
-static bool lttng_condition_on_event_is_equal(
+static bool lttng_condition_event_rule_matches_is_equal(
const struct lttng_condition *_a,
const struct lttng_condition *_b);
-static void lttng_condition_on_event_destroy(
+static void lttng_condition_event_rule_matches_destroy(
struct lttng_condition *condition);
-static bool lttng_condition_on_event_validate(
+static bool lttng_condition_event_rule_matches_validate(
const struct lttng_condition *condition)
{
bool valid = false;
- struct lttng_condition_on_event *event_rule;
+ struct lttng_condition_event_rule_matches *event_rule;
if (!condition) {
goto end;
}
- event_rule = container_of(
- condition, struct lttng_condition_on_event, parent);
+ event_rule = container_of(condition,
+ struct lttng_condition_event_rule_matches, parent);
if (!event_rule->rule) {
ERR("Invalid on event condition: a rule must be set");
goto end;
return ret;
}
-static
-struct lttng_capture_descriptor *
-lttng_condition_on_event_get_internal_capture_descriptor_at_index(
+static struct lttng_capture_descriptor *
+lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
const struct lttng_condition *condition, unsigned int index)
{
- const struct lttng_condition_on_event *on_event_cond =
- container_of(condition,
- const struct lttng_condition_on_event,
- parent);
+ const struct lttng_condition_event_rule_matches
+ *event_rule_matches_cond = container_of(condition,
+ const struct lttng_condition_event_rule_matches,
+ parent);
struct lttng_capture_descriptor *desc = NULL;
unsigned int count;
enum lttng_condition_status status;
- if (!condition || !IS_ON_EVENT_CONDITION(condition)) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition)) {
goto end;
}
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &count);
if (status != LTTNG_CONDITION_STATUS_OK) {
goto end;
}
desc = lttng_dynamic_pointer_array_get_pointer(
- &on_event_cond->capture_descriptors, index);
+ &event_rule_matches_cond->capture_descriptors, index);
end:
return desc;
}
-static int lttng_condition_on_event_serialize(
+static int lttng_condition_event_rule_matches_serialize(
const struct lttng_condition *condition,
struct lttng_payload *payload)
{
int ret;
- struct lttng_condition_on_event *on_event_condition;
+ struct lttng_condition_event_rule_matches *event_rule_matches_condition;
enum lttng_condition_status status;
/* Used for iteration and communication (size matters). */
uint32_t i, capture_descr_count;
- if (!condition || !IS_ON_EVENT_CONDITION(condition)) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition)) {
ret = -1;
goto end;
}
DBG("Serializing on event condition");
- on_event_condition = container_of(
- condition, struct lttng_condition_on_event, parent);
+ event_rule_matches_condition = container_of(condition,
+ struct lttng_condition_event_rule_matches, parent);
DBG("Serializing on event condition's event rule");
- ret = lttng_event_rule_serialize(on_event_condition->rule, payload);
+ ret = lttng_event_rule_serialize(
+ event_rule_matches_condition->rule, payload);
if (ret) {
goto end;
}
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &capture_descr_count);
if (status != LTTNG_CONDITION_STATUS_OK) {
ret = -1;
for (i = 0; i < capture_descr_count; i++) {
const struct lttng_capture_descriptor *desc =
- lttng_condition_on_event_get_internal_capture_descriptor_at_index(
+ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
condition, i);
DBG("Serializing on event condition's capture descriptor %" PRIu32,
size_t i;
enum lttng_condition_status status;
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition_a, &capture_descr_count_a);
if (status != LTTNG_CONDITION_STATUS_OK) {
goto not_equal;
}
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition_b, &capture_descr_count_b);
if (status != LTTNG_CONDITION_STATUS_OK) {
goto not_equal;
for (i = 0; i < capture_descr_count_a; i++) {
const struct lttng_event_expr *expr_a =
- lttng_condition_on_event_get_capture_descriptor_at_index(
- condition_a,
- i);
+ lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+ condition_a, i);
const struct lttng_event_expr *expr_b =
- lttng_condition_on_event_get_capture_descriptor_at_index(
- condition_b,
- i);
+ lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+ condition_b, i);
if (!lttng_event_expr_is_equal(expr_a, expr_b)) {
goto not_equal;
return is_equal;
}
-static bool lttng_condition_on_event_is_equal(
+static bool lttng_condition_event_rule_matches_is_equal(
const struct lttng_condition *_a,
const struct lttng_condition *_b)
{
bool is_equal = false;
- struct lttng_condition_on_event *a, *b;
+ struct lttng_condition_event_rule_matches *a, *b;
- a = container_of(_a, struct lttng_condition_on_event, parent);
- b = container_of(_b, struct lttng_condition_on_event, parent);
+ a = container_of(_a, struct lttng_condition_event_rule_matches, parent);
+ b = container_of(_b, struct lttng_condition_event_rule_matches, parent);
/* Both event rules must be set or both must be unset. */
if ((a->rule && !b->rule) || (!a->rule && b->rule)) {
return is_equal;
}
-static void lttng_condition_on_event_destroy(
+static void lttng_condition_event_rule_matches_destroy(
struct lttng_condition *condition)
{
- struct lttng_condition_on_event *on_event_condition;
+ struct lttng_condition_event_rule_matches *event_rule_matches_condition;
- on_event_condition = container_of(
- condition, struct lttng_condition_on_event, parent);
+ event_rule_matches_condition = container_of(condition,
+ struct lttng_condition_event_rule_matches, parent);
- lttng_event_rule_put(on_event_condition->rule);
- lttng_dynamic_pointer_array_reset(&on_event_condition->capture_descriptors);
- free(on_event_condition);
+ lttng_event_rule_put(event_rule_matches_condition->rule);
+ lttng_dynamic_pointer_array_reset(
+ &event_rule_matches_condition->capture_descriptors);
+ free(event_rule_matches_condition);
}
static
free(desc);
}
-struct lttng_condition *lttng_condition_on_event_create(
+static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
+ const struct lttng_condition *condition,
+ struct mi_writer *writer)
+{
+ int ret;
+ enum lttng_error_code ret_code;
+ enum lttng_condition_status status;
+ const struct lttng_event_rule *rule = NULL;
+ unsigned int capture_descriptor_count, i;
+
+ assert(condition);
+ assert(writer);
+ assert(IS_EVENT_RULE_MATCHES_CONDITION(condition));
+
+ status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
+ assert(status == LTTNG_CONDITION_STATUS_OK);
+ assert(rule != NULL);
+
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
+ condition, &capture_descriptor_count);
+ assert(status == LTTNG_CONDITION_STATUS_OK);
+
+ /* Open condition event rule matches element. */
+ ret = mi_lttng_writer_open_element(
+ writer, mi_lttng_element_condition_event_rule_matches);
+ if (ret) {
+ goto mi_error;
+ }
+
+ /* Serialize the event rule. */
+ ret_code = lttng_event_rule_mi_serialize(rule, writer);
+ if (ret_code != LTTNG_OK) {
+ goto end;
+ }
+
+ /* Open the capture descriptors element. */
+ ret = mi_lttng_writer_open_element(
+ writer, mi_lttng_element_capture_descriptors);
+ if (ret) {
+ goto mi_error;
+ }
+
+ for (i = 0; i < capture_descriptor_count; i++) {
+ const struct lttng_event_expr *descriptor = NULL;
+
+ descriptor = lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+ condition, i);
+ assert(descriptor);
+
+ ret_code = lttng_event_expr_mi_serialize(descriptor, writer);
+ if (ret_code != LTTNG_OK) {
+ goto end;
+ }
+ }
+
+ /* Close capture descriptors element. */
+ ret = mi_lttng_writer_close_element(writer);
+ if (ret) {
+ goto mi_error;
+ }
+
+ /* Close condition_event_rule_matches. */
+ ret = mi_lttng_writer_close_element(writer);
+ if (ret) {
+ goto mi_error;
+ }
+ ret_code = LTTNG_OK;
+ goto end;
+
+mi_error:
+ ret_code = LTTNG_ERR_MI_IO_FAIL;
+end:
+ return ret_code;
+}
+
+struct lttng_condition *lttng_condition_event_rule_matches_create(
struct lttng_event_rule *rule)
{
struct lttng_condition *parent = NULL;
- struct lttng_condition_on_event *condition = NULL;
+ struct lttng_condition_event_rule_matches *condition = NULL;
if (!rule) {
goto end;
}
- condition = zmalloc(sizeof(struct lttng_condition_on_event));
+ condition = zmalloc(sizeof(struct lttng_condition_event_rule_matches));
if (!condition) {
return NULL;
}
lttng_condition_init(&condition->parent,
- LTTNG_CONDITION_TYPE_ON_EVENT);
- condition->parent.validate = lttng_condition_on_event_validate,
- condition->parent.serialize = lttng_condition_on_event_serialize,
- condition->parent.equal = lttng_condition_on_event_is_equal,
- condition->parent.destroy = lttng_condition_on_event_destroy,
+ LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+ condition->parent.validate =
+ lttng_condition_event_rule_matches_validate,
+ condition->parent.serialize =
+ lttng_condition_event_rule_matches_serialize,
+ condition->parent.equal = lttng_condition_event_rule_matches_is_equal,
+ condition->parent.destroy = lttng_condition_event_rule_matches_destroy,
+ condition->parent.mi_serialize = lttng_condition_event_rule_matches_mi_serialize,
lttng_event_rule_get(rule);
condition->rule = rule;
}
LTTNG_HIDDEN
-ssize_t lttng_condition_on_event_create_from_payload(
+ssize_t lttng_condition_event_rule_matches_create_from_payload(
struct lttng_payload_view *view,
struct lttng_condition **_condition)
{
offset += event_rule_length;
/* Create condition (no capture descriptors yet) at this point */
- condition = lttng_condition_on_event_create(event_rule);
+ condition = lttng_condition_event_rule_matches_create(event_rule);
if (!condition) {
goto error;
}
}
/* Move ownership of `expr` to `condition`. */
- status = lttng_condition_on_event_append_capture_descriptor(
+ status = lttng_condition_event_rule_matches_append_capture_descriptor(
condition, expr);
if (status != LTTNG_CONDITION_STATUS_OK) {
/* `expr` not moved: destroy it. */
}
LTTNG_HIDDEN
-enum lttng_condition_status lttng_condition_on_event_borrow_rule_mutable(
+enum lttng_condition_status
+lttng_condition_event_rule_matches_borrow_rule_mutable(
const struct lttng_condition *condition,
struct lttng_event_rule **rule)
{
- struct lttng_condition_on_event *event_rule;
+ struct lttng_condition_event_rule_matches *event_rule;
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
- if (!condition || !IS_ON_EVENT_CONDITION(condition) || !rule) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
+ !rule) {
status = LTTNG_CONDITION_STATUS_INVALID;
goto end;
}
- event_rule = container_of(
- condition, struct lttng_condition_on_event, parent);
+ event_rule = container_of(condition,
+ struct lttng_condition_event_rule_matches, parent);
if (!event_rule->rule) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
return status;
}
-enum lttng_condition_status lttng_condition_on_event_get_rule(
+enum lttng_condition_status lttng_condition_event_rule_matches_get_rule(
const struct lttng_condition *condition,
const struct lttng_event_rule **rule)
{
struct lttng_event_rule *mutable_rule = NULL;
const enum lttng_condition_status status =
- lttng_condition_on_event_borrow_rule_mutable(
- condition, &mutable_rule);
+ lttng_condition_event_rule_matches_borrow_rule_mutable(
+ condition, &mutable_rule);
*rule = mutable_rule;
return status;
}
LTTNG_HIDDEN
-void lttng_condition_on_event_set_error_counter_index(
+void lttng_condition_event_rule_matches_set_error_counter_index(
struct lttng_condition *condition, uint64_t error_counter_index)
{
- struct lttng_condition_on_event *on_event_cond =
+ struct lttng_condition_event_rule_matches *event_rule_matches_cond =
container_of(condition,
- struct lttng_condition_on_event, parent);
+ struct lttng_condition_event_rule_matches,
+ parent);
- LTTNG_OPTIONAL_SET(&on_event_cond->error_counter_index, error_counter_index);
+ LTTNG_OPTIONAL_SET(&event_rule_matches_cond->error_counter_index,
+ error_counter_index);
}
LTTNG_HIDDEN
-uint64_t lttng_condition_on_event_get_error_counter_index(
+uint64_t lttng_condition_event_rule_matches_get_error_counter_index(
const struct lttng_condition *condition)
{
- const struct lttng_condition_on_event *on_event_cond =
- container_of(condition,
- const struct lttng_condition_on_event, parent);
+ const struct lttng_condition_event_rule_matches
+ *event_rule_matches_cond = container_of(condition,
+ const struct lttng_condition_event_rule_matches,
+ parent);
- return LTTNG_OPTIONAL_GET(on_event_cond->error_counter_index);
+ return LTTNG_OPTIONAL_GET(event_rule_matches_cond->error_counter_index);
}
enum lttng_condition_status
-lttng_condition_on_event_append_capture_descriptor(
+lttng_condition_event_rule_matches_append_capture_descriptor(
struct lttng_condition *condition,
struct lttng_event_expr *expr)
{
int ret;
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
- struct lttng_condition_on_event *on_event_cond =
+ struct lttng_condition_event_rule_matches *event_rule_matches_cond =
container_of(condition,
- struct lttng_condition_on_event, parent);
+ struct lttng_condition_event_rule_matches,
+ parent);
struct lttng_capture_descriptor *descriptor = NULL;
const struct lttng_event_rule *rule = NULL;
/* Only accept l-values. */
- if (!condition || !IS_ON_EVENT_CONDITION(condition) || !expr ||
- !lttng_event_expr_is_lvalue(expr)) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
+ !expr || !lttng_event_expr_is_lvalue(expr)) {
status = LTTNG_CONDITION_STATUS_INVALID;
goto end;
}
- status = lttng_condition_on_event_get_rule(condition, &rule);
+ status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
if (status != LTTNG_CONDITION_STATUS_OK) {
goto end;
}
switch(lttng_event_rule_get_type(rule)) {
- case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
- case LTTNG_EVENT_RULE_TYPE_SYSCALL:
+ case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+ case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+ case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+ case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+ case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+ case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
/* Supported. */
status = LTTNG_CONDITION_STATUS_OK;
break;
descriptor->bytecode = NULL;
ret = lttng_dynamic_pointer_array_add_pointer(
- &on_event_cond->capture_descriptors, descriptor);
+ &event_rule_matches_cond->capture_descriptors,
+ descriptor);
if (ret) {
status = LTTNG_CONDITION_STATUS_ERROR;
goto end;
}
enum lttng_condition_status
-lttng_condition_on_event_get_capture_descriptor_count(
+lttng_condition_event_rule_matches_get_capture_descriptor_count(
const struct lttng_condition *condition, unsigned int *count)
{
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
- const struct lttng_condition_on_event *on_event_condition =
- container_of(condition,
- const struct lttng_condition_on_event,
- parent);
+ const struct lttng_condition_event_rule_matches
+ *event_rule_matches_condition = container_of(condition,
+ const struct lttng_condition_event_rule_matches,
+ parent);
- if (!condition || !IS_ON_EVENT_CONDITION(condition) || !count) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
+ !count) {
status = LTTNG_CONDITION_STATUS_INVALID;
goto end;
}
*count = lttng_dynamic_pointer_array_get_count(
- &on_event_condition->capture_descriptors);
+ &event_rule_matches_condition->capture_descriptors);
end:
return status;
}
const struct lttng_event_expr *
-lttng_condition_on_event_get_capture_descriptor_at_index(
+lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
const struct lttng_condition *condition, unsigned int index)
{
const struct lttng_event_expr *expr = NULL;
const struct lttng_capture_descriptor *desc = NULL;
- desc = lttng_condition_on_event_get_internal_capture_descriptor_at_index(
+ desc = lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
condition, index);
if (desc == NULL) {
goto end;
}
LTTNG_HIDDEN
-ssize_t lttng_evaluation_on_event_create_from_payload(
- const struct lttng_condition_on_event *condition,
+ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
+ const struct lttng_condition_event_rule_matches *condition,
struct lttng_payload_view *view,
struct lttng_evaluation **_evaluation)
{
capture_payload = current_view.buffer.data;
}
- evaluation = lttng_evaluation_on_event_create(condition,
- capture_payload, capture_payload_size, true);
+ evaluation = lttng_evaluation_event_rule_matches_create(
+ condition, capture_payload, capture_payload_size, true);
if (!evaluation) {
ret = -1;
goto error;
return ret;
}
-static int lttng_evaluation_on_event_serialize(
+static int lttng_evaluation_event_rule_matches_serialize(
const struct lttng_evaluation *evaluation,
struct lttng_payload *payload)
{
int ret = 0;
- struct lttng_evaluation_on_event *hit;
+ struct lttng_evaluation_event_rule_matches *hit;
uint32_t capture_payload_size;
- hit = container_of(
- evaluation, struct lttng_evaluation_on_event, parent);
+ hit = container_of(evaluation,
+ struct lttng_evaluation_event_rule_matches, parent);
capture_payload_size = (uint32_t) hit->capture_payload.size;
ret = lttng_dynamic_buffer_append(&payload->buffer, &capture_payload_size,
return ret;
}
-static void lttng_evaluation_on_event_destroy(
+static void lttng_evaluation_event_rule_matches_destroy(
struct lttng_evaluation *evaluation)
{
- struct lttng_evaluation_on_event *hit;
+ struct lttng_evaluation_event_rule_matches *hit;
- hit = container_of(
- evaluation, struct lttng_evaluation_on_event, parent);
+ hit = container_of(evaluation,
+ struct lttng_evaluation_event_rule_matches, parent);
lttng_dynamic_buffer_reset(&hit->capture_payload);
lttng_event_field_value_destroy(hit->captured_values);
free(hit);
return ret;
}
-static
-struct lttng_event_field_value *event_field_value_from_capture_payload(
- const struct lttng_condition_on_event *condition,
- const char *capture_payload, size_t capture_payload_size)
+static struct lttng_event_field_value *event_field_value_from_capture_payload(
+ const struct lttng_condition_event_rule_matches *condition,
+ const char *capture_payload,
+ size_t capture_payload_size)
{
struct lttng_event_field_value *ret = NULL;
msgpack_unpacked unpacked;
for (i = 0; i < count; i++) {
const struct lttng_capture_descriptor *capture_descriptor =
- lttng_condition_on_event_get_internal_capture_descriptor_at_index(
+ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
&condition->parent, i);
const msgpack_object *elem_obj;
struct lttng_event_field_value *elem_field_val;
}
LTTNG_HIDDEN
-struct lttng_evaluation *lttng_evaluation_on_event_create(
- const struct lttng_condition_on_event *condition,
- const char *capture_payload, size_t capture_payload_size,
+struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
+ const struct lttng_condition_event_rule_matches *condition,
+ const char *capture_payload,
+ size_t capture_payload_size,
bool decode_capture_payload)
{
- struct lttng_evaluation_on_event *hit;
+ struct lttng_evaluation_event_rule_matches *hit;
struct lttng_evaluation *evaluation = NULL;
- hit = zmalloc(sizeof(struct lttng_evaluation_on_event));
+ hit = zmalloc(sizeof(struct lttng_evaluation_event_rule_matches));
if (!hit) {
goto error;
}
}
}
- hit->parent.type = LTTNG_CONDITION_TYPE_ON_EVENT;
- hit->parent.serialize = lttng_evaluation_on_event_serialize;
- hit->parent.destroy = lttng_evaluation_on_event_destroy;
+ hit->parent.type = LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES;
+ hit->parent.serialize = lttng_evaluation_event_rule_matches_serialize;
+ hit->parent.destroy = lttng_evaluation_event_rule_matches_destroy;
evaluation = &hit->parent;
hit = NULL;
error:
if (hit) {
- lttng_evaluation_on_event_destroy(&hit->parent);
+ lttng_evaluation_event_rule_matches_destroy(&hit->parent);
}
return evaluation;
}
-enum lttng_evaluation_on_event_status
-lttng_evaluation_on_event_get_captured_values(
+enum lttng_evaluation_event_rule_matches_status
+lttng_evaluation_event_rule_matches_get_captured_values(
const struct lttng_evaluation *evaluation,
const struct lttng_event_field_value **field_val)
{
- struct lttng_evaluation_on_event *hit;
- enum lttng_evaluation_on_event_status status =
- LTTNG_EVALUATION_ON_EVENT_STATUS_OK;
+ struct lttng_evaluation_event_rule_matches *hit;
+ enum lttng_evaluation_event_rule_matches_status status =
+ LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK;
- if (!evaluation || !is_on_event_evaluation(evaluation) ||
+ if (!evaluation || !is_event_rule_matches_evaluation(evaluation) ||
!field_val) {
- status = LTTNG_EVALUATION_ON_EVENT_STATUS_INVALID;
+ status = LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_INVALID;
goto end;
}
- hit = container_of(evaluation, struct lttng_evaluation_on_event,
- parent);
+ hit = container_of(evaluation,
+ struct lttng_evaluation_event_rule_matches, parent);
if (!hit->captured_values) {
- status = LTTNG_EVALUATION_ON_EVENT_STATUS_NONE;
+ status = LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_NONE;
goto end;
}
LTTNG_HIDDEN
enum lttng_error_code
-lttng_condition_on_event_generate_capture_descriptor_bytecode(
+lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
struct lttng_condition *condition)
{
enum lttng_error_code ret;
enum lttng_condition_status status;
unsigned int capture_count, i;
- if (!condition || !IS_ON_EVENT_CONDITION(condition)) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition)) {
ret = LTTNG_ERR_FATAL;
goto end;
}
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &capture_count);
if (status != LTTNG_CONDITION_STATUS_OK) {
ret = LTTNG_ERR_FATAL;
for (i = 0; i < capture_count; i++) {
struct lttng_capture_descriptor *local_capture_desc =
- lttng_condition_on_event_get_internal_capture_descriptor_at_index(
+ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
condition, i);
if (local_capture_desc == NULL) {
LTTNG_HIDDEN
const struct lttng_bytecode *
-lttng_condition_on_event_get_capture_bytecode_at_index(
+lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
const struct lttng_condition *condition, unsigned int index)
{
- const struct lttng_condition_on_event *on_event_cond =
- container_of(condition,
- const struct lttng_condition_on_event,
- parent);
+ const struct lttng_condition_event_rule_matches
+ *event_rule_matches_cond = container_of(condition,
+ const struct lttng_condition_event_rule_matches,
+ parent);
struct lttng_capture_descriptor *desc = NULL;
struct lttng_bytecode *bytecode = NULL;
unsigned int count;
enum lttng_condition_status status;
- if (!condition || !IS_ON_EVENT_CONDITION(condition)) {
+ if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition)) {
goto end;
}
- status = lttng_condition_on_event_get_capture_descriptor_count(
+ status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &count);
if (status != LTTNG_CONDITION_STATUS_OK) {
goto end;
}
desc = lttng_dynamic_pointer_array_get_pointer(
- &on_event_cond->capture_descriptors, index);
+ &event_rule_matches_cond->capture_descriptors, index);
if (desc == NULL) {
goto end;
}