tools/testing/selftests/bpf/prog_tests/signal_pending.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/signal_pending.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/signal_pending.c- Extension
.c- Size
- 1314 bytes
- Lines
- 51
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hnetwork_helpers.h
Detected Declarations
function sigalrm_handlerfunction test_signal_pending_by_typefunction test_signal_pending
Annotated Snippet
static void sigalrm_handler(int s) {}
static struct sigaction sigalrm_action = {
.sa_handler = sigalrm_handler,
};
static void test_signal_pending_by_type(enum bpf_prog_type prog_type)
{
struct bpf_insn prog[4096];
struct itimerval timeo = {
.it_value.tv_usec = 100000, /* 100ms */
};
int prog_fd;
int err;
int i;
LIBBPF_OPTS(bpf_test_run_opts, topts,
.data_in = &pkt_v4,
.data_size_in = sizeof(pkt_v4),
.repeat = 0xffffffff,
);
for (i = 0; i < ARRAY_SIZE(prog); i++)
prog[i] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 0);
prog[ARRAY_SIZE(prog) - 1] = BPF_EXIT_INSN();
prog_fd = bpf_test_load_program(prog_type, prog, ARRAY_SIZE(prog),
"GPL", 0, NULL, 0);
ASSERT_GE(prog_fd, 0, "test-run load");
err = sigaction(SIGALRM, &sigalrm_action, NULL);
ASSERT_OK(err, "test-run-signal-sigaction");
err = setitimer(ITIMER_REAL, &timeo, NULL);
ASSERT_OK(err, "test-run-signal-timer");
err = bpf_prog_test_run_opts(prog_fd, &topts);
ASSERT_LE(topts.duration, 500000000 /* 500ms */,
"test-run-signal-duration");
signal(SIGALRM, SIG_DFL);
}
void test_signal_pending(void)
{
test_signal_pending_by_type(BPF_PROG_TYPE_SOCKET_FILTER);
test_signal_pending_by_type(BPF_PROG_TYPE_FLOW_DISSECTOR);
}
Annotation
- Immediate include surface: `test_progs.h`, `network_helpers.h`.
- Detected declarations: `function sigalrm_handler`, `function test_signal_pending_by_type`, `function test_signal_pending`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.