aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-09-03 15:15:12 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-10-09 10:09:46 -0400
commitefe6b882cda2a9967a629fa14b6106b6a9a558a2 (patch)
tree124b9764183d6b938b66b11e108dcd43648fa84b /tools/perf/builtin-trace.c
parent1f115cb72e44391fac3ab1c562a77b421469ac2d (diff)
perf trace: Use strarray for ltrace's whence arg
Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-5f9jhbq8my4ojarhtlygveox@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 386ca2058ee7..7cb60526a6f1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -72,31 +72,6 @@ static size_t syscall_arg__scnprintf_hex(char *bf, size_t size,
72 72
73#define SCA_HEX syscall_arg__scnprintf_hex 73#define SCA_HEX syscall_arg__scnprintf_hex
74 74
75static size_t syscall_arg__scnprintf_whence(char *bf, size_t size,
76 struct syscall_arg *arg)
77{
78 int whence = arg->val;
79
80 switch (whence) {
81#define P_WHENCE(n) case SEEK_##n: return scnprintf(bf, size, #n)
82 P_WHENCE(SET);
83 P_WHENCE(CUR);
84 P_WHENCE(END);
85#ifdef SEEK_DATA
86 P_WHENCE(DATA);
87#endif
88#ifdef SEEK_HOLE
89 P_WHENCE(HOLE);
90#endif
91#undef P_WHENCE
92 default: break;
93 }
94
95 return scnprintf(bf, size, "%#x", whence);
96}
97
98#define SCA_WHENCE syscall_arg__scnprintf_whence
99
100static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, 75static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
101 struct syscall_arg *arg) 76 struct syscall_arg *arg)
102{ 77{
@@ -254,10 +229,20 @@ static size_t syscall_arg__scnprintf_futex_op(char *bf, size_t size, struct sysc
254 return printed; 229 return printed;
255} 230}
256 231
232#define SCA_FUTEX_OP syscall_arg__scnprintf_futex_op
233
257static const char *itimers[] = { "REAL", "VIRTUAL", "PROF", }; 234static const char *itimers[] = { "REAL", "VIRTUAL", "PROF", };
258static DEFINE_STRARRAY(itimers); 235static DEFINE_STRARRAY(itimers);
259 236
260#define SCA_FUTEX_OP syscall_arg__scnprintf_futex_op 237static const char *whences[] = { "SET", "CUR", "END",
238#ifdef SEEK_DATA
239"DATA",
240#endif
241#ifdef SEEK_HOLE
242"HOLE",
243#endif
244};
245static DEFINE_STRARRAY(whences);
261 246
262static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, 247static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size,
263 struct syscall_arg *arg) 248 struct syscall_arg *arg)
@@ -340,7 +325,8 @@ static struct syscall_fmt {
340 { .name = "ioctl", .errmsg = true, 325 { .name = "ioctl", .errmsg = true,
341 .arg_scnprintf = { [2] = SCA_HEX, /* arg */ }, }, 326 .arg_scnprintf = { [2] = SCA_HEX, /* arg */ }, },
342 { .name = "lseek", .errmsg = true, 327 { .name = "lseek", .errmsg = true,
343 .arg_scnprintf = { [2] = SCA_WHENCE, /* whence */ }, }, 328 .arg_scnprintf = { [2] = SCA_STRARRAY, /* whence */ },
329 .arg_parm = { [2] = &strarray__whences, /* whence */ }, },
344 { .name = "lstat", .errmsg = true, .alias = "newlstat", }, 330 { .name = "lstat", .errmsg = true, .alias = "newlstat", },
345 { .name = "madvise", .errmsg = true, 331 { .name = "madvise", .errmsg = true,
346 .arg_scnprintf = { [0] = SCA_HEX, /* start */ 332 .arg_scnprintf = { [0] = SCA_HEX, /* start */