From 304cd81e466ff0620825f7e4ea86548da6e0d78b 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 access and faccessat parsers to a separate file * access.c: New file. * Makefile.am (strace_SOURCES): Add it. * file.c: Move sys_access, sys_faccessat and related code to access.c. --- Makefile.am | 1 + access.c | 30 ++++++++++++++++++++++++++++++ file.c | 27 --------------------------- 3 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 access.c diff --git a/Makefile.am b/Makefile.am index 79f9b1be..06a18bde 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,7 @@ AM_CPPFLAGS = -I$(srcdir)/$(OS)/$(ARCH) -I$(srcdir)/$(OS) -I$(builddir)/$(OS) include xlat/Makemodule.am strace_SOURCES = \ + access.c \ aio.c \ bjm.c \ block.c \ diff --git a/access.c b/access.c new file mode 100644 index 00000000..f28f69d7 --- /dev/null +++ b/access.c @@ -0,0 +1,30 @@ +#include "defs.h" + +#include + +#include "xlat/access_flags.h" + +static int +decode_access(struct tcb *tcp, int offset) +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[offset]); + tprints(", "); + printflags(access_flags, tcp->u_arg[offset + 1], "?_OK"); + } + return 0; +} + +int +sys_access(struct tcb *tcp) +{ + return decode_access(tcp, 0); +} + +int +sys_faccessat(struct tcb *tcp) +{ + if (entering(tcp)) + print_dirfd(tcp, tcp->u_arg[0]); + return decode_access(tcp, 1); +} diff --git a/file.c b/file.c index 9e90e5a6..ad85ef00 100644 --- a/file.c +++ b/file.c @@ -329,33 +329,6 @@ sys_creat(struct tcb *tcp) return RVAL_FD; } -#include "xlat/access_flags.h" - -static int -decode_access(struct tcb *tcp, int offset) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[offset]); - tprints(", "); - printflags(access_flags, tcp->u_arg[offset + 1], "?_OK"); - } - return 0; -} - -int -sys_access(struct tcb *tcp) -{ - return decode_access(tcp, 0); -} - -int -sys_faccessat(struct tcb *tcp) -{ - if (entering(tcp)) - print_dirfd(tcp, tcp->u_arg[0]); - return decode_access(tcp, 1); -} - /* several stats */ #if defined(SPARC) || defined(SPARC64) -- 2.40.0