tools/testing/selftests/arm64/fp/za-fork.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/arm64/fp/za-fork.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/arm64/fp/za-fork.c- Extension
.c- Size
- 2024 bytes
- Lines
- 101
- 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.
Dependency Surface
linux/sched.hlinux/wait.hkselftest.h
Detected Declarations
function fork_testfunction main
Annotated Snippet
if (!verify_fork()) {
ksft_print_msg("ZA state invalid in child\n");
exit(0);
} else {
exit(1);
}
}
if (newpid < 0) {
ksft_print_msg("fork() failed: %d\n", newpid);
return 0;
}
parent_result = verify_fork();
if (!parent_result)
ksft_print_msg("ZA state invalid in parent\n");
for (;;) {
waiting = waitpid(newpid, &child_status, 0);
if (waiting < 0) {
if (errno == EINTR)
continue;
ksft_print_msg("waitpid() failed: %d\n", errno);
return 0;
}
if (waiting != newpid) {
ksft_print_msg("waitpid() returned wrong PID\n");
return 0;
}
if (!WIFEXITED(child_status)) {
ksft_print_msg("child did not exit\n");
return 0;
}
return WEXITSTATUS(child_status) && parent_result;
}
}
int main(int argc, char **argv)
{
int ret, i;
ksft_print_header();
ksft_set_plan(EXPECTED_TESTS);
ksft_print_msg("PID: %d\n", getpid());
/*
* This test is run with nolibc which doesn't support hwcap and
* it's probably disproportionate to implement so instead check
* for the default vector length configuration in /proc.
*/
ret = open("/proc/sys/abi/sme_default_vector_length", O_RDONLY, 0);
if (ret >= 0) {
ksft_test_result(fork_test(), "fork_test\n");
} else {
ksft_print_msg("SME not supported\n");
for (i = 0; i < EXPECTED_TESTS; i++) {
ksft_test_result_skip("fork_test\n");
}
}
ksft_finished();
return 0;
}
Annotation
- Immediate include surface: `linux/sched.h`, `linux/wait.h`, `kselftest.h`.
- Detected declarations: `function fork_test`, `function main`.
- 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.