0001
0002
0003 #ifndef _LINUX_FPROBE_H
0004 #define _LINUX_FPROBE_H
0005
0006 #include <linux/compiler.h>
0007 #include <linux/ftrace.h>
0008 #include <linux/rethook.h>
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 struct fprobe {
0020 #ifdef CONFIG_FUNCTION_TRACER
0021
0022
0023
0024
0025
0026
0027 struct ftrace_ops ops;
0028 #endif
0029 unsigned long nmissed;
0030 unsigned int flags;
0031 struct rethook *rethook;
0032
0033 void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs);
0034 void (*exit_handler)(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs);
0035 };
0036
0037
0038 #define FPROBE_FL_DISABLED 1
0039
0040
0041
0042
0043
0044 #define FPROBE_FL_KPROBE_SHARED 2
0045
0046 static inline bool fprobe_disabled(struct fprobe *fp)
0047 {
0048 return (fp) ? fp->flags & FPROBE_FL_DISABLED : false;
0049 }
0050
0051 static inline bool fprobe_shared_with_kprobes(struct fprobe *fp)
0052 {
0053 return (fp) ? fp->flags & FPROBE_FL_KPROBE_SHARED : false;
0054 }
0055
0056 #ifdef CONFIG_FPROBE
0057 int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter);
0058 int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num);
0059 int register_fprobe_syms(struct fprobe *fp, const char **syms, int num);
0060 int unregister_fprobe(struct fprobe *fp);
0061 #else
0062 static inline int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter)
0063 {
0064 return -EOPNOTSUPP;
0065 }
0066 static inline int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num)
0067 {
0068 return -EOPNOTSUPP;
0069 }
0070 static inline int register_fprobe_syms(struct fprobe *fp, const char **syms, int num)
0071 {
0072 return -EOPNOTSUPP;
0073 }
0074 static inline int unregister_fprobe(struct fprobe *fp)
0075 {
0076 return -EOPNOTSUPP;
0077 }
0078 #endif
0079
0080
0081
0082
0083
0084
0085
0086
0087 static inline void disable_fprobe(struct fprobe *fp)
0088 {
0089 if (fp)
0090 fp->flags |= FPROBE_FL_DISABLED;
0091 }
0092
0093
0094
0095
0096
0097
0098
0099 static inline void enable_fprobe(struct fprobe *fp)
0100 {
0101 if (fp)
0102 fp->flags &= ~FPROBE_FL_DISABLED;
0103 }
0104
0105 #endif