file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file

* utimes.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
sys_osf_utimes): Move to utimes.c.
This commit is contained in:
Дмитрий Левин 2014-12-06 03:53:16 +00:00
parent fb470f350e
commit 481e067836
3 changed files with 63 additions and 61 deletions

View File

@ -73,6 +73,7 @@ strace_SOURCES = \
umount.c \
util.c \
utime.c \
utimes.c \
v4l2.c \
vsprintf.c \
xattr.c

61
file.c
View File

@ -1458,64 +1458,3 @@ sys_fchmod(struct tcb *tcp)
}
return 0;
}
#ifdef ALPHA
int
sys_osf_utimes(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
}
return 0;
}
#endif
static int
decode_utimes(struct tcb *tcp, int offset, int special)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
if (tcp->u_arg[offset + 1] == 0)
tprints("NULL");
else {
tprints("{");
printtv_bitness(tcp, tcp->u_arg[offset + 1],
BITNESS_CURRENT, special);
tprints(", ");
printtv_bitness(tcp, tcp->u_arg[offset + 1]
+ sizeof(struct timeval),
BITNESS_CURRENT, special);
tprints("}");
}
}
return 0;
}
int
sys_utimes(struct tcb *tcp)
{
return decode_utimes(tcp, 0, 0);
}
int
sys_futimesat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_utimes(tcp, 1, 0);
}
int
sys_utimensat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
decode_utimes(tcp, 1, 1);
tprints(", ");
printflags(at_flags, tcp->u_arg[3], "AT_???");
}
return 0;
}

62
utimes.c Normal file
View File

@ -0,0 +1,62 @@
#include "defs.h"
static int
decode_utimes(struct tcb *tcp, int offset, int special)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
if (tcp->u_arg[offset + 1] == 0)
tprints("NULL");
else {
tprints("{");
printtv_bitness(tcp, tcp->u_arg[offset + 1],
BITNESS_CURRENT, special);
tprints(", ");
printtv_bitness(tcp, tcp->u_arg[offset + 1]
+ sizeof(struct timeval),
BITNESS_CURRENT, special);
tprints("}");
}
}
return 0;
}
int
sys_utimes(struct tcb *tcp)
{
return decode_utimes(tcp, 0, 0);
}
int
sys_futimesat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_utimes(tcp, 1, 0);
}
int
sys_utimensat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
decode_utimes(tcp, 1, 1);
tprints(", ");
printflags(at_flags, tcp->u_arg[3], "AT_???");
}
return 0;
}
#ifdef ALPHA
int
sys_osf_utimes(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
}
return 0;
}
#endif /* ALPHA */