process.c: move sethostname and gethostname parsers to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 22:52:03 +0000 (22:52 +0000)
* hostname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sethostname, sys_gethostname): Move to hostname.c.

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

index d03d90ca14cb29d5cf4b4c6094b50607fc880ad6..85b7d9980a05c3614c27e9efceb3516def75b848 100644 (file)
@@ -42,6 +42,7 @@ strace_SOURCES =      \
        getcpu.c        \
        getcwd.c        \
        groups.c        \
+       hostname.c      \
        inotify.c       \
        io.c            \
        ioctl.c         \
diff --git a/hostname.c b/hostname.c
new file mode 100644 (file)
index 0000000..d2e0471
--- /dev/null
@@ -0,0 +1,26 @@
+#include "defs.h"
+
+int
+sys_sethostname(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
+               tprintf(", %lu", tcp->u_arg[1]);
+       }
+       return 0;
+}
+
+#if defined(ALPHA)
+int
+sys_gethostname(struct tcb *tcp)
+{
+       if (exiting(tcp)) {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[0]);
+               else
+                       printstr(tcp, tcp->u_arg[0], -1);
+               tprintf(", %lu", tcp->u_arg[1]);
+       }
+       return 0;
+}
+#endif /* ALPHA */
index 18ac924c786846703ca781ee303baecc481f65b6..817cf9792909ebfdb1054ed461453a27945d01c2 100644 (file)
--- a/process.c
+++ b/process.c
 # include <asm/rse.h>
 #endif
 
-int
-sys_sethostname(struct tcb *tcp)
-{
-       if (entering(tcp)) {
-               printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
-               tprintf(", %lu", tcp->u_arg[1]);
-       }
-       return 0;
-}
-
-#if defined(ALPHA)
-int
-sys_gethostname(struct tcb *tcp)
-{
-       if (exiting(tcp)) {
-               if (syserror(tcp))
-                       tprintf("%#lx", tcp->u_arg[0]);
-               else
-                       printstr(tcp, tcp->u_arg[0], -1);
-               tprintf(", %lu", tcp->u_arg[1]);
-       }
-       return 0;
-}
-#endif
-
 #include "xlat/ptrace_cmds.h"
 #include "xlat/ptrace_setoptions_flags.h"
 #include "xlat/nt_descriptor_types.h"