forked from luck/tmp_suning_uos_patched
perf bpf: Add unistd.h to the headers accessible to bpf proggies
Start with a getpid() function wrapping BPF_FUNC_get_current_pid_tgid, idea is to mimic the system headers. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-zo8hv22onidep7tm785dzxfk@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
b1a9d7b019
commit
1475d35c4a
10
tools/perf/include/bpf/unistd.h
Normal file
10
tools/perf/include/bpf/unistd.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1
|
||||
|
||||
#include <bpf.h>
|
||||
|
||||
static int (*bpf_get_current_pid_tgid)(void) = (void *)BPF_FUNC_get_current_pid_tgid;
|
||||
|
||||
static pid_t getpid(void)
|
||||
{
|
||||
return bpf_get_current_pid_tgid();
|
||||
}
|
Loading…
Reference in New Issue
Block a user