summaryrefslogtreecommitdiff
path: root/desc.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-02-04 00:04:57 +0100
committerDmitry V. Levin <ldv@altlinux.org>2013-02-05 23:15:14 +0000
commit88eafd81ab061ff217c0b56f02b07c16cbd29ff4 (patch)
treebead52005e21685a2458778e3c1fd98d11c31e59 /desc.c
parentaf8dc6b3a562193c27c89531e7ac6d94e7c3c322 (diff)
downloadstrace-88eafd81ab061ff217c0b56f02b07c16cbd29ff4.tar.gz
Improve perf_event_open argument decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/perf_event.h. * desc.c [HAVE_LINUX_PERF_EVENT_H]: Include <linux/perf_event.h>. (perf_event_open_flags): New xlat structure. (sys_perf_event_open): New function. * linux/dummy.h (sys_perf_event_open): Remove. * linux/syscall.h (sys_perf_event_open): New prototype. Signed-off-by: Ben Noordhuis <info@bnoordhuis.nl> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'desc.c')
-rw-r--r--desc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/desc.c b/desc.c
index f0c189034..e75ed4f3b 100644
--- a/desc.c
+++ b/desc.c
@@ -37,6 +37,9 @@
#ifdef HAVE_LIBAIO_H
# include <libaio.h>
#endif
+#ifdef HAVE_LINUX_PERF_EVENT_H
+# include <linux/perf_event.h>
+#endif
#if HAVE_LONG_LONG_OFF_T
/*
@@ -222,6 +225,19 @@ static const struct xlat whence[] = {
{ 0, NULL },
};
+static const struct xlat perf_event_open_flags[] = {
+#ifdef PERF_FLAG_FD_NO_GROUP
+ { PERF_FLAG_FD_NO_GROUP, "PERF_FLAG_FD_NO_GROUP" },
+#endif
+#ifdef PERF_FLAG_FD_OUTPUT
+ { PERF_FLAG_FD_OUTPUT, "PERF_FLAG_FD_OUTPUT" },
+#endif
+#ifdef PERF_FLAG_PID_CGROUP
+ { PERF_FLAG_PID_CGROUP, "PERF_FLAG_PID_CGROUP" },
+#endif
+ { 0, NULL },
+};
+
#ifndef HAVE_LONG_LONG_OFF_T
/* fcntl/lockf */
static void
@@ -1068,3 +1084,18 @@ sys_eventfd2(struct tcb *tcp)
{
return do_eventfd(tcp, 1);
}
+
+int
+sys_perf_event_open(struct tcb *tcp)
+{
+ if (entering(tcp)) {
+ tprintf("%#lx, %d, %d, %d, ",
+ tcp->u_arg[0],
+ (int) tcp->u_arg[1],
+ (int) tcp->u_arg[2],
+ (int) tcp->u_arg[3]);
+ printflags(perf_event_open_flags, tcp->u_arg[4],
+ "PERF_FLAG_???");
+ }
+ return 0;
+}