diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-27 10:49:13 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-27 10:49:13 -0400 |
| commit | fef2a735167a827a65bbdf1791abe0dd070ce372 (patch) | |
| tree | af25e9617173b6465eb6c5fd96d39350e9883401 /tools/perf | |
| parent | 25ce4bb8c50513e922da2709fedc9db112452fbc (diff) | |
perf tools: Kill die()
Finally can nuke this function, no more users.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-eivvvzn8ie6w42gy3batxoy7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/tests/attr.c | 10 | ||||
| -rw-r--r-- | tools/perf/util/usage.c | 22 |
2 files changed, 5 insertions, 27 deletions
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c index 0dd77494bb58..0e77b2cf61ec 100644 --- a/tools/perf/tests/attr.c +++ b/tools/perf/tests/attr.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | * permissions. All the event text files are stored there. | 18 | * permissions. All the event text files are stored there. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <debug.h> | ||
| 21 | #include <errno.h> | 22 | #include <errno.h> |
| 22 | #include <inttypes.h> | 23 | #include <inttypes.h> |
| 23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| @@ -29,14 +30,11 @@ | |||
| 29 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
| 30 | #include <unistd.h> | 31 | #include <unistd.h> |
| 31 | #include "../perf.h" | 32 | #include "../perf.h" |
| 32 | #include "util.h" | ||
| 33 | #include <subcmd/exec-cmd.h> | 33 | #include <subcmd/exec-cmd.h> |
| 34 | #include "tests.h" | 34 | #include "tests.h" |
| 35 | 35 | ||
| 36 | #define ENV "PERF_TEST_ATTR" | 36 | #define ENV "PERF_TEST_ATTR" |
| 37 | 37 | ||
| 38 | extern int verbose; | ||
| 39 | |||
| 40 | static char *dir; | 38 | static char *dir; |
| 41 | 39 | ||
| 42 | void test_attr__init(void) | 40 | void test_attr__init(void) |
| @@ -138,8 +136,10 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | |||
| 138 | { | 136 | { |
| 139 | int errno_saved = errno; | 137 | int errno_saved = errno; |
| 140 | 138 | ||
| 141 | if (store_event(attr, pid, cpu, fd, group_fd, flags)) | 139 | if (store_event(attr, pid, cpu, fd, group_fd, flags)) { |
| 142 | die("test attr FAILED"); | 140 | pr_err("test attr FAILED"); |
| 141 | exit(128); | ||
| 142 | } | ||
| 143 | 143 | ||
| 144 | errno = errno_saved; | 144 | errno = errno_saved; |
| 145 | } | 145 | } |
diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c index bf185f28b19e..6cc9d9888ce0 100644 --- a/tools/perf/util/usage.c +++ b/tools/perf/util/usage.c | |||
| @@ -9,25 +9,12 @@ | |||
| 9 | #include "util.h" | 9 | #include "util.h" |
| 10 | #include "debug.h" | 10 | #include "debug.h" |
| 11 | 11 | ||
| 12 | static void report(const char *prefix, const char *err, va_list params) | ||
| 13 | { | ||
| 14 | char msg[1024]; | ||
| 15 | vsnprintf(msg, sizeof(msg), err, params); | ||
| 16 | fprintf(stderr, " %s%s\n", prefix, msg); | ||
| 17 | } | ||
| 18 | |||
| 19 | static __noreturn void usage_builtin(const char *err) | 12 | static __noreturn void usage_builtin(const char *err) |
| 20 | { | 13 | { |
| 21 | fprintf(stderr, "\n Usage: %s\n", err); | 14 | fprintf(stderr, "\n Usage: %s\n", err); |
| 22 | exit(129); | 15 | exit(129); |
| 23 | } | 16 | } |
| 24 | 17 | ||
| 25 | static __noreturn void die_builtin(const char *err, va_list params) | ||
| 26 | { | ||
| 27 | report(" Fatal: ", err, params); | ||
| 28 | exit(128); | ||
| 29 | } | ||
| 30 | |||
| 31 | /* If we are in a dlopen()ed .so write to a global variable would segfault | 18 | /* If we are in a dlopen()ed .so write to a global variable would segfault |
| 32 | * (ugh), so keep things static. */ | 19 | * (ugh), so keep things static. */ |
| 33 | static void (*usage_routine)(const char *err) __noreturn = usage_builtin; | 20 | static void (*usage_routine)(const char *err) __noreturn = usage_builtin; |
| @@ -36,12 +23,3 @@ void usage(const char *err) | |||
| 36 | { | 23 | { |
| 37 | usage_routine(err); | 24 | usage_routine(err); |
| 38 | } | 25 | } |
| 39 | |||
| 40 | void die(const char *err, ...) | ||
| 41 | { | ||
| 42 | va_list params; | ||
| 43 | |||
| 44 | va_start(params, err); | ||
| 45 | die_builtin(err, params); | ||
| 46 | va_end(params); | ||
| 47 | } | ||
