summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/namespaces.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/namespaces.c')
-rw-r--r--tools/perf/util/namespaces.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
index fc5f398779a4..a58e91197729 100644
--- a/tools/perf/util/namespaces.c
+++ b/tools/perf/util/namespaces.c
@@ -11,6 +11,7 @@
#include "event.h"
#include <sys/types.h>
#include <sys/stat.h>
+#include <limits.h>
#include <sched.h>
#include <stdlib.h>
#include <stdio.h>
@@ -233,3 +234,15 @@ void nsinfo__mountns_exit(struct nscookie *nc)
nc->newns = -1;
}
}
+
+char *nsinfo__realpath(const char *path, struct nsinfo *nsi)
+{
+ char *rpath;
+ struct nscookie nsc;
+
+ nsinfo__mountns_enter(nsi, &nsc);
+ rpath = realpath(path, NULL);
+ nsinfo__mountns_exit(&nsc);
+
+ return rpath;
+}
OpenPOWER on IntegriCloud