kernel/trace/trace_events.c
Source file repositories/reference/linux-study-clean/kernel/trace/trace_events.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/trace_events.c- Extension
.c- Size
- 121986 bytes
- Lines
- 5100
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/workqueue.hlinux/security.hlinux/spinlock.hlinux/kthread.hlinux/tracefs.hlinux/uaccess.hlinux/module.hlinux/ctype.hlinux/sort.hlinux/slab.hlinux/delay.htrace/events/sched.htrace/syscall.hasm/setup.htrace_output.h
Detected Declarations
struct module_stringstruct event_mod_loadstruct set_event_iterstruct ftrace_module_file_opsstruct event_probe_dataenum set_event_iter_typefunction system_refcountfunction system_refcount_incfunction system_refcount_decfunction list_for_each_entryfunction list_for_each_entry_safefunction list_for_each_entryfunction trace_find_event_fieldfunction __trace_define_fieldfunction trace_define_fieldfunction trace_define_field_extfunction trace_define_generic_fieldsfunction trace_define_common_fieldsfunction trace_destroy_fieldsfunction trace_event_get_offsetsfunction test_fieldfunction find_print_stringfunction process_pointerfunction process_stringfunction handle_dereference_argfunction test_event_printkfunction trace_event_raw_initfunction trace_event_ignore_this_pidfunction trace_event_buffer_commitfunction trace_event_regfunction trace_event_enable_cmd_recordfunction do_for_each_event_filefunction trace_event_enable_tgid_recordfunction do_for_each_event_filefunction __ftrace_event_enable_disablefunction trace_event_enable_disablefunction ftrace_event_enable_disablefunction free_event_modfunction clear_mod_eventsfunction list_for_each_entry_safefunction remove_cache_modfunction list_for_each_entry_safefunction cache_modfunction clear_mod_eventsfunction ftrace_clear_eventsfunction event_filter_pid_sched_process_exitfunction event_filter_pid_sched_process_forkfunction trace_event_follow_fork
Annotated Snippet
static const struct file_operations ftrace_avail_fops = {
.open = ftrace_event_avail_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static const struct file_operations ftrace_set_event_fops = {
.open = ftrace_event_set_open,
.read = seq_read,
.write = ftrace_event_write,
.llseek = seq_lseek,
.release = ftrace_event_release,
};
static const struct file_operations ftrace_show_event_filters_fops = {
.open = ftrace_event_show_filters_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static const struct file_operations ftrace_show_event_triggers_fops = {
.open = ftrace_event_show_triggers_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static const struct file_operations ftrace_set_event_pid_fops = {
.open = ftrace_event_set_pid_open,
.read = seq_read,
.write = ftrace_event_pid_write,
.llseek = seq_lseek,
.release = ftrace_event_release,
};
static const struct file_operations ftrace_set_event_notrace_pid_fops = {
.open = ftrace_event_set_npid_open,
.read = seq_read,
.write = ftrace_event_npid_write,
.llseek = seq_lseek,
.release = ftrace_event_release,
};
static const struct file_operations ftrace_enable_fops = {
.open = tracing_open_file_tr,
.read = event_enable_read,
.write = event_enable_write,
.release = tracing_release_file_tr,
.llseek = default_llseek,
};
static const struct file_operations ftrace_event_format_fops = {
.open = trace_format_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#ifdef CONFIG_PERF_EVENTS
static const struct file_operations ftrace_event_id_fops = {
.read = event_id_read,
.llseek = default_llseek,
};
#endif
static const struct file_operations ftrace_event_filter_fops = {
.open = tracing_open_file_tr,
.read = event_filter_read,
.write = event_filter_write,
.release = tracing_release_file_tr,
.llseek = default_llseek,
};
static const struct file_operations ftrace_subsystem_filter_fops = {
.open = subsystem_open,
.read = subsystem_filter_read,
.write = subsystem_filter_write,
.llseek = default_llseek,
.release = subsystem_release,
};
static const struct file_operations ftrace_system_enable_fops = {
.open = subsystem_open,
.read = system_enable_read,
.write = system_enable_write,
.llseek = default_llseek,
.release = subsystem_release,
};
Annotation
- Immediate include surface: `linux/workqueue.h`, `linux/security.h`, `linux/spinlock.h`, `linux/kthread.h`, `linux/tracefs.h`, `linux/uaccess.h`, `linux/module.h`, `linux/ctype.h`.
- Detected declarations: `struct module_string`, `struct event_mod_load`, `struct set_event_iter`, `struct ftrace_module_file_ops`, `struct event_probe_data`, `enum set_event_iter_type`, `function system_refcount`, `function system_refcount_inc`, `function system_refcount_dec`, `function list_for_each_entry`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.