kernel/trace/trace_events_synth.c
Source file repositories/reference/linux-study-clean/kernel/trace/trace_events_synth.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/trace_events_synth.c- Extension
.c- Size
- 59203 bytes
- Lines
- 2430
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kallsyms.hlinux/security.hlinux/mutex.hlinux/slab.hlinux/stacktrace.hlinux/rculist.hlinux/tracefs.hlinux/trace_events.htrace/events/mmflags.htrace_probe.htrace_probe_kernel.htrace_synth.h
Detected Declarations
struct synth_trace_eventfunction errposfunction last_cmd_setfunction synth_errfunction is_synth_eventfunction synth_event_is_busyfunction synth_event_matchfunction synth_event_define_fieldsfunction synth_field_signedfunction synth_field_is_stringfunction synth_field_is_stackfunction synth_field_string_sizefunction synth_field_sizefunction print_synth_event_num_valfunction print_synth_eventfunction trace_stringfunction trace_stackfunction get_field_sizefunction write_synth_entryfunction trace_event_raw_event_synthfunction perf_event_raw_event_synthfunction free_synth_event_print_fmtfunction __set_synth_event_print_fmtfunction set_synth_event_print_fmtfunction free_synth_fieldfunction check_field_versionfunction free_synth_tracepointfunction for_each_dyn_eventfunction synth_event_regfunction register_synth_eventfunction unregister_synth_eventfunction free_synth_eventfunction synth_event_check_arg_fnfunction synth_field_sizefunction synth_field_sizefunction synth_field_sizefunction synth_event_add_fieldsfunction synth_event_add_fieldsfunction __create_synth_eventfunction synth_event_deletefunction destroy_synth_eventfunction synth_event_createfunction check_commandfunction create_or_delete_synth_eventfunction synth_event_run_commandfunction synth_event_cmd_initfunction __synth_event_trace_initfunction set
Annotated Snippet
static const struct file_operations synth_events_fops = {
.open = synth_events_open,
.write = synth_events_write,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*
* Register dynevent at core_initcall. This allows kernel to setup kprobe
* events in postcore_initcall without tracefs.
*/
static __init int trace_events_synth_init_early(void)
{
int err = 0;
err = dyn_event_register(&synth_event_ops);
if (err)
pr_warn("Could not register synth_event_ops\n");
return err;
}
core_initcall(trace_events_synth_init_early);
static __init int trace_events_synth_init(void)
{
struct dentry *entry = NULL;
int err = 0;
err = tracing_init_dentry();
if (err)
goto err;
entry = tracefs_create_file("synthetic_events", TRACE_MODE_WRITE,
NULL, NULL, &synth_events_fops);
if (!entry) {
err = -ENODEV;
goto err;
}
return err;
err:
pr_warn("Could not create tracefs 'synthetic_events' entry\n");
return err;
}
fs_initcall(trace_events_synth_init);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kallsyms.h`, `linux/security.h`, `linux/mutex.h`, `linux/slab.h`, `linux/stacktrace.h`, `linux/rculist.h`, `linux/tracefs.h`.
- Detected declarations: `struct synth_trace_event`, `function errpos`, `function last_cmd_set`, `function synth_err`, `function is_synth_event`, `function synth_event_is_busy`, `function synth_event_match`, `function synth_event_define_fields`, `function synth_field_signed`, `function synth_field_is_string`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern 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.