diff options
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 05714d548584..948b2c5efb65 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1,4 +1,8 @@ +#include <errno.h> +#include <inttypes.h> #include "util.h" +#include "string2.h" +#include <sys/param.h> #include <sys/types.h> #include <byteswap.h> #include <unistd.h> @@ -7,7 +11,10 @@ #include <linux/list.h> #include <linux/kernel.h> #include <linux/bitops.h> +#include <sys/stat.h> +#include <sys/types.h> #include <sys/utsname.h> +#include <unistd.h> #include "evlist.h" #include "evsel.h" @@ -26,6 +33,8 @@ #include <api/fs/fs.h> #include "asm/bug.h" +#include "sane_ctype.h" + /* * magic2 = "PERFILE2" * must be a numerical value to let the endianness @@ -370,15 +379,11 @@ static int write_cmdline(int fd, struct perf_header *h __maybe_unused, struct perf_evlist *evlist __maybe_unused) { char buf[MAXPATHLEN]; - char proc[32]; u32 n; int i, ret; - /* - * actual atual path to perf binary - */ - sprintf(proc, "/proc/%d/exe", getpid()); - ret = readlink(proc, buf, sizeof(buf)); + /* actual path to perf binary */ + ret = readlink("/proc/self/exe", buf, sizeof(buf) - 1); if (ret <= 0) return -1; @@ -2274,6 +2279,9 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full) perf_header__process_sections(header, fd, &hd, perf_file_section__fprintf_info); + if (session->file->is_pipe) + return 0; + fprintf(fp, "# missing features: "); for_each_clear_bit(bit, header->adds_features, HEADER_LAST_FEATURE) { if (bit) |