From 6934182f169d53d367fc96a0fb9f3dd96d99834a 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 truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file * truncate.c: New file. * Makefile.am (strace_SOURCES): Add it. * file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64): Move to truncate.c. --- Makefile.am | 1 + file.c | 40 ---------------------------------------- truncate.c | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 40 deletions(-) create mode 100644 truncate.c diff --git a/Makefile.am b/Makefile.am index f068f7e5..97266f05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -76,6 +76,7 @@ strace_SOURCES = \ sysmips.c \ term.c \ time.c \ + truncate.c \ umount.c \ util.c \ utime.c \ diff --git a/file.c b/file.c index 8d0822d9..e318086c 100644 --- a/file.c +++ b/file.c @@ -464,46 +464,6 @@ sys_readahead(struct tcb *tcp) return 0; } -int -sys_truncate(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprintf(", %lu", tcp->u_arg[1]); - } - return 0; -} - -int -sys_truncate64(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - printllval(tcp, ", %llu", 1); - } - return 0; -} - -int -sys_ftruncate(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - tprintf(", %lu", tcp->u_arg[1]); - } - return 0; -} - -int -sys_ftruncate64(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - printllval(tcp, ", %llu", 1); - } - return 0; -} - /* several stats */ #if defined(SPARC) || defined(SPARC64) diff --git a/truncate.c b/truncate.c new file mode 100644 index 00000000..fd1a0db4 --- /dev/null +++ b/truncate.c @@ -0,0 +1,41 @@ +#include "defs.h" + +int +sys_truncate(struct tcb *tcp) +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", %lu", tcp->u_arg[1]); + } + return 0; +} + +int +sys_truncate64(struct tcb *tcp) +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + printllval(tcp, ", %llu", 1); + } + return 0; +} + +int +sys_ftruncate(struct tcb *tcp) +{ + if (entering(tcp)) { + printfd(tcp, tcp->u_arg[0]); + tprintf(", %lu", tcp->u_arg[1]); + } + return 0; +} + +int +sys_ftruncate64(struct tcb *tcp) +{ + if (entering(tcp)) { + printfd(tcp, tcp->u_arg[0]); + printllval(tcp, ", %llu", 1); + } + return 0; +}