kernel/trace/trace.h
Source file repositories/reference/linux-study-clean/kernel/trace/trace.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/trace.h- Extension
.h- Size
- 81864 bytes
- Lines
- 2509
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/atomic.hlinux/sched.hlinux/clocksource.hlinux/ring_buffer.hlinux/mmiotrace.hlinux/tracepoint.hlinux/ftrace.hlinux/trace.hlinux/hw_breakpoint.hlinux/trace_seq.hlinux/trace_events.hlinux/compiler.hlinux/glob.hlinux/irq_work.hlinux/workqueue.hlinux/ctype.hlinux/once_lite.hlinux/ftrace_regs.hlinux/llist.hpid_list.hasm/unistd.hasm/syscall.htrace_entries.h
Detected Declarations
struct struct_namestruct syscall_trace_enterstruct syscall_trace_exitstruct kprobe_trace_entry_headstruct eprobe_trace_entry_headstruct kretprobe_trace_entry_headstruct fentry_trace_entry_headstruct fexit_trace_entry_headstruct trace_arraystruct trace_array_cpustruct tracerstruct trace_option_dentrystruct array_bufferstruct trace_optionsstruct cond_snapshotstruct trace_func_repeatsstruct trace_module_deltastruct trace_arraystruct tracer_optstruct tracer_flagsstruct trace_option_dentrystruct tracerstruct ftrace_buffer_infostruct ring_buffer_eventstruct ftrace_hashstruct ftrace_mod_loadstruct ftrace_hashstruct ftrace_func_commandstruct ftrace_probe_opsstruct ftrace_func_mapperstruct ftrace_func_commandstruct trace_parserstruct ftrace_event_fieldstruct prog_entrystruct event_filterstruct event_subsystemstruct trace_subsystem_dirstruct trace_user_bufstruct trace_user_buf_infostruct filter_predstruct regexstruct regexstruct event_trigger_datastruct enable_trigger_datastruct event_commandstruct trace_min_max_paramenum trace_typeenum trace_iterator_bits
Annotated Snippet
const struct file_operations *fops);
struct dentry *trace_create_cpu_file(const char *name,
umode_t mode,
struct dentry *parent,
void *data,
long cpu,
const struct file_operations *fops);
struct trace_iterator *__tracing_open(struct inode *inode, struct file *file,
bool snapshot);
int tracing_buffers_open(struct inode *inode, struct file *filp);
ssize_t tracing_buffers_read(struct file *filp, char __user *ubuf,
size_t count, loff_t *ppos);
int tracing_buffers_release(struct inode *inode, struct file *file);
ssize_t tracing_buffers_splice_read(struct file *file, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len, unsigned int flags);
ssize_t tracing_nsecs_read(unsigned long *ptr, char __user *ubuf,
size_t cnt, loff_t *ppos);
ssize_t tracing_nsecs_write(unsigned long *ptr, const char __user *ubuf,
size_t cnt, loff_t *ppos);
void trace_set_buffer_entries(struct array_buffer *buf, unsigned long val);
/*
* Should be used after trace_array_get(), trace_types_lock
* ensures that i_cdev was already initialized.
*/
static inline int tracing_get_cpu(struct inode *inode)
{
if (inode->i_cdev) /* See trace_create_cpu_file() */
return (long)inode->i_cdev - 1;
return RING_BUFFER_ALL_CPUS;
}
void tracing_reset_cpu(struct array_buffer *buf, int cpu);
struct ftrace_buffer_info {
struct trace_iterator iter;
void *spare;
unsigned int spare_cpu;
unsigned int spare_size;
unsigned int read;
};
/**
* tracer_tracing_is_on_cpu - show real state of ring buffer enabled on for a cpu
* @tr : the trace array to know if ring buffer is enabled
* @cpu: The cpu buffer to check if enabled
*
* Shows real state of the per CPU buffer if it is enabled or not.
*/
static inline bool tracer_tracing_is_on_cpu(struct trace_array *tr, int cpu)
{
if (tr->array_buffer.buffer)
return ring_buffer_record_is_on_cpu(tr->array_buffer.buffer, cpu);
return false;
}
int tracing_init_dentry(void);
struct ring_buffer_event;
struct ring_buffer_event *
trace_buffer_lock_reserve(struct trace_buffer *buffer,
int type,
unsigned long len,
unsigned int trace_ctx);
int ring_buffer_meta_seq_init(struct file *file, struct trace_buffer *buffer, int cpu);
struct trace_entry *tracing_get_trace_entry(struct trace_array *tr,
struct trace_array_cpu *data);
struct trace_entry *trace_find_next_entry(struct trace_iterator *iter,
int *ent_cpu, u64 *ent_ts);
void trace_buffer_unlock_commit_nostack(struct trace_buffer *buffer,
struct ring_buffer_event *event);
bool trace_is_tracepoint_string(const char *str);
const char *trace_event_format(struct trace_iterator *iter, const char *fmt);
char *trace_iter_expand_format(struct trace_iterator *iter);
bool ignore_event(struct trace_iterator *iter);
int trace_empty(struct trace_iterator *iter);
void *trace_find_next_entry_inc(struct trace_iterator *iter);
void trace_init_global_iter(struct trace_iterator *iter);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/atomic.h`, `linux/sched.h`, `linux/clocksource.h`, `linux/ring_buffer.h`, `linux/mmiotrace.h`, `linux/tracepoint.h`, `linux/ftrace.h`.
- Detected declarations: `struct struct_name`, `struct syscall_trace_enter`, `struct syscall_trace_exit`, `struct kprobe_trace_entry_head`, `struct eprobe_trace_entry_head`, `struct kretprobe_trace_entry_head`, `struct fentry_trace_entry_head`, `struct fexit_trace_entry_head`, `struct trace_array`, `struct trace_array_cpu`.
- 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.
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.