perf bpf: Add unistd.h to the headers accessible to bpf proggies
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 1475d35c4a6174d4ec633b9af5713e9770b3ac0d Gitweb: https://git.kernel.org/tip/1475d35c4a6174d4ec633b9af5713e9770b3ac0d Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 6 Nov 2018 15:21:45 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 21 Nov 2018 12:00:30 -0300
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 <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/include/bpf/unistd.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/perf/include/bpf/unistd.h new file +10 -0
@@ -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 (); +}