#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/kmemleak.h>
#include <linux/ftrace.h>
#include <trace/events/sched.h>
#include "trace.h"
#define RECORD_CMDLINE …
#define RECORD_TGID …
static int sched_cmdline_ref;
static int sched_tgid_ref;
static DEFINE_MUTEX(sched_register_mutex);
static void
probe_sched_switch(void *ignore, bool preempt,
struct task_struct *prev, struct task_struct *next,
unsigned int prev_state)
{ … }
static void
probe_sched_wakeup(void *ignore, struct task_struct *wakee)
{ … }
static int tracing_sched_register(void)
{ … }
static void tracing_sched_unregister(void)
{ … }
static void tracing_start_sched_switch(int ops)
{ … }
static void tracing_stop_sched_switch(int ops)
{ … }
void tracing_start_cmdline_record(void)
{ … }
void tracing_stop_cmdline_record(void)
{ … }
void tracing_start_tgid_record(void)
{ … }
void tracing_stop_tgid_record(void)
{ … }
static int *tgid_map;
static size_t tgid_map_max;
#define SAVED_CMDLINES_DEFAULT …
#define NO_CMDLINE_MAP …
static arch_spinlock_t trace_cmdline_lock = …;
struct saved_cmdlines_buffer { … };
static struct saved_cmdlines_buffer *savedcmd;
#define SAVED_CMDLINE_MAP_ELEMENT_SIZE(s) …
static inline char *get_saved_cmdlines(int idx)
{ … }
static inline void set_cmdline(int idx, const char *cmdline)
{ … }
static void free_saved_cmdlines_buffer(struct saved_cmdlines_buffer *s)
{ … }
static struct saved_cmdlines_buffer *allocate_cmdlines_buffer(unsigned int val)
{ … }
int trace_create_savedcmd(void)
{ … }
int trace_save_cmdline(struct task_struct *tsk)
{ … }
static void __trace_find_cmdline(int pid, char comm[])
{ … }
void trace_find_cmdline(int pid, char comm[])
{ … }
static int *trace_find_tgid_ptr(int pid)
{ … }
int trace_find_tgid(int pid)
{ … }
static int trace_save_tgid(struct task_struct *tsk)
{ … }
static bool tracing_record_taskinfo_skip(int flags)
{ … }
void tracing_record_taskinfo(struct task_struct *task, int flags)
{ … }
void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
struct task_struct *next, int flags)
{ … }
void tracing_record_cmdline(struct task_struct *task)
{ … }
void tracing_record_tgid(struct task_struct *task)
{ … }
int trace_alloc_tgid_map(void)
{ … }
static void *saved_tgids_next(struct seq_file *m, void *v, loff_t *pos)
{ … }
static void *saved_tgids_start(struct seq_file *m, loff_t *pos)
{ … }
static void saved_tgids_stop(struct seq_file *m, void *v)
{ … }
static int saved_tgids_show(struct seq_file *m, void *v)
{ … }
static const struct seq_operations tracing_saved_tgids_seq_ops = …;
static int tracing_saved_tgids_open(struct inode *inode, struct file *filp)
{ … }
const struct file_operations tracing_saved_tgids_fops = …;
static void *saved_cmdlines_next(struct seq_file *m, void *v, loff_t *pos)
{ … }
static void *saved_cmdlines_start(struct seq_file *m, loff_t *pos)
{ … }
static void saved_cmdlines_stop(struct seq_file *m, void *v)
{ … }
static int saved_cmdlines_show(struct seq_file *m, void *v)
{ … }
static const struct seq_operations tracing_saved_cmdlines_seq_ops = …;
static int tracing_saved_cmdlines_open(struct inode *inode, struct file *filp)
{ … }
const struct file_operations tracing_saved_cmdlines_fops = …;
static ssize_t
tracing_saved_cmdlines_size_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{ … }
void trace_free_saved_cmdlines_buffer(void)
{ … }
static int tracing_resize_saved_cmdlines(unsigned int val)
{ … }
static ssize_t
tracing_saved_cmdlines_size_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{ … }
const struct file_operations tracing_saved_cmdlines_size_fops = …;