tools/perf/tests/wp.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/wp.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/wp.c- Extension
.c- Size
- 5094 bytes
- Lines
- 215
- 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
stdlib.hstring.hunistd.herrno.hsys/ioctl.hlinux/compiler.hlinux/hw_breakpoint.hlinux/kernel.htests.hdebug.hevent.hcloexec.h../perf-sys.h
Detected Declarations
function wp_readfunction get__perf_event_attrfunction __eventfunction test__wp_rofunction test__wp_wofunction test__wp_rwfunction test__wp_modify
Annotated Snippet
if (errno == ENOTTY) {
test->test_cases[subtest].skip_reason = "missing kernel support";
ret = TEST_SKIP;
}
pr_debug("ioctl(PERF_EVENT_IOC_MODIFY_ATTRIBUTES) failed\n");
close(fd);
return ret;
}
data2[1] = tmp; /* Not Counted */
WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1);
/* Enable the event */
ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
if (ret < 0) {
pr_debug("Failed to enable event\n");
close(fd);
return ret;
}
data2[1] = tmp; /* Counted */
WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2);
data2[2] = tmp; /* Not Counted */
WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2);
close(fd);
return 0;
#endif
}
static struct test_case wp_tests[] = {
TEST_CASE_REASON("Read Only Watchpoint", wp_ro, "missing hardware support"),
TEST_CASE_REASON("Write Only Watchpoint", wp_wo, "missing hardware support"),
TEST_CASE_REASON("Read / Write Watchpoint", wp_rw, "missing hardware support"),
TEST_CASE_REASON("Modify Watchpoint", wp_modify, "missing hardware support"),
{ .name = NULL, }
};
struct test_suite suite__wp = {
.desc = "Watchpoint",
.test_cases = wp_tests,
};
Annotation
- Immediate include surface: `stdlib.h`, `string.h`, `unistd.h`, `errno.h`, `sys/ioctl.h`, `linux/compiler.h`, `linux/hw_breakpoint.h`, `linux/kernel.h`.
- Detected declarations: `function wp_read`, `function get__perf_event_attr`, `function __event`, `function test__wp_ro`, `function test__wp_wo`, `function test__wp_rw`, `function test__wp_modify`.
- 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.