tools/testing/selftests/bpf/libarena/selftests/test_spmc.bpf.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/libarena/selftests/test_spmc.bpf.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/libarena/selftests/test_spmc.bpf.c- Extension
.c- Size
- 3052 bytes
- Lines
- 195
- 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
libarena/common.hlibarena/asan.hlibarena/spmc.h
Detected Declarations
function test_spmc_remove_emptyfunction test_spmc_steal_emptyfunction test_spmc_steal_onefunction test_spmc_remove_onefunction test_spmc_remove_manyfunction test_spmc_steal_many
Annotated Snippet
if (ret) {
arena_stderr("%s:%d error %d\n", __func__, __LINE__, ret);
return 1;
}
}
for (i = 0; i < 500 && can_loop; i++) {
ret = spmc_owned_remove(spmc, &newval);
if (ret) {
arena_stderr("%s:%d error %d\n", __func__, __LINE__, ret);
return 1;
}
expected = 500 - 1 - i;
if (newval != expected) {
arena_stderr("%s:%d expected %llu found %llu\n", __func__, __LINE__, expected, newval);
return 1;
}
}
spmc_destroy(spmc);
return 0;
}
SEC("syscall")
int test_spmc_steal_many(void)
{
u64 val, newval;
int ret, i;
struct spmc __arena *spmc = spmc_create();
if (!spmc)
return 1;
for (i = 0; i < 500 && can_loop; i++) {
val = i;
ret = spmc_owned_add(spmc, val);
if (ret) {
arena_stderr("%s:%d error %d\n", __func__, __LINE__, ret);
return 1;
}
}
for (i = 0; i < 500 && can_loop; i++) {
ret = spmc_steal(spmc, &newval);
if (ret) {
arena_stderr("%s:%d error %d\n", __func__, __LINE__, ret);
return 1;
}
if (newval != i) {
arena_stderr("%s:%d expected %d found %llu\n", __func__, __LINE__, i, newval);
return 1;
}
}
spmc_destroy(spmc);
return 0;
}
Annotation
- Immediate include surface: `libarena/common.h`, `libarena/asan.h`, `libarena/spmc.h`.
- Detected declarations: `function test_spmc_remove_empty`, `function test_spmc_steal_empty`, `function test_spmc_steal_one`, `function test_spmc_remove_one`, `function test_spmc_remove_many`, `function test_spmc_steal_many`.
- 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.