Skip to content

Commit ac2e728

Browse files
committed
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
1 parent d77f669 commit ac2e728

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ strace_SOURCES = \
102102
sched.c \
103103
scsi.c \
104104
seccomp.c \
105+
sendfile.c \
105106
sigaltstack.c \
106107
signal.c \
107108
signalfd.c \

io.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -244,30 +244,6 @@ SYS_FUNC(pwritev)
244244
return RVAL_DECODED;
245245
}
246246

247-
SYS_FUNC(sendfile)
248-
{
249-
printfd(tcp, tcp->u_arg[0]);
250-
tprints(", ");
251-
printfd(tcp, tcp->u_arg[1]);
252-
tprints(", ");
253-
printnum_ulong(tcp, tcp->u_arg[2]);
254-
tprintf(", %lu", tcp->u_arg[3]);
255-
256-
return RVAL_DECODED;
257-
}
258-
259-
SYS_FUNC(sendfile64)
260-
{
261-
printfd(tcp, tcp->u_arg[0]);
262-
tprints(", ");
263-
printfd(tcp, tcp->u_arg[1]);
264-
tprints(", ");
265-
printnum_int64(tcp, tcp->u_arg[2], "%" PRIu64);
266-
tprintf(", %lu", tcp->u_arg[3]);
267-
268-
return RVAL_DECODED;
269-
}
270-
271247
#include "xlat/splice_flags.h"
272248

273249
SYS_FUNC(tee)

sendfile.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2015 Dmitry V. Levin <[email protected]>
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in the
12+
* documentation and/or other materials provided with the distribution.
13+
* 3. The name of the author may not be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
#include "defs.h"
29+
30+
SYS_FUNC(sendfile64)
31+
{
32+
printfd(tcp, tcp->u_arg[0]);
33+
tprints(", ");
34+
printfd(tcp, tcp->u_arg[1]);
35+
tprints(", ");
36+
printnum_int64(tcp, tcp->u_arg[2], "%" PRIu64);
37+
tprintf(", %lu", tcp->u_arg[3]);
38+
39+
return RVAL_DECODED;
40+
}
41+
42+
SYS_FUNC(sendfile)
43+
{
44+
printfd(tcp, tcp->u_arg[0]);
45+
tprints(", ");
46+
printfd(tcp, tcp->u_arg[1]);
47+
tprints(", ");
48+
printnum_ulong(tcp, tcp->u_arg[2]);
49+
tprintf(", %lu", tcp->u_arg[3]);
50+
51+
return RVAL_DECODED;
52+
}

0 commit comments

Comments
 (0)