[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201012082642.1394-1-peter.enderborg@sony.com>
Date: Mon, 12 Oct 2020 10:26:42 +0200
From: Peter Enderborg <peter.enderborg@...y.com>
To: <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>
CC: Peter Enderborg <peter.enderborg@...y.com>
Subject: [PATCH] trace: Return ENOTCONN instead of EBADF
When there is no clients listening on event the trace return
EBADF. The file is not a bad file descriptor and to get the
userspace able to do a proper error handling it need a different
error code that separate a bad file descriptor from a empty listening.
Signed-off-by: Peter Enderborg <peter.enderborg@...y.com>
---
kernel/trace/trace.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d3e5de717df2..6e592bf736df 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6651,8 +6651,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size,
irq_flags, preempt_count());
if (unlikely(!event))
- /* Ring buffer disabled, return as if not open for write */
- return -EBADF;
+ /* Ring buffer disabled, return as if not connected */
+ return -ENOTCONN;
entry = ring_buffer_event_data(event);
entry->ip = _THIS_IP_;
@@ -6731,8 +6731,8 @@ tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
event = __trace_buffer_lock_reserve(buffer, TRACE_RAW_DATA, size,
irq_flags, preempt_count());
if (!event)
- /* Ring buffer disabled, return as if not open for write */
- return -EBADF;
+ /* Ring buffer disabled, return not connected */
+ return -ENOTCONN;
entry = ring_buffer_event_data(event);
--
2.17.1
Powered by blists - more mailing lists