file.c: move getcwd parser to a separate file

* getcwd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_getcwd): Move to getcwd.c.
This commit is contained in:
Дмитрий Левин 2014-12-06 03:53:16 +00:00
parent 769ffe9797
commit a836430dbb
3 changed files with 15 additions and 13 deletions

View File

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

13
file.c
View File

@ -1668,16 +1668,3 @@ sys_mknodat(struct tcb *tcp)
print_dirfd(tcp, tcp->u_arg[0]);
return decode_mknod(tcp, 1);
}
int
sys_getcwd(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}

14
getcwd.c Normal file
View File

@ -0,0 +1,14 @@
#include "defs.h"
int
sys_getcwd(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}