tcp_sendfile_sendfile-simple.pkt 872 B

1234567891011121314151617181920212223242526
  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. `./defaults.sh
  7. /bin/rm -f /tmp/testfile
  8. /bin/dd bs=1 count=5 if=/dev/zero of=/tmp/testfile status=none
  9. `
  10. // Initialize connection
  11. 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
  12. +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  13. +0 bind(3, ..., ...) = 0
  14. +0 listen(3, 1) = 0
  15. +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10>
  16. +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
  17. +0 < . 1:1(0) ack 1 win 514
  18. +0 accept(3, ..., ...) = 4
  19. +0 open("/tmp/testfile", O_RDONLY) = 5
  20. +0 sendfile(4, 5, [0], 5) = 5
  21. +0 > P. 1:6(5) ack 1