aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-11-14 12:01:18 +0800
committerWang Nan <wangnan0@huawei.com>2016-11-14 12:41:20 +0800
commita804e856f163c83a7188b14941d6a93de09893d7 (patch)
tree90f3f5592d28fc8f7ec980048b499aa9e2c4f7e6
parent532368a84e2426e887dac7ffb9d56d3aefdc348f (diff)
downloadlinux-perf/clang.tar.gz
perf clang git: Export getpid() to perf hookperf/clang
After this patch perf hooks can retrive pid of perf itself by calling getpid. It is important for excluding event from perf. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com
-rw-r--r--tools/perf/util/c++/bpf-helper-str.c1
-rw-r--r--tools/perf/util/c++/clang.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/c++/bpf-helper-str.c b/tools/perf/util/c++/bpf-helper-str.c
index 69aca3cc12a0af..eedee892f43ba1 100644
--- a/tools/perf/util/c++/bpf-helper-str.c
+++ b/tools/perf/util/c++/bpf-helper-str.c
@@ -13,6 +13,7 @@ const char clang_builtin_bpf_helper_str[] =
"extern void test__clang_callback(int);\n"
"extern int printf(const char *, ...);\n"
"extern int puts(const char *);\n"
+"extern int getpid(void);\n"
"extern int jit_helper__map_update_elem(void *, void *, void *, void *, unsigned long);\n"
"extern int jit_helper__map_lookup_elem(void *, void *, void *, void *);\n"
"extern int jit_helper__map_get_next_key(void *, void *, void *, void *);\n"
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index db31fb2c5b3d22..d6af336c1cff1a 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -236,6 +236,7 @@ static std::map<const std::string, const void *> exported_funcs =
EXPORT(test__clang_callback),
EXPORT(printf),
EXPORT(puts),
+ EXPORT(getpid),
EXPORT(JIT_HELPER_FUNC_NAME(map_update_elem)),
EXPORT(JIT_HELPER_FUNC_NAME(map_lookup_elem)),
EXPORT(JIT_HELPER_FUNC_NAME(map_get_next_key)),