| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * bpf-script-test-kbuild.c | 
|  | 3 | * Test include from kernel header | 
|  | 4 | */ | 
|  | 5 | #ifndef LINUX_VERSION_CODE | 
|  | 6 | # error Need LINUX_VERSION_CODE | 
|  | 7 | # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' | 
|  | 8 | #endif | 
|  | 9 | #define SEC(NAME) __attribute__((section(NAME), used)) | 
|  | 10 |  | 
|  | 11 | #include <uapi/linux/fs.h> | 
|  | 12 |  | 
|  | 13 | SEC("func=vfs_llseek") | 
|  | 14 | int bpf_func__vfs_llseek(void *ctx) | 
|  | 15 | { | 
|  | 16 | return 0; | 
|  | 17 | } | 
|  | 18 |  | 
|  | 19 | char _license[] SEC("license") = "GPL"; | 
|  | 20 | int _version SEC("version") = LINUX_VERSION_CODE; |