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.
diff --git a/Makefile.am b/Makefile.am
index 79f9b1b..06a18bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,7 @@
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 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 9e90e5a..ad85ef0 100644
--- a/file.c
+++ b/file.c
@@ -329,33 +329,6 @@
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)