diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-17 15:10:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-19 12:01:48 -0400 |
commit | 3d689ed6099a1a11c38bb78aff7498e78e287e0b (patch) | |
tree | b87d7f59e994306e99551776c481001ca3956aa5 | |
parent | 28a9bb9621d9f8b4328048297cd306e09fbbf175 (diff) |
perf tools: Move sane ctype stuff from util.h to sane_ctype.h
More stuff that came from git, out of the hodge-podge that is util.h
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-e3lana4gctz3ub4hn4y29hkw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
37 files changed, 114 insertions, 55 deletions
diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c index 5e431077fcd6..d270ac00613d 100644 --- a/tools/lib/symbol/kallsyms.c +++ b/tools/lib/symbol/kallsyms.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <ctype.h> | ||
1 | #include "symbol/kallsyms.h" | 2 | #include "symbol/kallsyms.h" |
2 | #include <stdio.h> | 3 | #include <stdio.h> |
3 | #include <stdlib.h> | 4 | #include <stdlib.h> |
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 886dd2aaff0d..837067f48a4c 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c | |||
@@ -4,6 +4,8 @@ | |||
4 | #include "../util/util.h" | 4 | #include "../util/util.h" |
5 | #include "../util/debug.h" | 5 | #include "../util/debug.h" |
6 | 6 | ||
7 | #include "sane_ctype.h" | ||
8 | |||
7 | const char *const arm_triplets[] = { | 9 | const char *const arm_triplets[] = { |
8 | "arm-eabi-", | 10 | "arm-eabi-", |
9 | "arm-linux-androideabi-", | 11 | "arm-linux-androideabi-", |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index fa6bf1c39b65..15754a492cad 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <locale.h> | 27 | #include <locale.h> |
28 | #include <regex.h> | 28 | #include <regex.h> |
29 | 29 | ||
30 | #include "sane_ctype.h" | ||
31 | |||
30 | static int kmem_slab; | 32 | static int kmem_slab; |
31 | static int kmem_page; | 33 | static int kmem_page; |
32 | 34 | ||
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index d4677fb7f7f5..aefab93d7d2f 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <api/fs/fs.h> | 34 | #include <api/fs/fs.h> |
35 | #include <linux/time64.h> | 35 | #include <linux/time64.h> |
36 | 36 | ||
37 | #include "sane_ctype.h" | ||
38 | |||
37 | #define PR_SET_NAME 15 /* Set process name */ | 39 | #define PR_SET_NAME 15 /* Set process name */ |
38 | #define MAX_CPUS 4096 | 40 | #define MAX_CPUS 4096 |
39 | #define COMM_LEN 20 | 41 | #define COMM_LEN 20 |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index c4e36b4743f4..5afd9a62360a 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "util/dump-insn.h" | 32 | #include "util/dump-insn.h" |
33 | #include <inttypes.h> | 33 | #include <inttypes.h> |
34 | 34 | ||
35 | #include "sane_ctype.h" | ||
36 | |||
35 | static char const *script_name; | 37 | static char const *script_name; |
36 | static char const *generate_script_lang; | 38 | static char const *generate_script_lang; |
37 | static bool debug_mode; | 39 | static bool debug_mode; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index b7199f029073..5abef25f9983 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -74,6 +74,8 @@ | |||
74 | #include <locale.h> | 74 | #include <locale.h> |
75 | #include <math.h> | 75 | #include <math.h> |
76 | 76 | ||
77 | #include "sane_ctype.h" | ||
78 | |||
77 | #define DEFAULT_SEPARATOR " " | 79 | #define DEFAULT_SEPARATOR " " |
78 | #define CNTR_NOT_SUPPORTED "<not supported>" | 80 | #define CNTR_NOT_SUPPORTED "<not supported>" |
79 | #define CNTR_NOT_COUNTED "<not counted>" | 81 | #define CNTR_NOT_COUNTED "<not counted>" |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a0c97c70ec81..ec3247db4826 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -72,6 +72,8 @@ | |||
72 | #include <linux/time64.h> | 72 | #include <linux/time64.h> |
73 | #include <linux/types.h> | 73 | #include <linux/types.h> |
74 | 74 | ||
75 | #include "sane_ctype.h" | ||
76 | |||
75 | static volatile int done; | 77 | static volatile int done; |
76 | 78 | ||
77 | #define HEADER_LINE_NR 5 | 79 | #define HEADER_LINE_NR 5 |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index aba5fac41529..0b00d8ac5226 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -51,6 +51,8 @@ | |||
51 | #include <linux/stringify.h> | 51 | #include <linux/stringify.h> |
52 | #include <linux/time64.h> | 52 | #include <linux/time64.h> |
53 | 53 | ||
54 | #include "sane_ctype.h" | ||
55 | |||
54 | #ifndef O_CLOEXEC | 56 | #ifndef O_CLOEXEC |
55 | # define O_CLOEXEC 02000000 | 57 | # define O_CLOEXEC 02000000 |
56 | #endif | 58 | #endif |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 6effcfb7e0c1..fe6aac82d54e 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <ctype.h> | ||
8 | #include <string.h> | 7 | #include <string.h> |
9 | 8 | ||
10 | #include "parse-events.h" | 9 | #include "parse-events.h" |
@@ -18,6 +17,8 @@ | |||
18 | 17 | ||
19 | #include "tests.h" | 18 | #include "tests.h" |
20 | 19 | ||
20 | #include "sane_ctype.h" | ||
21 | |||
21 | #define BUFSZ 1024 | 22 | #define BUFSZ 1024 |
22 | #define READLEN 128 | 23 | #define READLEN 128 |
23 | 24 | ||
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 9e47ccbe07f1..73bdd07321c4 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "helpline.h" | 13 | #include "helpline.h" |
14 | #include "keysyms.h" | 14 | #include "keysyms.h" |
15 | #include "../color.h" | 15 | #include "../color.h" |
16 | #include "sane_ctype.h" | ||
16 | 17 | ||
17 | static int ui_browser__percent_color(struct ui_browser *browser, | 18 | static int ui_browser__percent_color(struct ui_browser *browser, |
18 | double percent, bool current) | 19 | double percent, bool current) |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index a2ea1fa15ae6..56f5c038689e 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include "map.h" | 20 | #include "map.h" |
21 | #include "annotate.h" | 21 | #include "annotate.h" |
22 | 22 | ||
23 | #include "sane_ctype.h" | ||
24 | |||
23 | extern void hist_browser__init_hpp(void); | 25 | extern void hist_browser__init_hpp(void); |
24 | 26 | ||
25 | static int perf_evsel_browser_title(struct hist_browser *browser, | 27 | static int perf_evsel_browser_title(struct hist_browser *browser, |
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index 9ce142de536d..ffa5addf631d 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include "../keysyms.h" | 11 | #include "../keysyms.h" |
12 | #include "map.h" | 12 | #include "map.h" |
13 | 13 | ||
14 | #include "sane_ctype.h" | ||
15 | |||
14 | struct map_browser { | 16 | struct map_browser { |
15 | struct ui_browser b; | 17 | struct ui_browser b; |
16 | struct map *map; | 18 | struct map *map; |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index d52d5f64ea89..297a79c69b71 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "../../util/hist.h" | 4 | #include "../../util/hist.h" |
5 | #include "../../util/sort.h" | 5 | #include "../../util/sort.h" |
6 | #include "../../util/evsel.h" | 6 | #include "../../util/evsel.h" |
7 | 7 | #include "../../util/sane_ctype.h" | |
8 | 8 | ||
9 | static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin) | 9 | static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin) |
10 | { | 10 | { |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4d4faf99d52d..d69fdafba274 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <sys/utsname.h> | 27 | #include <sys/utsname.h> |
28 | 28 | ||
29 | #include "sane_ctype.h" | ||
30 | |||
29 | const char *disassembler_style; | 31 | const char *disassembler_style; |
30 | const char *objdump_path; | 32 | const char *objdump_path; |
31 | static regex_t file_lineno; | 33 | static regex_t file_lineno; |
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index a81a402a7459..0daf63b9ee3e 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <sys/types.h> | 17 | #include <sys/types.h> |
18 | #include <sys/mman.h> | 18 | #include <sys/mman.h> |
19 | #include <stdbool.h> | 19 | #include <stdbool.h> |
20 | #include <ctype.h> | ||
21 | #include <string.h> | 20 | #include <string.h> |
22 | #include <limits.h> | 21 | #include <limits.h> |
23 | #include <errno.h> | 22 | #include <errno.h> |
@@ -47,7 +46,6 @@ | |||
47 | #include "cpumap.h" | 46 | #include "cpumap.h" |
48 | #include "thread_map.h" | 47 | #include "thread_map.h" |
49 | #include "asm/bug.h" | 48 | #include "asm/bug.h" |
50 | #include "symbol/kallsyms.h" | ||
51 | #include "auxtrace.h" | 49 | #include "auxtrace.h" |
52 | 50 | ||
53 | #include <linux/hash.h> | 51 | #include <linux/hash.h> |
@@ -60,6 +58,9 @@ | |||
60 | #include "intel-pt.h" | 58 | #include "intel-pt.h" |
61 | #include "intel-bts.h" | 59 | #include "intel-bts.h" |
62 | 60 | ||
61 | #include "sane_ctype.h" | ||
62 | #include "symbol/kallsyms.h" | ||
63 | |||
63 | int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, | 64 | int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, |
64 | struct auxtrace_mmap_params *mp, | 65 | struct auxtrace_mmap_params *mp, |
65 | void *userpg, int fd) | 66 | void *userpg, int fd) |
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 33af67530d30..3c0755563969 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "vdso.h" | 19 | #include "vdso.h" |
20 | #include "probe-file.h" | 20 | #include "probe-file.h" |
21 | 21 | ||
22 | #include "sane_ctype.h" | ||
22 | 23 | ||
23 | static bool no_buildid_cache; | 24 | static bool no_buildid_cache; |
24 | 25 | ||
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index 7b01d59076d3..88783aa3dfc9 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include "util/llvm-utils.h" /* perf_llvm_config */ | 15 | #include "util/llvm-utils.h" /* perf_llvm_config */ |
16 | #include "config.h" | 16 | #include "config.h" |
17 | 17 | ||
18 | #include "sane_ctype.h" | ||
19 | |||
18 | #define MAXNAME (256) | 20 | #define MAXNAME (256) |
19 | 21 | ||
20 | #define DEBUG_CACHE_DIR ".debug" | 22 | #define DEBUG_CACHE_DIR ".debug" |
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 061018b42393..9d9ecb2430cc 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/bitmap.h> | 8 | #include <linux/bitmap.h> |
9 | #include "asm/bug.h" | 9 | #include "asm/bug.h" |
10 | 10 | ||
11 | #include "sane_ctype.h" | ||
12 | |||
11 | static int max_cpu_num; | 13 | static int max_cpu_num; |
12 | static int max_present_cpu_num; | 14 | static int max_present_cpu_num; |
13 | static int max_node_num; | 15 | static int max_node_num; |
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c index d4a5a21c2a7e..4b261c2ec0f1 100644 --- a/tools/perf/util/ctype.c +++ b/tools/perf/util/ctype.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * No surprises, and works with signed and unsigned chars. | 4 | * No surprises, and works with signed and unsigned chars. |
5 | */ | 5 | */ |
6 | #include "util.h" | 6 | #include "sane_ctype.h" |
7 | 7 | ||
8 | enum { | 8 | enum { |
9 | S = GIT_SPACE, | 9 | S = GIT_SPACE, |
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index ef80221e0d9c..c3277b32e917 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "evsel.h" | 29 | #include "evsel.h" |
30 | #include "machine.h" | 30 | #include "machine.h" |
31 | #include "config.h" | 31 | #include "config.h" |
32 | #include "sane_ctype.h" | ||
32 | 33 | ||
33 | #define pr_N(n, fmt, ...) \ | 34 | #define pr_N(n, fmt, ...) \ |
34 | eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__) | 35 | eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__) |
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 4d5df25f155a..41aa7c63e037 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include "util.h" | 16 | #include "util.h" |
17 | #include "target.h" | 17 | #include "target.h" |
18 | 18 | ||
19 | #include "sane_ctype.h" | ||
20 | |||
19 | int verbose; | 21 | int verbose; |
20 | bool dump_trace = false, quiet = false; | 22 | bool dump_trace = false, quiet = false; |
21 | int debug_ordered_events; | 23 | int debug_ordered_events; |
diff --git a/tools/perf/util/demangle-java.c b/tools/perf/util/demangle-java.c index 3e6062ab2cdd..cb66d334f532 100644 --- a/tools/perf/util/demangle-java.c +++ b/tools/perf/util/demangle-java.c | |||
@@ -7,6 +7,8 @@ | |||
7 | 7 | ||
8 | #include "demangle-java.h" | 8 | #include "demangle-java.h" |
9 | 9 | ||
10 | #include "sane_ctype.h" | ||
11 | |||
10 | enum { | 12 | enum { |
11 | MODE_PREFIX = 0, | 13 | MODE_PREFIX = 0, |
12 | MODE_CLASS = 1, | 14 | MODE_CLASS = 1, |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index b761b0eb60af..f8a706ba72f2 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "strlist.h" | 12 | #include "strlist.h" |
13 | #include "thread.h" | 13 | #include "thread.h" |
14 | #include "thread_map.h" | 14 | #include "thread_map.h" |
15 | #include "sane_ctype.h" | ||
15 | #include "symbol/kallsyms.h" | 16 | #include "symbol/kallsyms.h" |
16 | #include "asm/bug.h" | 17 | #include "asm/bug.h" |
17 | #include "stat.h" | 18 | #include "stat.h" |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 99a13a63ff1f..757f73c4fa95 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "stat.h" | 31 | #include "stat.h" |
32 | #include "util/parse-branch-options.h" | 32 | #include "util/parse-branch-options.h" |
33 | 33 | ||
34 | #include "sane_ctype.h" | ||
35 | |||
34 | static struct { | 36 | static struct { |
35 | bool sample_id_all; | 37 | bool sample_id_all; |
36 | bool exclude_guest; | 38 | bool exclude_guest; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 0371f3483ede..faf046fc398f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <api/fs/fs.h> | 27 | #include <api/fs/fs.h> |
28 | #include "asm/bug.h" | 28 | #include "asm/bug.h" |
29 | 29 | ||
30 | #include "sane_ctype.h" | ||
31 | |||
30 | /* | 32 | /* |
31 | * magic2 = "PERFILE2" | 33 | * magic2 = "PERFILE2" |
32 | * must be a numerical value to let the endianness | 34 | * must be a numerical value to let the endianness |
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index da6262dbe9e3..d6d25327bc92 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include "genelf.h" | 26 | #include "genelf.h" |
27 | #include "../builtin.h" | 27 | #include "../builtin.h" |
28 | 28 | ||
29 | #include "sane_ctype.h" | ||
30 | |||
29 | struct jit_buf_desc { | 31 | struct jit_buf_desc { |
30 | struct perf_data_file *output; | 32 | struct perf_data_file *output; |
31 | struct perf_session *session; | 33 | struct perf_session *session; |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 15b2a17cf76e..f13f46a99b36 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -11,11 +11,13 @@ | |||
11 | #include "thread.h" | 11 | #include "thread.h" |
12 | #include "vdso.h" | 12 | #include "vdso.h" |
13 | #include <stdbool.h> | 13 | #include <stdbool.h> |
14 | #include <symbol/kallsyms.h> | ||
15 | #include "unwind.h" | 14 | #include "unwind.h" |
16 | #include "linux/hash.h" | 15 | #include "linux/hash.h" |
17 | #include "asm/bug.h" | 16 | #include "asm/bug.h" |
18 | 17 | ||
18 | #include "sane_ctype.h" | ||
19 | #include <symbol/kallsyms.h> | ||
20 | |||
19 | static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock); | 21 | static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock); |
20 | 22 | ||
21 | static void dsos__init(struct dsos *dsos) | 23 | static void dsos__init(struct dsos *dsos) |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index e61b4b34a929..7caba7003734 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -48,6 +48,8 @@ | |||
48 | #include "probe-file.h" | 48 | #include "probe-file.h" |
49 | #include "session.h" | 49 | #include "session.h" |
50 | 50 | ||
51 | #include "sane_ctype.h" | ||
52 | |||
51 | #define PERFPROBE_GROUP "probe" | 53 | #define PERFPROBE_GROUP "probe" |
52 | 54 | ||
53 | bool probe_event_dry_run; /* Dry run flag */ | 55 | bool probe_event_dry_run; /* Dry run flag */ |
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 2956c5198652..27f061551012 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
@@ -2,9 +2,9 @@ | |||
2 | #define _PROBE_FINDER_H | 2 | #define _PROBE_FINDER_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include "util.h" | ||
6 | #include "intlist.h" | 5 | #include "intlist.h" |
7 | #include "probe-event.h" | 6 | #include "probe-event.h" |
7 | #include "sane_ctype.h" | ||
8 | 8 | ||
9 | #define MAX_PROBE_BUFFER 1024 | 9 | #define MAX_PROBE_BUFFER 1024 |
10 | #define MAX_PROBES 128 | 10 | #define MAX_PROBES 128 |
diff --git a/tools/perf/util/sane_ctype.h b/tools/perf/util/sane_ctype.h new file mode 100644 index 000000000000..4308c22c22ad --- /dev/null +++ b/tools/perf/util/sane_ctype.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _PERF_SANE_CTYPE_H | ||
2 | #define _PERF_SANE_CTYPE_H | ||
3 | |||
4 | extern const char *graph_line; | ||
5 | extern const char *graph_dotted_line; | ||
6 | extern const char *spaces; | ||
7 | extern const char *dots; | ||
8 | |||
9 | /* Sane ctype - no locale, and works with signed chars */ | ||
10 | #undef isascii | ||
11 | #undef isspace | ||
12 | #undef isdigit | ||
13 | #undef isxdigit | ||
14 | #undef isalpha | ||
15 | #undef isprint | ||
16 | #undef isalnum | ||
17 | #undef islower | ||
18 | #undef isupper | ||
19 | #undef tolower | ||
20 | #undef toupper | ||
21 | |||
22 | extern unsigned char sane_ctype[256]; | ||
23 | #define GIT_SPACE 0x01 | ||
24 | #define GIT_DIGIT 0x02 | ||
25 | #define GIT_ALPHA 0x04 | ||
26 | #define GIT_GLOB_SPECIAL 0x08 | ||
27 | #define GIT_REGEX_SPECIAL 0x10 | ||
28 | #define GIT_PRINT_EXTRA 0x20 | ||
29 | #define GIT_PRINT 0x3E | ||
30 | #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) | ||
31 | #define isascii(x) (((x) & ~0x7f) == 0) | ||
32 | #define isspace(x) sane_istest(x,GIT_SPACE) | ||
33 | #define isdigit(x) sane_istest(x,GIT_DIGIT) | ||
34 | #define isxdigit(x) \ | ||
35 | (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G') | ||
36 | #define isalpha(x) sane_istest(x,GIT_ALPHA) | ||
37 | #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) | ||
38 | #define isprint(x) sane_istest(x,GIT_PRINT) | ||
39 | #define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20)) | ||
40 | #define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20)) | ||
41 | #define tolower(x) sane_case((unsigned char)(x), 0x20) | ||
42 | #define toupper(x) sane_case((unsigned char)(x), 0) | ||
43 | |||
44 | static inline int sane_case(int x, int high) | ||
45 | { | ||
46 | if (sane_istest(x, GIT_ALPHA)) | ||
47 | x = (x & ~0x20) | high; | ||
48 | return x; | ||
49 | } | ||
50 | |||
51 | #endif /* _PERF_SANE_CTYPE_H */ | ||
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c index efb53772e0ec..c663c9153245 100644 --- a/tools/perf/util/strfilter.c +++ b/tools/perf/util/strfilter.c | |||
@@ -2,6 +2,8 @@ | |||
2 | #include "string.h" | 2 | #include "string.h" |
3 | #include "strfilter.h" | 3 | #include "strfilter.h" |
4 | 4 | ||
5 | #include "sane_ctype.h" | ||
6 | |||
5 | /* Operators */ | 7 | /* Operators */ |
6 | static const char *OP_and = "&"; /* Logical AND */ | 8 | static const char *OP_and = "&"; /* Logical AND */ |
7 | static const char *OP_or = "|"; /* Logical OR */ | 9 | static const char *OP_or = "|"; /* Logical OR */ |
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index e8feb142c9c9..e716a6e5bb19 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include "util.h" | 1 | #include "util.h" |
2 | #include "linux/string.h" | 2 | #include "linux/string.h" |
3 | 3 | ||
4 | #include "sane_ctype.h" | ||
5 | |||
4 | #define K 1024LL | 6 | #define K 1024LL |
5 | /* | 7 | /* |
6 | * perf_atoll() | 8 | * perf_atoll() |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index d1a40bb642ff..e7ee47f7377a 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -10,8 +10,9 @@ | |||
10 | #include "demangle-rust.h" | 10 | #include "demangle-rust.h" |
11 | #include "machine.h" | 11 | #include "machine.h" |
12 | #include "vdso.h" | 12 | #include "vdso.h" |
13 | #include <symbol/kallsyms.h> | ||
14 | #include "debug.h" | 13 | #include "debug.h" |
14 | #include "sane_ctype.h" | ||
15 | #include <symbol/kallsyms.h> | ||
15 | 16 | ||
16 | #ifndef EM_AARCH64 | 17 | #ifndef EM_AARCH64 |
17 | #define EM_AARCH64 183 /* ARM 64 bit */ | 18 | #define EM_AARCH64 183 /* ARM 64 bit */ |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 619e3eb44c50..68f14d770083 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "strlist.h" | 19 | #include "strlist.h" |
20 | #include "intlist.h" | 20 | #include "intlist.h" |
21 | #include "header.h" | 21 | #include "header.h" |
22 | #include "sane_ctype.h" | ||
22 | 23 | ||
23 | #include <elf.h> | 24 | #include <elf.h> |
24 | #include <limits.h> | 25 | #include <limits.h> |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index de0078e21408..746bbee645d9 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -21,13 +21,14 @@ | |||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <string.h> | 23 | #include <string.h> |
24 | #include <ctype.h> | ||
25 | #include <errno.h> | 24 | #include <errno.h> |
26 | 25 | ||
27 | #include "../perf.h" | 26 | #include "../perf.h" |
28 | #include "util.h" | 27 | #include "util.h" |
29 | #include "trace-event.h" | 28 | #include "trace-event.h" |
30 | 29 | ||
30 | #include "sane_ctype.h" | ||
31 | |||
31 | static int get_common_field(struct scripting_context *context, | 32 | static int get_common_field(struct scripting_context *context, |
32 | int *offset, int *size, const char *type) | 33 | int *offset, int *size, const char *type) |
33 | { | 34 | { |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 524bd3b9d98d..717541e72999 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include "callchain.h" | 21 | #include "callchain.h" |
22 | #include "strlist.h" | 22 | #include "strlist.h" |
23 | 23 | ||
24 | #include "sane_ctype.h" | ||
25 | |||
24 | #define CALLCHAIN_PARAM_DEFAULT \ | 26 | #define CALLCHAIN_PARAM_DEFAULT \ |
25 | .mode = CHAIN_GRAPH_ABS, \ | 27 | .mode = CHAIN_GRAPH_ABS, \ |
26 | .min_percent = 0.5, \ | 28 | .min_percent = 0.5, \ |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index f26666d77677..f7e1ead50f47 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -43,10 +43,6 @@ | |||
43 | #include <termios.h> | 43 | #include <termios.h> |
44 | #include "strlist.h" | 44 | #include "strlist.h" |
45 | 45 | ||
46 | extern const char *graph_line; | ||
47 | extern const char *graph_dotted_line; | ||
48 | extern const char *spaces; | ||
49 | extern const char *dots; | ||
50 | extern char buildid_dir[]; | 46 | extern char buildid_dir[]; |
51 | 47 | ||
52 | #ifdef __GNUC__ | 48 | #ifdef __GNUC__ |
@@ -94,48 +90,6 @@ static inline void *zalloc(size_t size) | |||
94 | 90 | ||
95 | #define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) | 91 | #define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) |
96 | 92 | ||
97 | /* Sane ctype - no locale, and works with signed chars */ | ||
98 | #undef isascii | ||
99 | #undef isspace | ||
100 | #undef isdigit | ||
101 | #undef isxdigit | ||
102 | #undef isalpha | ||
103 | #undef isprint | ||
104 | #undef isalnum | ||
105 | #undef islower | ||
106 | #undef isupper | ||
107 | #undef tolower | ||
108 | #undef toupper | ||
109 | |||
110 | extern unsigned char sane_ctype[256]; | ||
111 | #define GIT_SPACE 0x01 | ||
112 | #define GIT_DIGIT 0x02 | ||
113 | #define GIT_ALPHA 0x04 | ||
114 | #define GIT_GLOB_SPECIAL 0x08 | ||
115 | #define GIT_REGEX_SPECIAL 0x10 | ||
116 | #define GIT_PRINT_EXTRA 0x20 | ||
117 | #define GIT_PRINT 0x3E | ||
118 | #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) | ||
119 | #define isascii(x) (((x) & ~0x7f) == 0) | ||
120 | #define isspace(x) sane_istest(x,GIT_SPACE) | ||
121 | #define isdigit(x) sane_istest(x,GIT_DIGIT) | ||
122 | #define isxdigit(x) \ | ||
123 | (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G') | ||
124 | #define isalpha(x) sane_istest(x,GIT_ALPHA) | ||
125 | #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) | ||
126 | #define isprint(x) sane_istest(x,GIT_PRINT) | ||
127 | #define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20)) | ||
128 | #define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20)) | ||
129 | #define tolower(x) sane_case((unsigned char)(x), 0x20) | ||
130 | #define toupper(x) sane_case((unsigned char)(x), 0) | ||
131 | |||
132 | static inline int sane_case(int x, int high) | ||
133 | { | ||
134 | if (sane_istest(x, GIT_ALPHA)) | ||
135 | x = (x & ~0x20) | high; | ||
136 | return x; | ||
137 | } | ||
138 | |||
139 | int mkdir_p(char *path, mode_t mode); | 93 | int mkdir_p(char *path, mode_t mode); |
140 | int rm_rf(const char *path); | 94 | int rm_rf(const char *path); |
141 | struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *)); | 95 | struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *)); |