Skip to content

Commit

Permalink
tracing: Fix reading of set_ftrace_filter across lists
Browse files Browse the repository at this point in the history
If we do:

 # cd /sys/kernel/debug
 # echo 'do_IRQ:traceon schedule:traceon sys_write:traceon' > \
    set_ftrace_filter
 # cat set_ftrace_filter

We get the following output:

 #### all functions enabled ####
 sys_write:traceon:unlimited
 schedule:traceon:unlimited
 do_IRQ:traceon:unlimited

This outputs two lists. One is the fact that all functions are
currently enabled for function tracing, the other has three probed
functions, which happen to have 'traceon' as their commands.

Currently, when reading the first list (functions enabled) the
seq_file code will receive a "NULL" from the t_next() function
causing it to exit early. This makes "read()" from userspace stop
reading the code at this boarder. Although read is allowed to do this,
some (broken) applications might consider this an end of file and
stop early.

This patch adds the start of the second list to t_next() when it
finishes the first list. It is a simple change and gives the
set_ftrace_filter file nicer reading ability.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Sep 14, 2010
1 parent 98c4fd0 commit 57c072c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,10 +1477,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos)

(*pos)++;
iter->pos = *pos;
iter->func_pos = *pos;

if (iter->flags & FTRACE_ITER_PRINTALL)
return NULL;
return t_hash_start(m, pos);

retry:
if (iter->idx >= iter->pg->index) {
Expand Down Expand Up @@ -1510,8 +1509,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
}

if (!rec)
return NULL;
return t_hash_start(m, pos);

iter->func_pos = *pos;
iter->func = rec;

return iter;
Expand Down

0 comments on commit 57c072c

Please sign in to comment.