-#include "../ltt-events.h"
-#include "../wrapper/ringbuffer/frontend_types.h"
-#include "../wrapper/ftrace.h"
-#include "../wrapper/vmalloc.h"
-#include "../ltt-tracer.h"
+#include <lttng-events.h>
+#include <wrapper/ringbuffer/frontend_types.h>
+#include <wrapper/ftrace.h>
+#include <wrapper/vmalloc.h>
+#include <lttng-tracer.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
+static
+void lttng_ftrace_handler(unsigned long ip, unsigned long parent_ip,
+ struct trace_array *tr, struct ftrace_probe_ops *ops,
+ void *data)
+{
+ struct lttng_event *event = data;
+ struct lttng_probe_ctx lttng_probe_ctx = {
+ .event = event,
+ .interruptible = !irqs_disabled(),
+ };
+ struct lttng_channel *chan = event->chan;
+ struct lib_ring_buffer_ctx ctx;
+ struct {
+ unsigned long ip;
+ unsigned long parent_ip;
+ } payload;
+ int ret;
+
+ if (unlikely(!READ_ONCE(chan->session->active)))
+ return;
+ if (unlikely(!READ_ONCE(chan->enabled)))
+ return;
+ if (unlikely(!READ_ONCE(event->enabled)))
+ return;