file.c: move renameat and renameat2 parsers to a separate file

* renameat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_renameat, sys_renameat2, and related code
to renameat.c.
This commit is contained in:
Дмитрий Левин 2014-12-06 03:53:16 +00:00
parent 2b7a53bff5
commit 6d20a0b9a3
3 changed files with 34 additions and 32 deletions

View File

@ -54,6 +54,7 @@ strace_SOURCES = \
ptp.c \
quota.c \
reboot.c \
renameat.c \
resource.c \
scsi.c \
signal.c \

32
file.c
View File

@ -1356,35 +1356,3 @@ sys_readlinkat(struct tcb *tcp)
print_dirfd(tcp, tcp->u_arg[0]);
return decode_readlink(tcp, 1);
}
static void
decode_renameat(struct tcb *tcp)
{
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[2]);
printpath(tcp, tcp->u_arg[3]);
}
int
sys_renameat(struct tcb *tcp)
{
if (entering(tcp)) {
decode_renameat(tcp);
}
return 0;
}
#include "xlat/rename_flags.h"
int
sys_renameat2(struct tcb *tcp)
{
if (entering(tcp)) {
decode_renameat(tcp);
tprints(", ");
printflags(rename_flags, tcp->u_arg[4], "RENAME_??");
}
return 0;
}

33
renameat.c Normal file
View File

@ -0,0 +1,33 @@
#include "defs.h"
static void
decode_renameat(struct tcb *tcp)
{
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[2]);
printpath(tcp, tcp->u_arg[3]);
}
int
sys_renameat(struct tcb *tcp)
{
if (entering(tcp)) {
decode_renameat(tcp);
}
return 0;
}
#include "xlat/rename_flags.h"
int
sys_renameat2(struct tcb *tcp)
{
if (entering(tcp)) {
decode_renameat(tcp);
tprints(", ");
printflags(rename_flags, tcp->u_arg[4], "RENAME_??");
}
return 0;
}