tools/perf/tests/openat-syscall-tp-fields.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/openat-syscall-tp-fields.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/openat-syscall-tp-fields.c- Extension
.c- Size
- 3618 bytes
- Lines
- 161
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: syscall or user/kernel boundary
- Status
- core 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 participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hlinux/err.hlinux/string.hsys/types.hsys/stat.hfcntl.hevlist.hevsel.hthread_map.hrecord.htests.hdebug.hutil/mmap.herrno.hperf/mmap.hutil/sample.h
Detected Declarations
function test__syscall_openat_tp_fields
Annotated Snippet
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
const u32 type = event->header.type;
int tp_flags;
struct perf_sample sample;
++nr_events;
if (type != PERF_RECORD_SAMPLE) {
perf_mmap__consume(&md->core);
continue;
}
perf_sample__init(&sample, /*all=*/false);
err = evsel__parse_sample(evsel, event, &sample);
if (err) {
pr_debug("Can't parse sample, err = %d\n", err);
perf_sample__exit(&sample);
goto out_delete_evlist;
}
tp_flags = evsel__intval(evsel, &sample, "flags");
perf_sample__exit(&sample);
if (flags != tp_flags) {
pr_debug("%s: Expected flags=%#x, got %#x\n",
__func__, flags, tp_flags);
goto out_delete_evlist;
}
goto out_ok;
}
perf_mmap__read_done(&md->core);
}
if (nr_events == before)
evlist__poll(evlist, 10);
if (++nr_polls > 5) {
pr_debug("%s: no events!\n", __func__);
goto out_delete_evlist;
}
}
out_ok:
ret = TEST_OK;
out_delete_evlist:
evlist__delete(evlist);
out:
return ret;
}
static struct test_case tests__syscall_openat_tp_fields[] = {
TEST_CASE_REASON("syscalls:sys_enter_openat event fields",
syscall_openat_tp_fields,
"permissions"),
{ .name = NULL, }
};
struct test_suite suite__syscall_openat_tp_fields = {
.desc = "syscalls:sys_enter_openat event fields",
.test_cases = tests__syscall_openat_tp_fields,
};
Annotation
- Immediate include surface: `stdbool.h`, `linux/err.h`, `linux/string.h`, `sys/types.h`, `sys/stat.h`, `fcntl.h`, `evlist.h`, `evsel.h`.
- Detected declarations: `function test__syscall_openat_tp_fields`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: core 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.