DO NOT APPLY THIS PATCH!!!!! This is an example of implementing a plugin for header for the trace_pipe file. DO NOT APPLY THIS PATCH!!!!! Signed-off-by: Steven Rostedt --- kernel/trace/trace_functions.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) Index: linux-sched-devel.git/kernel/trace/trace_functions.c =================================================================== --- linux-sched-devel.git.orig/kernel/trace/trace_functions.c 2008-04-21 16:50:49.000000000 -0400 +++ linux-sched-devel.git/kernel/trace/trace_functions.c 2008-04-21 16:54:55.000000000 -0400 @@ -16,6 +16,45 @@ #include "trace.h" +static void function_pipe_open(struct trace_iterator *iter) +{ + int *traceme; + + traceme = kzalloc(sizeof(int), GFP_KERNEL); + if (!traceme) + return; + + iter->private = traceme; +} + +static ssize_t function_read(struct trace_iterator *iter, + struct file *filp, char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + unsigned char head[] = "Test header\n"; + int *traced; + int ret; + + if (!iter->private) + return 0; + + traced = iter->private; + if (*traced >= sizeof(head)-1) + return 0; + + if (cnt > sizeof(head)-1) + cnt = sizeof(head)-1; + + ret = copy_to_user(ubuf, head + *traced, cnt); + + *traced += cnt; + + if (ret) + cnt = -EFAULT; + + return cnt; +} + static void function_reset(struct trace_array *tr) { int cpu; @@ -68,6 +107,8 @@ static struct tracer function_trace __re #ifdef CONFIG_FTRACE_SELFTEST .selftest = trace_selftest_startup_function, #endif + .pipe_open = function_pipe_open, + .read = function_read, }; static __init int init_function_trace(void) -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/