| * bpf-script-test-prologue.c |
| #ifndef LINUX_VERSION_CODE |
| # error Need LINUX_VERSION_CODE |
| # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' |
| #define SEC(NAME) __attribute__((section(NAME), used)) |
| #include <uapi/linux/fs.h> |
| static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) = |
| SEC("func=null_lseek file->f_mode offset orig") |
| int bpf_func__null_lseek(void *ctx, int err, unsigned long f_mode, |
| unsigned long offset, unsigned long orig) |
| if (f_mode & FMODE_WRITE) |
| char _license[] SEC("license") = "GPL"; |
| int _version SEC("version") = LINUX_VERSION_CODE; |