diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2016-04-14 16:15:22 (GMT) |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-06-20 13:54:17 (GMT) |
commit | d8275c454dcdba296675221b4c12f19d1b6e0ee8 (patch) | |
tree | c45950295f659f86cb67b7d8f035663b98840e9a /kernel/trace/trace_events.c | |
parent | 4e267db135c44d0b18e553899fe7df32b89211a5 (diff) | |
download | linux-d8275c454dcdba296675221b4c12f19d1b6e0ee8.tar.xz |
tracing: Move filtered_pid helper functions into trace.c
As the filtered_pid functions are going to be used by function tracer as
well as trace_events, move the code into the generic trace.c file.
The functions moved are:
trace_find_filtered_pid()
trace_ignore_this_task()
trace_filter_add_remove_task()
Kernel Doc text was also added.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index b5e514c..a11e6d9 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -502,57 +502,6 @@ static void ftrace_clear_events(struct trace_array *tr) /* Shouldn't this be in a header? */ extern int pid_max; -/* Returns true if found in filter */ -bool -trace_find_filtered_pid(struct trace_pid_list *filtered_pids, pid_t search_pid) -{ - /* - * If pid_max changed after filtered_pids was created, we - * by default ignore all pids greater than the previous pid_max. - */ - if (search_pid >= filtered_pids->pid_max) - return false; - - return test_bit(search_pid, filtered_pids->pids); -} - -bool -trace_ignore_this_task(struct trace_pid_list *filtered_pids, struct task_struct *task) -{ - /* - * Return false, because if filtered_pids does not exist, - * all pids are good to trace. - */ - if (!filtered_pids) - return false; - - return !trace_find_filtered_pid(filtered_pids, task->pid); -} - -void trace_filter_add_remove_task(struct trace_pid_list *pid_list, - struct task_struct *self, - struct task_struct *task) -{ - if (!pid_list) - return; - - /* For forks, we only add if the forking task is listed */ - if (self) { - if (!trace_find_filtered_pid(pid_list, self->pid)) - return; - } - - /* Sorry, but we don't support pid_max changing after setting */ - if (task->pid >= pid_list->pid_max) - return; - - /* "self" is set for forks, and NULL for exits */ - if (self) - set_bit(task->pid, pid_list->pids); - else - clear_bit(task->pid, pid_list->pids); -} - static void event_filter_pid_sched_process_exit(void *data, struct task_struct *task) { |