file.c: move chmod, fchmod, and fchmodat 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:39:25 +0000 (21:39 +0000)
* chmod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.

Makefile.am
chmod.c [new file with mode: 0644]
file.c

index 5452d00ba88d3cd9a1fb89f60c536122ff10349f..664475e78cdf3b231142ff812f99180830ad5e7e 100644 (file)
@@ -22,6 +22,7 @@ strace_SOURCES =      \
        block.c         \
        cacheflush.c    \
        capability.c    \
+       chmod.c         \
        count.c         \
        desc.c          \
        dirent.c        \
diff --git a/chmod.c b/chmod.c
new file mode 100644 (file)
index 0000000..89453a9
--- /dev/null
+++ b/chmod.c
@@ -0,0 +1,35 @@
+#include "defs.h"
+
+static int
+decode_chmod(struct tcb *tcp, int offset)
+{
+       if (entering(tcp)) {
+               printpath(tcp, tcp->u_arg[offset]);
+               tprintf(", %#lo", tcp->u_arg[offset + 1]);
+       }
+       return 0;
+}
+
+int
+sys_chmod(struct tcb *tcp)
+{
+       return decode_chmod(tcp, 0);
+}
+
+int
+sys_fchmodat(struct tcb *tcp)
+{
+       if (entering(tcp))
+               print_dirfd(tcp, tcp->u_arg[0]);
+       return decode_chmod(tcp, 1);
+}
+
+int
+sys_fchmod(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               printfd(tcp, tcp->u_arg[0]);
+               tprintf(", %#lo", tcp->u_arg[1]);
+       }
+       return 0;
+}
diff --git a/file.c b/file.c
index 95b2c32a96fb4385ec1931ba842abcb0c79c0214..dabd729823264ac5464d3ee728b2bff9752fcfd7 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1424,37 +1424,3 @@ sys_fchown(struct tcb *tcp)
        }
        return 0;
 }
-
-static int
-decode_chmod(struct tcb *tcp, int offset)
-{
-       if (entering(tcp)) {
-               printpath(tcp, tcp->u_arg[offset]);
-               tprintf(", %#lo", tcp->u_arg[offset + 1]);
-       }
-       return 0;
-}
-
-int
-sys_chmod(struct tcb *tcp)
-{
-       return decode_chmod(tcp, 0);
-}
-
-int
-sys_fchmodat(struct tcb *tcp)
-{
-       if (entering(tcp))
-               print_dirfd(tcp, tcp->u_arg[0]);
-       return decode_chmod(tcp, 1);
-}
-
-int
-sys_fchmod(struct tcb *tcp)
-{
-       if (entering(tcp)) {
-               printfd(tcp, tcp->u_arg[0]);
-               tprintf(", %#lo", tcp->u_arg[1]);
-       }
-       return 0;
-}