]> granicus.if.org Git - strace/commitdiff
io.c: move sendfile parsers to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 18 Aug 2015 22:09:30 +0000 (22:09 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 19 Aug 2015 13:36:44 +0000 (13:36 +0000)
* sendfile.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c

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

index 5e9fb1669ffb5afd41b4efd638900e63b444a943..4ceba9d94828a7248151f96ef323168f73aa9456 100644 (file)
@@ -102,6 +102,7 @@ strace_SOURCES =    \
        sched.c         \
        scsi.c          \
        seccomp.c       \
+       sendfile.c      \
        sigaltstack.c   \
        signal.c        \
        signalfd.c      \
diff --git a/io.c b/io.c
index 69198ad7fab47f17f01acc53423ba760f5c0a216..dcc38599b249b1e4359d73b4290747b8a4ded2af 100644 (file)
--- a/io.c
+++ b/io.c
@@ -244,30 +244,6 @@ SYS_FUNC(pwritev)
        return RVAL_DECODED;
 }
 
-SYS_FUNC(sendfile)
-{
-       printfd(tcp, tcp->u_arg[0]);
-       tprints(", ");
-       printfd(tcp, tcp->u_arg[1]);
-       tprints(", ");
-       printnum_ulong(tcp, tcp->u_arg[2]);
-       tprintf(", %lu", tcp->u_arg[3]);
-
-       return RVAL_DECODED;
-}
-
-SYS_FUNC(sendfile64)
-{
-       printfd(tcp, tcp->u_arg[0]);
-       tprints(", ");
-       printfd(tcp, tcp->u_arg[1]);
-       tprints(", ");
-       printnum_int64(tcp, tcp->u_arg[2], "%" PRIu64);
-       tprintf(", %lu", tcp->u_arg[3]);
-
-       return RVAL_DECODED;
-}
-
 #include "xlat/splice_flags.h"
 
 SYS_FUNC(tee)
diff --git a/sendfile.c b/sendfile.c
new file mode 100644 (file)
index 0000000..91c16e2
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+SYS_FUNC(sendfile64)
+{
+       printfd(tcp, tcp->u_arg[0]);
+       tprints(", ");
+       printfd(tcp, tcp->u_arg[1]);
+       tprints(", ");
+       printnum_int64(tcp, tcp->u_arg[2], "%" PRIu64);
+       tprintf(", %lu", tcp->u_arg[3]);
+
+       return RVAL_DECODED;
+}
+
+SYS_FUNC(sendfile)
+{
+       printfd(tcp, tcp->u_arg[0]);
+       tprints(", ");
+       printfd(tcp, tcp->u_arg[1]);
+       tprints(", ");
+       printnum_ulong(tcp, tcp->u_arg[2]);
+       tprintf(", %lu", tcp->u_arg[3]);
+
+       return RVAL_DECODED;
+}