resource.c: move times parser to a separate file
authorElvira Khabirova <lineprinter0@gmail.com>
Mon, 3 Aug 2015 04:09:34 +0000 (07:09 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 16 Aug 2015 10:05:19 +0000 (10:05 +0000)
* times.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_times): Move to times.c.

Makefile.am
resource.c
times.c [new file with mode: 0644]

index ff05a2505aacb0ecd29e9d4778b1a6a5d6db3230..5e9fb1669ffb5afd41b4efd638900e63b444a943 100644 (file)
@@ -121,6 +121,7 @@ strace_SOURCES =    \
        sysmips.c       \
        term.c          \
        time.c          \
+       times.c         \
        truncate.c      \
        uid.c           \
        uid16.c         \
index 39f2e99d4574c3994640cd2b260214d59167ac5f..c68f0456e51eba102b6ea7a4eaab699034075fbc 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "defs.h"
 #include <sys/resource.h>
-#include <sys/times.h>
 
 #include "xlat/resources.h"
 
@@ -197,20 +196,3 @@ SYS_FUNC(setpriority)
 
        return RVAL_DECODED;
 }
-
-SYS_FUNC(times)
-{
-       struct tms tbuf;
-
-       if (exiting(tcp)) {
-               if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
-                       tprintf("{tms_utime=%llu, tms_stime=%llu, ",
-                               (unsigned long long) tbuf.tms_utime,
-                               (unsigned long long) tbuf.tms_stime);
-                       tprintf("tms_cutime=%llu, tms_cstime=%llu}",
-                               (unsigned long long) tbuf.tms_cutime,
-                               (unsigned long long) tbuf.tms_cstime);
-               }
-       }
-       return 0;
-}
diff --git a/times.c b/times.c
new file mode 100644 (file)
index 0000000..0301c9f
--- /dev/null
+++ b/times.c
@@ -0,0 +1,19 @@
+#include "defs.h"
+#include <sys/times.h>
+
+SYS_FUNC(times)
+{
+       struct tms tbuf;
+
+       if (exiting(tcp)) {
+               if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
+                       tprintf("{tms_utime=%llu, tms_stime=%llu, ",
+                               (unsigned long long) tbuf.tms_utime,
+                               (unsigned long long) tbuf.tms_stime);
+                       tprintf("tms_cutime=%llu, tms_cstime=%llu}",
+                               (unsigned long long) tbuf.tms_cutime,
+                               (unsigned long long) tbuf.tms_cstime);
+               }
+       }
+       return 0;
+}