file.c: move access and faccessat parsers to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 21:40:17 +0000 (21:40 +0000)
* 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
access.c [new file with mode: 0644]
file.c

index 79f9b1bec834de2a5390f415080cb50c149dbdf6..06a18bde7e6a263a52dffe3f19a199444155a6ea 100644 (file)
@@ -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 (file)
index 0000000..f28f69d
--- /dev/null
+++ b/access.c
@@ -0,0 +1,30 @@
+#include "defs.h"
+
+#include <fcntl.h>
+
+#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 9e90e5a6ffa2b2cb2f717031ec18a007c1f54ca9..ad85ef00d23460e0fdbcc5f60ea42681a12d4f8f 100644 (file)
--- 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)