diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-07-18 17:15:29 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-07-18 23:14:08 -0300 |
commit | 86bcdb5a43997bb02ba25a76482c7bfc652ba45b (patch) | |
tree | 60737d10e15be7e8dbff4d7da4ba1f80f72ea5e0 /tools/perf/util | |
parent | 59291f19824200b5a9046b79d37f02fb415335b0 (diff) | |
download | op-kernel-dev-86bcdb5a43997bb02ba25a76482c7bfc652ba45b.zip op-kernel-dev-86bcdb5a43997bb02ba25a76482c7bfc652ba45b.tar.gz |
tools build: Add test for setns()
And provide an alternative implementation to keep perf building on older
distros as we're about to add initial support for namespaces.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-bqdwijunhjlvps1ardykhw1i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/Build | 4 | ||||
-rw-r--r-- | tools/perf/util/setns.c | 8 | ||||
-rw-r--r-- | tools/perf/util/util.h | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 79dea95..7580fe4 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -104,6 +104,10 @@ ifndef CONFIG_LIBELF libperf-y += symbol-minimal.o endif +ifndef CONFIG_SETNS +libperf-y += setns.o +endif + libperf-$(CONFIG_DWARF) += probe-finder.o libperf-$(CONFIG_DWARF) += dwarf-aux.o libperf-$(CONFIG_DWARF) += dwarf-regs.o diff --git a/tools/perf/util/setns.c b/tools/perf/util/setns.c new file mode 100644 index 0000000..ce8fc29 --- /dev/null +++ b/tools/perf/util/setns.c @@ -0,0 +1,8 @@ +#include "util.h" +#include <unistd.h> +#include <sys/syscall.h> + +int setns(int fd, int nstype) +{ + return syscall(__NR_setns, fd, nstype); +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 2c9e58a..1e5fe1d 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -58,4 +58,8 @@ const char *perf_tip(const char *dirpath); int sched_getcpu(void); #endif +#ifndef HAVE_SETNS_SUPPORT +int setns(int fd, int nstype); +#endif + #endif /* GIT_COMPAT_UTIL_H */ |