process.c: move getcpu parser to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 21:40:40 +0000 (21:40 +0000)
* getcpu.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getcpu): Move to getcpu.c.

Makefile.am
getcpu.c [new file with mode: 0644]
process.c

index b6503ed958a43990988dfdfb5d037ef75e5318a3..cd097a45fec102cf5910dcccb0e2013e1f9b0c17 100644 (file)
@@ -33,6 +33,7 @@ strace_SOURCES =      \
        fallocate.c     \
        fanotify.c      \
        file.c          \
+       getcpu.c        \
        getcwd.c        \
        inotify.c       \
        io.c            \
diff --git a/getcpu.c b/getcpu.c
new file mode 100644 (file)
index 0000000..522786f
--- /dev/null
+++ b/getcpu.c
@@ -0,0 +1,23 @@
+#include "defs.h"
+
+int
+sys_getcpu(struct tcb *tcp)
+{
+       if (exiting(tcp)) {
+               unsigned u;
+               if (tcp->u_arg[0] == 0)
+                       tprints("NULL, ");
+               else if (umove(tcp, tcp->u_arg[0], &u) < 0)
+                       tprintf("%#lx, ", tcp->u_arg[0]);
+               else
+                       tprintf("[%u], ", u);
+               if (tcp->u_arg[1] == 0)
+                       tprints("NULL, ");
+               else if (umove(tcp, tcp->u_arg[1], &u) < 0)
+                       tprintf("%#lx, ", tcp->u_arg[1]);
+               else
+                       tprintf("[%u], ", u);
+               tprintf("%#lx", tcp->u_arg[2]);
+       }
+       return 0;
+}
index ede4224bd6a460f710b184efc207b3446df9d332..648d9ba213ad09e579ae5cd78f13b165a6837036 100644 (file)
--- a/process.c
+++ b/process.c
@@ -2510,25 +2510,3 @@ sys_arch_prctl(struct tcb *tcp)
        return 0;
 }
 #endif /* X86_64 || X32 */
-
-int
-sys_getcpu(struct tcb *tcp)
-{
-       if (exiting(tcp)) {
-               unsigned u;
-               if (tcp->u_arg[0] == 0)
-                       tprints("NULL, ");
-               else if (umove(tcp, tcp->u_arg[0], &u) < 0)
-                       tprintf("%#lx, ", tcp->u_arg[0]);
-               else
-                       tprintf("[%u], ", u);
-               if (tcp->u_arg[1] == 0)
-                       tprints("NULL, ");
-               else if (umove(tcp, tcp->u_arg[1], &u) < 0)
-                       tprintf("%#lx, ", tcp->u_arg[1]);
-               else
-                       tprintf("[%u], ", u);
-               tprintf("%#lx", tcp->u_arg[2]);
-       }
-       return 0;
-}