diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Makefile.config | 5 | ||||
| -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 |
4 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index bdf0e87f9b29..37d203c4cd1f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
| @@ -330,6 +330,11 @@ ifeq ($(feature-sched_getcpu), 1) | |||
| 330 | CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT | 330 | CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT |
| 331 | endif | 331 | endif |
| 332 | 332 | ||
| 333 | ifeq ($(feature-setns), 1) | ||
| 334 | CFLAGS += -DHAVE_SETNS_SUPPORT | ||
| 335 | $(call detected,CONFIG_SETNS) | ||
| 336 | endif | ||
| 337 | |||
| 333 | ifndef NO_LIBELF | 338 | ifndef NO_LIBELF |
| 334 | CFLAGS += -DHAVE_LIBELF_SUPPORT | 339 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
| 335 | EXTLIBS += -lelf | 340 | EXTLIBS += -lelf |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 79dea95a7f68..7580fe4d5d30 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build | |||
| @@ -104,6 +104,10 @@ ifndef CONFIG_LIBELF | |||
| 104 | libperf-y += symbol-minimal.o | 104 | libperf-y += symbol-minimal.o |
| 105 | endif | 105 | endif |
| 106 | 106 | ||
| 107 | ifndef CONFIG_SETNS | ||
| 108 | libperf-y += setns.o | ||
| 109 | endif | ||
| 110 | |||
| 107 | libperf-$(CONFIG_DWARF) += probe-finder.o | 111 | libperf-$(CONFIG_DWARF) += probe-finder.o |
| 108 | libperf-$(CONFIG_DWARF) += dwarf-aux.o | 112 | libperf-$(CONFIG_DWARF) += dwarf-aux.o |
| 109 | libperf-$(CONFIG_DWARF) += dwarf-regs.o | 113 | 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 000000000000..ce8fc290fce8 --- /dev/null +++ b/tools/perf/util/setns.c | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #include "util.h" | ||
| 2 | #include <unistd.h> | ||
| 3 | #include <sys/syscall.h> | ||
| 4 | |||
| 5 | int setns(int fd, int nstype) | ||
| 6 | { | ||
| 7 | return syscall(__NR_setns, fd, nstype); | ||
| 8 | } | ||
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 2c9e58a45310..1e5fe1d9ec32 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
| @@ -58,4 +58,8 @@ const char *perf_tip(const char *dirpath); | |||
| 58 | int sched_getcpu(void); | 58 | int sched_getcpu(void); |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | #ifndef HAVE_SETNS_SUPPORT | ||
| 62 | int setns(int fd, int nstype); | ||
| 63 | #endif | ||
| 64 | |||
| 61 | #endif /* GIT_COMPAT_UTIL_H */ | 65 | #endif /* GIT_COMPAT_UTIL_H */ |
