From 481e067836beff266969b60d4e0f33a8a6d4543a Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 6 Dec 2014 03:53:16 +0000 Subject: [PATCH] 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. --- Makefile.am | 1 + file.c | 61 ---------------------------------------------------- utimes.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 61 deletions(-) create mode 100644 utimes.c diff --git a/Makefile.am b/Makefile.am index ae535d42..5452d00b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,6 +73,7 @@ strace_SOURCES = \ umount.c \ util.c \ utime.c \ + utimes.c \ v4l2.c \ vsprintf.c \ xattr.c diff --git a/file.c b/file.c index 502eb524..95b2c32a 100644 --- a/file.c +++ b/file.c @@ -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; -} diff --git a/utimes.c b/utimes.c new file mode 100644 index 00000000..40f9566f --- /dev/null +++ b/utimes.c @@ -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 */ -- 2.40.0