From c6ee0ecb5aa08191ab2809e02486f16ad02deb0e Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 8 Jan 2015 01:14:53 +0000 Subject: [PATCH] file.c: group related parsers together * file.c (sys_stat, sys_fstat): Collect in one place right before the definition of printstat64. (sys_stat64, sys_fstat64): Collect in one place right after the definition of printstat64. --- file.c | 64 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/file.c b/file.c index 8d21da3a..5999a565 100644 --- a/file.c +++ b/file.c @@ -356,6 +356,30 @@ printstat(struct tcb *tcp, long addr) do_printstat(tcp, &statbuf); } +int +sys_stat(struct tcb *tcp) +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprints(", "); + } else { + printstat(tcp, tcp->u_arg[1]); + } + return 0; +} + +int +sys_fstat(struct tcb *tcp) +{ + if (entering(tcp)) { + printfd(tcp, tcp->u_arg[0]); + tprints(", "); + } else { + printstat(tcp, tcp->u_arg[1]); + } + return 0; +} + #if !defined HAVE_STAT64 && (defined AARCH64 || defined X86_64 || defined X32) /* * Linux x86_64 and x32 have unified `struct stat' but their i386 personality @@ -460,23 +484,27 @@ printstat64(struct tcb *tcp, long addr) #endif /* HAVE_STAT64 */ int -sys_stat(struct tcb *tcp) +sys_stat64(struct tcb *tcp) { +#ifdef HAVE_STAT64 if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprints(", "); } else { - printstat(tcp, tcp->u_arg[1]); + printstat64(tcp, tcp->u_arg[1]); } return 0; +#else + return printargs(tcp); +#endif } int -sys_stat64(struct tcb *tcp) +sys_fstat64(struct tcb *tcp) { #ifdef HAVE_STAT64 if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); + printfd(tcp, tcp->u_arg[0]); tprints(", "); } else { printstat64(tcp, tcp->u_arg[1]); @@ -511,34 +539,6 @@ sys_newfstatat(struct tcb *tcp) return 0; } -int -sys_fstat(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - tprints(", "); - } else { - printstat(tcp, tcp->u_arg[1]); - } - return 0; -} - -int -sys_fstat64(struct tcb *tcp) -{ -#ifdef HAVE_STAT64 - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - tprints(", "); - } else { - printstat64(tcp, tcp->u_arg[1]); - } - return 0; -#else - return printargs(tcp); -#endif -} - #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) static void -- 2.40.0