tools/testing/selftests/net/skf_net_off.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/skf_net_off.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/skf_net_off.c- Extension
.c- Size
- 5676 bytes
- Lines
- 245
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
arpa/inet.herrno.herror.hfcntl.hgetopt.hlinux/filter.hlinux/if.hlinux/if_packet.hlinux/if_tun.hlinux/ipv6.hnetinet/if_ether.hnetinet/in.hnetinet/ip.hnetinet/ip6.hnetinet/udp.hpoll.hsignal.hstdbool.hstddef.hstdio.hstdlib.hstring.hsys/ioctl.hsys/socket.hsys/poll.hsys/types.hsys/uio.hunistd.h
Detected Declarations
function tun_openfunction sk_set_filterfunction raw_openfunction tun_writefunction raw_readfunction parse_optsfunction main
Annotated Snippet
switch (c) {
case 'f':
cfg_do_filter = true;
printf("bpf filter enabled\n");
break;
case 'F':
cfg_do_frags = true;
printf("napi frags mode enabled\n");
break;
case 'i':
cfg_ifname = optarg;
break;
default:
error(1, 0, "unknown option %c", optopt);
break;
}
}
if (!cfg_ifname)
error(1, 0, "must specify tap interface name (-i)");
}
int main(int argc, char **argv)
{
int fdt, fdr;
parse_opts(argc, argv);
fdr = raw_open();
fdt = tun_open(cfg_ifname);
tun_write(fdt);
raw_read(fdr);
if (close(fdt))
error(1, errno, "close tun");
if (close(fdr))
error(1, errno, "close udp");
fprintf(stderr, "OK\n");
return 0;
}
Annotation
- Immediate include surface: `arpa/inet.h`, `errno.h`, `error.h`, `fcntl.h`, `getopt.h`, `linux/filter.h`, `linux/if.h`, `linux/if_packet.h`.
- Detected declarations: `function tun_open`, `function sk_set_filter`, `function raw_open`, `function tun_write`, `function raw_read`, `function parse_opts`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.