process.c: move getcpu parser to a separate file

* getcpu.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getcpu): Move to getcpu.c.
This commit is contained in:
Дмитрий Левин 2014-12-11 19:21:54 +00:00
parent db16c52668
commit 665f10c9a4
3 changed files with 24 additions and 22 deletions

View File

@ -33,6 +33,7 @@ strace_SOURCES = \
fallocate.c \
fanotify.c \
file.c \
getcpu.c \
getcwd.c \
inotify.c \
io.c \

23
getcpu.c Normal file
View File

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

View File

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