+int kernel_tracer_fd = -1;
+nonstd::optional<enum lttng_kernel_tracer_status> kernel_tracer_status = nonstd::nullopt;
+int kernel_tracer_event_notifier_group_fd = -1;
+int kernel_tracer_event_notifier_group_notification_fd = -1;
+struct cds_lfht *kernel_token_to_event_notifier_rule_ht;
+
+const char *kernel_tracer_status_to_str(lttng_kernel_tracer_status status)
+{
+ switch (status) {
+ case LTTNG_KERNEL_TRACER_STATUS_INITIALIZED:
+ return "LTTNG_KERNEL_TRACER_STATUS_INITIALIZED";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_UNKNOWN:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_UNKNOWN";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_NEED_ROOT:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_NEED_ROOT";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_NOTIFIER:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_NOTIFIER";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_OPEN_PROC_LTTNG:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_OPEN_PROC_LTTNG";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_VERSION_MISMATCH:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_VERSION_MISMATCH";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_UNKNOWN:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_UNKNOWN";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_MISSING:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_MISSING";
+ case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_SIGNATURE:
+ return "LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_SIGNATURE";
+ }
+
+ abort();
+}
+
+/*
+ * On some architectures, calling convention details are embedded in the symbol
+ * addresses. Uprobe requires a "clean" symbol offset (or at least, an address
+ * where an instruction boundary would be legal) to add
+ * instrumentation. sanitize_uprobe_offset implements that sanitization logic on
+ * a per-architecture basis.
+ */
+#if defined(__arm__) || defined(__aarch64__)
+static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset)
+{
+ /*
+ * The least significant bit is used when branching to switch to thumb
+ * ISA. However, it's an invalid address for us; mask the least
+ * significant bit.
+ */
+ return raw_offset &= ~0b1;
+}
+#else /* defined(__arm__) || defined(__aarch64__) */
+static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset)
+{
+ return raw_offset;
+}
+#endif
+} /* namespace */