1// SPDX-License-Identifier: GPL-2.0 2// Simplest possible test of open() and then sendfile(). 3// We write some zeroes into a file (since packetdrill expects payloads 4// to be all zeroes) and then open() the file, then use sendfile() 5// and verify that the correct number of zeroes goes out. 6 7`./defaults.sh 8/bin/rm -f /tmp/testfile 9/bin/dd bs=1 count=5 if=/dev/zero of=/tmp/testfile status=none 10` 11 12// Initialize connection 13 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 14 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 15 +0 bind(3, ..., ...) = 0 16 +0 listen(3, 1) = 0 17 18 +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10> 19 +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> 20 +0 < . 1:1(0) ack 1 win 514 21 22 +0 accept(3, ..., ...) = 4 23 24 +0 open("/tmp/testfile", O_RDONLY) = 5 25 +0 sendfile(4, 5, [0], 5) = 5 26 +0 > P. 1:6(5) ack 1 27