Namespace kernel version macros
[lttng-modules.git] / wrapper / uprobes.h
index e38a541545cb79daebdec2db2e998c585076764a..5a678c5d8d0317cccd366e1abdc39b741d75546c 100644 (file)
@@ -1,7 +1,5 @@
-#ifndef _LTTNG_WRAPPER_UPROBES_H
-#define _LTTNG_WRAPPER_UPROBES_H
-
-/*
+/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
+ *
  * wrapper/uprobes.h
  *
  * wrapper around uprobes. Using KALLSYMS to get its address when
  * Copyright (C) 2013 Yannick Brosseau <yannick.brosseau@gmail.com>
  * Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <linux/version.h>
+#ifndef _LTTNG_WRAPPER_UPROBES_H
+#define _LTTNG_WRAPPER_UPROBES_H
+
+#include <lttng-kernel-version.h>
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,5,0))
 #include <linux/uprobes.h>
 
 /* Use kallsym lookup for version before 3.9. */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
 
 static inline
 int wrapper_uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
@@ -64,6 +52,19 @@ int wrapper_uprobe_register(struct inode *inode, loff_t offset, struct uprobe_co
        }
 }
 
+/*
+ * Canary function to check for 'uprobe_register()' at compile time.
+ *
+ * From 'include/linux/uprobes.h':
+ *
+ *   extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
+ */
+static inline
+int __canary__uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
+{
+       return uprobe_register(inode, offset, uc);
+}
+
 static inline
 void wrapper_uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
 {
@@ -78,6 +79,20 @@ void wrapper_uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe
                 WARN_ON(1);
         }
 }
+
+/*
+ * Canary function to check for 'uprobe_unregister()' at compile time.
+ *
+ * From 'include/linux/uprobes.h':
+ *
+ *   extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
+ */
+static inline
+void __canary__uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
+{
+       uprobe_unregister(inode, offset, uc);
+}
+
 #endif
 #else
 /* Version <  3.5, before uprobe was added. */
This page took 0.03179 seconds and 4 git commands to generate.