| applyTo | tools/** |
|---|
Tools run in mission-critical environments as root — correctness and safety are mandatory.
- BPF C code: MUST NULL-check every `map.lookup(&key)` result before dereferencing. - New tools MUST include man page (`man/man8/`) with an **OVERHEAD** section.The global rules in
copilot-instructions.mdapply (NULL checks, bounds checks, 512-byte stack limit, 80-char output width). The rules below are additional requirements specific to this subsystem.
- Map lookup: use
table[key]withtry/except KeyError, ortable.get(key)— check result is notNonebefore use - BPF C macro
map.lookup(&key)returns a pointer — NULL means key not found; always guard before dereference - Prefer map-based aggregation over per-event output for high-frequency events; filter in BPF, not Python
man/man8/toolname.8— with an OVERHEAD sectiontools/toolname_example.txt— example outputREADME.md— entry addedtests/python/test_tools_smoke.py— smoke test entry
- Use
BPF.kernel_struct_has_field()for runtime struct field detection — never hard-code kernel version numbers - New options must not break existing default behavior