All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Harald Seiler <hws@denx.de>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 6/6] libtracefs sqlhist: Report errors executing the commands
Date: Mon,  6 Jun 2022 15:29:53 -0400	[thread overview]
Message-ID: <20220606192953.334315-7-rostedt@goodmis.org> (raw)
In-Reply-To: <20220606192953.334315-1-rostedt@goodmis.org>

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

If the -e option is set and the parsing succeeds but the executing does
not, sqlhist exits with success. It should instead check the return of the
creation of the histogram or synthetic event and return the error message
on failure and not succeed.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 Documentation/libtracefs-sql.txt | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/Documentation/libtracefs-sql.txt b/Documentation/libtracefs-sql.txt
index 5e48baa4da39..6d606dbcaf88 100644
--- a/Documentation/libtracefs-sql.txt
+++ b/Documentation/libtracefs-sql.txt
@@ -407,8 +407,13 @@ static int do_sql(const char *instance_name,
 			}
 		}
 		tracefs_synth_echo_cmd(&seq, synth);
-		if (execute)
-			tracefs_synth_create(synth);
+		if (execute) {
+			ret = tracefs_synth_create(synth);
+			if (ret < 0) {
+				fprintf(stderr, "%s\n", tracefs_error_last(NULL));
+				exit(-1);
+			}
+		}
 	} else {
 		struct tracefs_instance *instance = NULL;
 		struct tracefs_hist *hist;
@@ -430,8 +435,13 @@ static int do_sql(const char *instance_name,
 			}
 		}
 		tracefs_hist_echo_cmd(&seq, instance, hist, 0);
-		if (execute)
-			tracefs_hist_start(instance, hist);
+		if (execute) {
+			ret = tracefs_hist_start(instance, hist);
+			if (ret < 0) {
+				fprintf(stderr, "%s\n", tracefs_error_last(instance));
+				exit(-1);
+			}
+		}
 	}
 
 	tracefs_synth_free(synth);
-- 
2.35.1


  parent reply	other threads:[~2022-06-06 19:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 19:29 [PATCH 0/6] libtracefs: Fixes for sqlhist Steven Rostedt
2022-06-06 19:29 ` [PATCH 1/6] libtracefs: Fix make sqlhist when built again Steven Rostedt
2022-06-06 19:29 ` [PATCH 2/6] libtracefs: Add libtracefs.a to dependency of sqlhist Steven Rostedt
2022-06-06 19:29 ` [PATCH 3/6] libtracefs: Differentiate FROM and JOIN events if they are the same event Steven Rostedt
2022-06-06 19:29 ` [PATCH 4/6] libtracefs: Use unique names for sql field variables Steven Rostedt
2022-06-06 19:29 ` [PATCH 5/6] libtracefs: Differentiate WHERE clause when FROM and TO events are the same Steven Rostedt
2022-06-06 19:29 ` Steven Rostedt [this message]
2022-06-07 10:01 ` [PATCH 0/6] libtracefs: Fixes for sqlhist Harald Seiler

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=20220606192953.334315-7-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=hws@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.