From: Steven Rostedt Date: Mon, 12 May 2008 19:20:58 +0000 (+0200) Subject: ftrace: trace_pipe implement NONBLOCK X-Git-Tag: v2.6.27-rc1~1102^2^2~1^2~54 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2dc8f09571a61d9cb3dc47bba6608689dfe15d16;p=karo-tx-linux.git ftrace: trace_pipe implement NONBLOCK This patch implements "NONBLOCK" for trace_pipe. If the trace_pipe is opened with O_NONBLOCK, then the trace_pipe read will not block when buffer is empty. Signed-off-by: Steven Rostedt Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 2af940433e96..3b4eaf36ed5d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2233,6 +2233,10 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, start = 0; while (trace_empty(iter)) { + + if ((filp->f_flags & O_NONBLOCK)) + return -EAGAIN; + /* * This is a make-shift waitqueue. The reason we don't use * an actual wait queue is because: