lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 26 Sep 2014 14:44:34 -0400
From:	Josef Bacik <jbacik@...com>
To:	<rostedt@...dmis.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] trace-cmd: allow python tools to supress warning() and pr_stat()

trace-cmd has a lot of built in warning() and pr_stat() output that is noisy
when you are using the python bindings.  This patch provides overrides for these
two functions and the ability for python scripts to optionally turn them off.
With this patch I can silence all of these extraneous print messages from within
my python script.

Signed-off-by: Josef Bacik <jbacik@...com>
---
 ctracecmd.i | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/ctracecmd.i b/ctracecmd.i
index 3b80f01..e91d068 100644
--- a/ctracecmd.i
+++ b/ctracecmd.i
@@ -34,6 +34,36 @@ static int python_callback(struct trace_seq *s,
 			   struct event_format *event,
 			   void *context);
 
+static int skip_output = 0;
+
+static void py_supress_trace_output(void)
+{
+	skip_output = 1;
+}
+
+void pr_stat(const char *fmt, ...)
+{
+        va_list ap;
+
+	if (skip_output)
+		return;
+	va_start(ap, fmt);
+	__vpr_stat(fmt, ap);
+	va_end(ap);
+}
+
+void warning(const char *fmt, ...)
+{
+	va_list ap;
+
+	if (skip_output)
+		return;
+
+	va_start(ap, fmt);
+	__vwarning(fmt, ap);
+	va_end(ap);
+}
+
 PyObject *convert_pevent(unsigned long pevent)
 {
 	void *pev = (void *)pevent;
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ