| // SPDX-License-Identifier: GPL-2.0 |
| * 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> |
| * If CONFIG_PROFILE_ALL_BRANCHES is selected, |
| * 'if' is redefined after include kernel header. |
| * Recover 'if' for BPF object code. |
| 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) |
| fmode_t f_mode = (fmode_t)_f_mode; |
| if (f_mode & FMODE_WRITE) |
| char _license[] SEC("license") = "GPL"; |
| int _version SEC("version") = LINUX_VERSION_CODE; |