tools/testing/selftests/net/msg_zerocopy.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/msg_zerocopy.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/msg_zerocopy.sh- Extension
.sh- Size
- 4318 bytes
- Lines
- 162
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
#
# Send data between two processes across namespaces
# Run twice: once without and once with zerocopy
set -e
readonly DEV="veth0"
readonly DUMMY_DEV="dummy0"
readonly DEV_MTU=65535
readonly BIN="./msg_zerocopy"
readonly RAND="$(mktemp -u XXXXXX)"
readonly NSPREFIX="ns-${RAND}"
readonly NS1="${NSPREFIX}1"
readonly NS2="${NSPREFIX}2"
readonly LPREFIX4='192.168.1'
readonly RPREFIX4='192.168.2'
readonly LPREFIX6='fd'
readonly RPREFIX6='fc'
readonly path_sysctl_mem="net.core.optmem_max"
# No arguments: automated test
if [[ "$#" -eq "0" ]]; then
ret=0
$0 4 tcp -t 1 || ret=1
$0 6 tcp -t 1 || ret=1
$0 4 udp -t 1 || ret=1
$0 6 udp -t 1 || ret=1
[[ "$ret" == "0" ]] && echo "OK. All tests passed"
exit $ret
fi
# Argument parsing
if [[ "$#" -lt "2" ]]; then
echo "Usage: $0 [4|6] [tcp|udp|raw|raw_hdrincl|packet|packet_dgram] <args>"
exit 1
fi
readonly IP="$1"
shift
readonly TXMODE="$1"
shift
readonly EXTRA_ARGS="$@"
# Argument parsing: configure addresses
if [[ "${IP}" == "4" ]]; then
readonly SADDR="${LPREFIX4}.1"
readonly DADDR="${LPREFIX4}.2"
readonly DUMMY_ADDR="${RPREFIX4}.1"
readonly DADDR_TXONLY="${RPREFIX4}.2"
readonly MASK="24"
elif [[ "${IP}" == "6" ]]; then
readonly SADDR="${LPREFIX6}::1"
readonly DADDR="${LPREFIX6}::2"
readonly DUMMY_ADDR="${RPREFIX6}::1"
readonly DADDR_TXONLY="${RPREFIX6}::2"
readonly MASK="64"
readonly NODAD="nodad"
else
echo "Invalid IP version ${IP}"
exit 1
fi
# Argument parsing: select receive mode
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.