tools/testing/selftests/ptrace/get_set_sud.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ptrace/get_set_sud.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ptrace/get_set_sud.c- Extension
.c- Size
- 1614 bytes
- Lines
- 73
- 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
kselftest_harness.hstdio.hstring.herrno.hsys/wait.hsys/syscall.hsys/prctl.hlinux/ptrace.h
Detected Declarations
function sys_ptracefunction ASSERT_EQ
Annotated Snippet
ASSERT_EQ(0, sys_ptrace(PTRACE_TRACEME, 0, 0, 0)) {
TH_LOG("PTRACE_TRACEME: %m");
}
kill(getpid(), SIGSTOP);
_exit(1);
}
waitpid(child, &status, 0);
memset(&config, 0xff, sizeof(config));
config.mode = PR_SYS_DISPATCH_ON;
ret = sys_ptrace(PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG, child,
(void *)sizeof(config), &config);
ASSERT_EQ(ret, 0);
ASSERT_EQ(config.mode, PR_SYS_DISPATCH_OFF);
ASSERT_EQ(config.selector, 0);
ASSERT_EQ(config.offset, 0);
ASSERT_EQ(config.len, 0);
config.mode = PR_SYS_DISPATCH_ON;
config.selector = 0;
config.offset = 0x400000;
config.len = 0x1000;
ret = sys_ptrace(PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG, child,
(void *)sizeof(config), &config);
ASSERT_EQ(ret, 0);
memset(&config, 1, sizeof(config));
ret = sys_ptrace(PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG, child,
(void *)sizeof(config), &config);
ASSERT_EQ(ret, 0);
ASSERT_EQ(config.mode, PR_SYS_DISPATCH_ON);
ASSERT_EQ(config.selector, 0);
ASSERT_EQ(config.offset, 0x400000);
ASSERT_EQ(config.len, 0x1000);
kill(child, SIGKILL);
}
TEST_HARNESS_MAIN
Annotation
- Immediate include surface: `kselftest_harness.h`, `stdio.h`, `string.h`, `errno.h`, `sys/wait.h`, `sys/syscall.h`, `sys/prctl.h`, `linux/ptrace.h`.
- Detected declarations: `function sys_ptrace`, `function ASSERT_EQ`.
- 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.