tools/testing/selftests/clone3/clone3_selftests.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/clone3/clone3_selftests.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/clone3/clone3_selftests.h- Extension
.h- Size
- 1434 bytes
- Lines
- 70
- 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
sched.hlinux/sched.hlinux/types.hstdint.hsyscall.hsys/wait.hkselftest.h
Detected Declarations
struct __clone_argsfunction sys_clone3function test_clone3_supported
Annotated Snippet
struct __clone_args {
__aligned_u64 flags;
__aligned_u64 pidfd;
__aligned_u64 child_tid;
__aligned_u64 parent_tid;
__aligned_u64 exit_signal;
__aligned_u64 stack;
__aligned_u64 stack_size;
__aligned_u64 tls;
__aligned_u64 set_tid;
__aligned_u64 set_tid_size;
__aligned_u64 cgroup;
};
static pid_t sys_clone3(struct __clone_args *args, size_t size)
{
fflush(stdout);
fflush(stderr);
return syscall(__NR_clone3, args, size);
}
static inline void test_clone3_supported(void)
{
pid_t pid;
struct __clone_args args = {};
if (__NR_clone3 < 0)
ksft_exit_skip("clone3() syscall is not supported\n");
/* Set to something that will always cause EINVAL. */
args.exit_signal = -1;
pid = sys_clone3(&args, sizeof(args));
if (!pid)
exit(EXIT_SUCCESS);
if (pid > 0) {
wait(NULL);
ksft_exit_fail_msg(
"Managed to create child process with invalid exit_signal\n");
}
if (errno == ENOSYS)
ksft_exit_skip("clone3() syscall is not supported\n");
ksft_print_msg("clone3() syscall supported\n");
}
#endif /* _CLONE3_SELFTESTS_H */
Annotation
- Immediate include surface: `sched.h`, `linux/sched.h`, `linux/types.h`, `stdint.h`, `syscall.h`, `sys/wait.h`, `kselftest.h`.
- Detected declarations: `struct __clone_args`, `function sys_clone3`, `function test_clone3_supported`.
- 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.