#include <lttng/userspace-probe.h>
#include <lttng/userspace-probe-internal.h>
-#include <lttng/condition/event-rule.h>
-#include <lttng/condition/event-rule-internal.h>
+#include <lttng/condition/on-event.h>
+#include <lttng/condition/on-event-internal.h>
#include <lttng/event-rule/event-rule.h>
#include <lttng/event-rule/event-rule-internal.h>
#include <lttng/event-rule/userspace-probe-internal.h>
+#include "event-notifier-error-accounting.h"
#include "lttng-sessiond.h"
#include "lttng-syscall.h"
#include "condition-internal.h"
#include "kernel.h"
#include "kernel-consumer.h"
#include "kern-modules.h"
+#include "sessiond-config.h"
#include "utils.h"
#include "rotate.h"
#include "modprobe.h"
WARN("Failed to create kernel event notifier group");
kernel_tracer_event_notifier_group_fd = -1;
} else {
- const enum lttng_error_code error_code_ret =
+ enum event_notifier_error_accounting_status error_accounting_status;
+ enum lttng_error_code error_code_ret =
kernel_create_event_notifier_group_notification_fd(
&kernel_tracer_event_notifier_group_notification_fd);
goto error_modules;
}
+ error_accounting_status = event_notifier_error_accounting_register_kernel(
+ kernel_tracer_event_notifier_group_fd);
+ if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
+ ERR("Failed to initialize event notifier error accounting for kernel tracer");
+ error_code_ret = LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING;
+ goto error_modules;
+ }
+
kernel_token_to_event_notifier_rule_ht = cds_lfht_new(
DEFAULT_HT_SIZE, 1, 0,
CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
assert(condition);
condition_type = lttng_condition_get_type(condition);
- assert(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT);
+ assert(condition_type == LTTNG_CONDITION_TYPE_ON_EVENT);
/* Does not acquire a reference. */
- condition_status = lttng_condition_event_rule_get_rule(
+ condition_status = lttng_condition_on_event_get_rule(
condition, &event_rule);
assert(condition_status == LTTNG_CONDITION_STATUS_OK);
assert(event_rule);
assert(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
error_code_ret = trace_kernel_create_event_notifier_rule(trigger, token,
+ lttng_condition_on_event_get_error_counter_index(condition),
&event_notifier_rule);
if (error_code_ret != LTTNG_OK) {
goto error;
}
kernel_event_notifier.event.token = event_notifier_rule->token;
+ kernel_event_notifier.error_counter_idx =
+ lttng_condition_on_event_get_error_counter_index(condition);
fd = kernctl_create_event_notifier(
kernel_tracer_event_notifier_group_fd,
}
}
- /* Set the capture bytecode, if any. */
- cond_status = lttng_condition_event_rule_get_capture_descriptor_count(
+ /* Set the capture bytecode if any. */
+ cond_status = lttng_condition_on_event_get_capture_descriptor_count(
condition, &capture_bytecode_count);
assert(cond_status == LTTNG_CONDITION_STATUS_OK);
for (i = 0; i < capture_bytecode_count; i++) {
const struct lttng_bytecode *capture_bytecode =
- lttng_condition_event_rule_get_capture_bytecode_at_index(
+ lttng_condition_on_event_get_capture_bytecode_at_index(
condition, i);
if (capture_bytecode == NULL) {
ERR("Unexpected NULL capture bytecode on condition");
error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
- goto error;
+ goto capture_error;
}
ret = kernctl_capture(event_notifier_rule->fd, capture_bytecode);
ERR("Failed to set capture bytecode on event notifier rule fd: fd = %d",
event_notifier_rule->fd);
error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
- goto error;
+ goto capture_error;
}
}
return LTTNG_OK;
+capture_error:
add_callsite_error:
enable_error:
set_cloexec_error:
assert(condition);
/* Does not acquire a reference to the event rule. */
- status = lttng_condition_event_rule_get_rule(
+ status = lttng_condition_on_event_get_rule(
condition, &event_rule);
assert(status == LTTNG_CONDITION_STATUS_OK);