From: Dmitry V. Levin Date: Tue, 18 Aug 2015 22:09:30 +0000 (+0000) Subject: io.c: move sendfile parsers to a separate file X-Git-Tag: v4.11~268 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac2e728a6e3f6e7989db49b4daddca3cdab59780;p=strace io.c: move sendfile parsers to a separate file * sendfile.c: New file. * Makefile.am (strace_SOURCES): Add it. * io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c --- diff --git a/Makefile.am b/Makefile.am index 5e9fb166..4ceba9d9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 69198ad7..dcc38599 100644 --- 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 index 00000000..91c16e2a --- /dev/null +++ b/sendfile.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015 Dmitry V. Levin + * 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; +}