diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 13:13:22 -0500 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 13:13:22 -0500 | 
| commit | 2205afa7d13ec716935dfd4b8ff71059ee7aeb0c (patch) | |
| tree | 19e63ed8040e8a82c3cdd331458d246247466a28 /tools/perf/builtin-buildid-list.c | |
| parent | 491424c0f46c282a854b88830212bdb0763e93dc (diff) | |
| parent | 2cd9046cc53dd2625e2cf5854d6cbb1ba61de914 (diff) | |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf sched: Fix build failure on sparc
  perf bench: Add "all" pseudo subsystem and "all" pseudo suite
  perf tools: Introduce perf_session class
  perf symbols: Ditch dso->find_symbol
  perf symbols: Allow lookups by symbol name too
  perf symbols: Add missing "Variables" entry to map_type__name
  perf symbols: Add support for 'variable' symtabs
  perf symbols: Introduce ELF counterparts to symbol_type__is_a
  perf symbols: Introduce symbol_type__is_a
  perf symbols: Rename kthreads to kmaps, using another abstraction for it
  perf tools: Allow building for ARM
  hw-breakpoints: Handle bad modify_user_hw_breakpoint off-case return value
  perf tools: Allow cross compiling
  tracing, slab: Fix no callsite ifndef CONFIG_KMEMTRACE
  tracing, slab: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
Trivial conflict due to different fixes to modify_user_hw_breakpoint()
in include/linux/hw_breakpoint.h
Diffstat (limited to 'tools/perf/builtin-buildid-list.c')
| -rw-r--r-- | tools/perf/builtin-buildid-list.c | 55 | 
1 files changed, 8 insertions, 47 deletions
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index dcb6143a0002..bfd16a1594e4 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c  | |||
| @@ -11,8 +11,8 @@ | |||
| 11 | #include "util/cache.h" | 11 | #include "util/cache.h" | 
| 12 | #include "util/data_map.h" | 12 | #include "util/data_map.h" | 
| 13 | #include "util/debug.h" | 13 | #include "util/debug.h" | 
| 14 | #include "util/header.h" | ||
| 15 | #include "util/parse-options.h" | 14 | #include "util/parse-options.h" | 
| 15 | #include "util/session.h" | ||
| 16 | #include "util/symbol.h" | 16 | #include "util/symbol.h" | 
| 17 | 17 | ||
| 18 | static char const *input_name = "perf.data"; | 18 | static char const *input_name = "perf.data"; | 
| @@ -55,56 +55,17 @@ static int perf_file_section__process_buildids(struct perf_file_section *self, | |||
| 55 | static int __cmd_buildid_list(void) | 55 | static int __cmd_buildid_list(void) | 
| 56 | { | 56 | { | 
| 57 | int err = -1; | 57 | int err = -1; | 
| 58 | struct perf_header *header; | 58 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, force); | 
| 59 | struct perf_file_header f_header; | ||
| 60 | struct stat input_stat; | ||
| 61 | int input = open(input_name, O_RDONLY); | ||
| 62 | 59 | ||
| 63 | if (input < 0) { | 60 | if (session == NULL) | 
| 64 | pr_err("failed to open file: %s", input_name); | 61 | return -1; | 
| 65 | if (!strcmp(input_name, "perf.data")) | ||
| 66 | pr_err(" (try 'perf record' first)"); | ||
| 67 | pr_err("\n"); | ||
| 68 | goto out; | ||
| 69 | } | ||
| 70 | |||
| 71 | err = fstat(input, &input_stat); | ||
| 72 | if (err < 0) { | ||
| 73 | perror("failed to stat file"); | ||
| 74 | goto out_close; | ||
| 75 | } | ||
| 76 | |||
| 77 | if (!force && input_stat.st_uid && (input_stat.st_uid != geteuid())) { | ||
| 78 | pr_err("file %s not owned by current user or root\n", | ||
| 79 | input_name); | ||
| 80 | goto out_close; | ||
| 81 | } | ||
| 82 | |||
| 83 | if (!input_stat.st_size) { | ||
| 84 | pr_info("zero-sized file, nothing to do!\n"); | ||
| 85 | goto out_close; | ||
| 86 | } | ||
| 87 | |||
| 88 | err = -1; | ||
| 89 | header = perf_header__new(); | ||
| 90 | if (header == NULL) | ||
| 91 | goto out_close; | ||
| 92 | |||
| 93 | if (perf_file_header__read(&f_header, header, input) < 0) { | ||
| 94 | pr_warning("incompatible file format"); | ||
| 95 | goto out_close; | ||
| 96 | } | ||
| 97 | 62 | ||
| 98 | err = perf_header__process_sections(header, input, | 63 | err = perf_header__process_sections(&session->header, session->fd, | 
| 99 | perf_file_section__process_buildids); | 64 | perf_file_section__process_buildids); | 
| 65 | if (err >= 0) | ||
| 66 | dsos__fprintf_buildid(stdout); | ||
| 100 | 67 | ||
| 101 | if (err < 0) | 68 | perf_session__delete(session); | 
| 102 | goto out_close; | ||
| 103 | |||
| 104 | dsos__fprintf_buildid(stdout); | ||
| 105 | out_close: | ||
| 106 | close(input); | ||
| 107 | out: | ||
| 108 | return err; | 69 | return err; | 
| 109 | } | 70 | } | 
| 110 | 71 | ||
