tools/perf/tests/sigtrap.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/sigtrap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/sigtrap.c- Extension
.c- Size
- 7131 bytes
- Lines
- 276
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hstdint.hstdlib.hlinux/hw_breakpoint.hlinux/string.hpthread.hsignal.hsys/ioctl.hsys/syscall.hunistd.hcloexec.hdebug.hevent.htests.h../perf-sys.hbpf/btf.hutil/btf.h
Detected Declarations
function make_event_attrfunction btf__availablefunction btf__exitfunction attr_has_sigtrapfunction kernel_with_sleepable_spinlocksfunction attr_has_sigtrapfunction kernel_with_sleepable_spinlocksfunction btf__exitfunction run_test_threadsfunction run_stress_testfunction test__sigtrap
Annotated Snippet
if (attr_has_sigtrap()) {
pr_debug("FAILED sys_perf_event_open(): %s\n",
str_error_r(errno, sbuf, sizeof(sbuf)));
} else {
pr_debug("perf_event_attr doesn't have sigtrap\n");
ret = TEST_SKIP;
}
goto out_restore_sigaction;
}
for (i = 0; i < NUM_THREADS; i++) {
if (pthread_create(&threads[i], NULL, test_thread, &barrier)) {
pr_debug("FAILED pthread_create(): %s\n", str_error_r(errno, sbuf, sizeof(sbuf)));
goto out_close_perf_event;
}
}
ret = run_stress_test(fd, threads, &barrier);
out_close_perf_event:
close(fd);
out_restore_sigaction:
sigaction(SIGTRAP, &oldact, NULL);
out:
pthread_barrier_destroy(&barrier);
btf__exit();
return ret;
}
DEFINE_SUITE("Sigtrap", sigtrap);
Annotation
- Immediate include surface: `errno.h`, `stdint.h`, `stdlib.h`, `linux/hw_breakpoint.h`, `linux/string.h`, `pthread.h`, `signal.h`, `sys/ioctl.h`.
- Detected declarations: `function make_event_attr`, `function btf__available`, `function btf__exit`, `function attr_has_sigtrap`, `function kernel_with_sleepable_spinlocks`, `function attr_has_sigtrap`, `function kernel_with_sleepable_spinlocks`, `function btf__exit`, `function run_test_threads`, `function run_stress_test`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.