X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Fuprobes.h;h=5a678c5d8d0317cccd366e1abdc39b741d75546c;hb=fd6f8c5b5963cd84454314fce8870e75fb23de64;hp=e38a541545cb79daebdec2db2e998c585076764a;hpb=149b9a9d86d7351ee9a44ce391884cc12e922124;p=lttng-modules.git diff --git a/wrapper/uprobes.h b/wrapper/uprobes.h index e38a5415..5a678c5d 100644 --- a/wrapper/uprobes.h +++ b/wrapper/uprobes.h @@ -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 @@ -11,28 +9,18 @@ * Copyright (C) 2013 Yannick Brosseau * Copyright (C) 2017 Francis Deslauriers * - * 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 +#ifndef _LTTNG_WRAPPER_UPROBES_H +#define _LTTNG_WRAPPER_UPROBES_H + +#include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,5,0)) #include /* 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. */