]> granicus.if.org Git - strace/commitdiff
desc.c: move perf_event_open parser to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 1 Aug 2015 20:28:21 +0000 (20:28 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 1 Aug 2015 20:46:37 +0000 (20:46 +0000)
* perf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_perf_event_open): Move to perf.c.

Makefile.am
desc.c
perf.c [new file with mode: 0644]

index 4c8cd544aab02e486cef9adb332ce46afba32260..8326813a57358de7e4c7cf5b04c6f39e45634ee1 100644 (file)
@@ -76,6 +76,7 @@ strace_SOURCES =      \
        open.c          \
        or1k_atomic.c   \
        pathtrace.c     \
+       perf.c          \
        personality.c   \
        poll.c          \
        prctl.c         \
diff --git a/desc.c b/desc.c
index 32327c264db2cf3aba41b2b8e5dfea6b32c1dcdb..8931ca73c6526ea3aa8f1e0fe165d4c60f4bd268 100644 (file)
--- a/desc.c
+++ b/desc.c
 #ifdef HAVE_SYS_EPOLL_H
 # include <sys/epoll.h>
 #endif
-#ifdef HAVE_LINUX_PERF_EVENT_H
-# include  <linux/perf_event.h>
-#endif
 
 #include "xlat/fcntlcmds.h"
 #include "xlat/fdflags.h"
 #include "xlat/flockcmds.h"
 #include "xlat/lockfcmds.h"
 #include "xlat/notifyflags.h"
-#include "xlat/perf_event_open_flags.h"
 
 /*
  * Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined
@@ -605,16 +601,3 @@ SYS_FUNC(eventfd2)
 {
        return do_eventfd(tcp, 1);
 }
-
-SYS_FUNC(perf_event_open)
-{
-       printaddr(tcp->u_arg[0]);
-       tprintf(", %d, %d, %d, ",
-               (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 RVAL_DECODED;
-}
diff --git a/perf.c b/perf.c
new file mode 100644 (file)
index 0000000..60bbd3a
--- /dev/null
+++ b/perf.c
@@ -0,0 +1,19 @@
+#include "defs.h"
+
+#ifdef HAVE_LINUX_PERF_EVENT_H
+# include <linux/perf_event.h>
+#endif
+
+#include "xlat/perf_event_open_flags.h"
+
+SYS_FUNC(perf_event_open)
+{
+       printaddr(tcp->u_arg[0]);
+       tprintf(", %d, %d, %d, ",
+               (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 RVAL_DECODED;
+}