linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Beau Belgrave <beaub@linux.microsoft.com>
Subject: [PATCH] libtracefs: Use tracefs_warning() for tracefs_user_event_record() errors
Date: Tue, 22 Feb 2022 23:16:39 -0500	[thread overview]
Message-ID: <20220222231639.3ccfe44e@rorschach.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Instead of hard coding fprintf() into the library, allow the application
to control the output, and use tracefs_warning() instead.
Also switch the setting of the errno, as tracefs_warning() will
add a perror() to the message.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-userevents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tracefs-userevents.c b/src/tracefs-userevents.c
index ccd511b3045d..7da6aa35bf12 100644
--- a/src/tracefs-userevents.c
+++ b/src/tracefs-userevents.c
@@ -504,13 +504,13 @@ int tracefs_user_event_record(struct tracefs_user_event *event,
 	return writev(e->group->fd, head, used);
 
 bad_length:
-	fprintf(stderr, "Bad user_event item length at index %d\n",
-		used - 1);
 	errno = EINVAL;
+	tracefs_warning("Bad user_event item length at index %d\n",
+		used - 1);
 	return -1;
 
 bad_count:
-	fprintf(stderr, "Too many user_event items passed\n");
 	errno = E2BIG;
+	tracefs_warning("Too many user_event items passed\n");
 	return -1;
 }
-- 
2.34.1


             reply	other threads:[~2022-02-23  4:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23  4:16 Steven Rostedt [this message]
2022-02-23 17:21 ` [PATCH] libtracefs: Use tracefs_warning() for tracefs_user_event_record() errors Beau Belgrave
2022-02-23 17:25   ` Steven Rostedt
2022-02-23 17:27     ` Beau Belgrave

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220222231639.3ccfe44e@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=beaub@linux.microsoft.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).