cregit-Linux how code gets into the kernel

Release 4.10 tools/perf/tests/bpf-script-test-prologue.c

Directory: tools/perf/tests
/*
 * bpf-script-test-prologue.c
 * Test BPF prologue
 */
#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'
#endif

#define SEC(NAME) __attribute__((section(NAME), used))

#include <uapi/linux/fs.h>


#define FMODE_READ		0x1

#define FMODE_WRITE		0x2


static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
	(void *) 6;

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 (err) return 0; if (f_mode & FMODE_WRITE) return 0; if (offset & 1) return 0; if (orig == SEEK_CUR) return 0; return 1; }

Contributors

PersonTokensPropCommitsCommitProp
wang nanwang nan61100.00%1100.00%
Total61100.00%1100.00%

char _license[] SEC("license") = "GPL"; int _version SEC("version") = LINUX_VERSION_CODE;

Overall Contributors

PersonTokensPropCommitsCommitProp
wang nanwang nan138100.00%1100.00%
Total138100.00%1100.00%
Directory: tools/perf/tests
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.