resource.c: move times parser to a separate file

* times.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_times): Move to times.c.
This commit is contained in:
Elvira Khabirova 2015-08-03 07:09:34 +03:00 committed by Dmitry V. Levin
parent f1bb6391ea
commit 254ff1e623
3 changed files with 20 additions and 18 deletions

View File

@ -121,6 +121,7 @@ strace_SOURCES = \
sysmips.c \
term.c \
time.c \
times.c \
truncate.c \
uid.c \
uid16.c \

View 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;
}

19
times.c Normal file
View File

@ -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;
}