* [tip:perf/core] perf bpf: Add unistd.h to the headers accessible to bpf proggies
@ 2018-11-22 7:00 tip-bot for Arnaldo Carvalho de Melo
0 siblings, 0 replies; only message in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2018-11-22 7:00 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, wangnan0, mingo, acme, hpa, dsahern, tglx, jolsa,
adrian.hunter, linux-kernel
Commit-ID: 1475d35c4a6174d4ec633b9af5713e9770b3ac0d
Gitweb: https://git.kernel.org/tip/1475d35c4a6174d4ec633b9af5713e9770b3ac0d
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 6 Nov 2018 15:21:45 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <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>
---
tools/perf/include/bpf/unistd.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/perf/include/bpf/unistd.h b/tools/perf/include/bpf/unistd.h
new file mode 100644
index 000000000000..ca7877f9a976
--- /dev/null
+++ b/tools/perf/include/bpf/unistd.h
@@ -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();
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-11-22 7:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 7:00 [tip:perf/core] perf bpf: Add unistd.h to the headers accessible to bpf proggies tip-bot for Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome