tools/testing/selftests/net/packetdrill/tcp_sendfile_sendfile-simple.pkt

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/packetdrill/tcp_sendfile_sendfile-simple.pkt

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/packetdrill/tcp_sendfile_sendfile-simple.pkt
Extension
.pkt
Size
872 bytes
Lines
27
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// Simplest possible test of open() and then sendfile().
// We write some zeroes into a file (since packetdrill expects payloads
// to be all zeroes) and then open() the file, then use sendfile()
// and verify that the correct number of zeroes goes out.

`./defaults.sh
/bin/rm -f /tmp/testfile
/bin/dd bs=1 count=5 if=/dev/zero of=/tmp/testfile status=none
`

// Initialize connection
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
   +0 < . 1:1(0) ack 1 win 514

   +0 accept(3, ..., ...) = 4

   +0 open("/tmp/testfile", O_RDONLY) = 5
   +0 sendfile(4, 5, [0], 5) = 5
   +0 > P. 1:6(5) ack 1

Annotation

Implementation Notes