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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 10 Jul 2014 17:22:47 -0400
From:	Josef Bacik <jbacik@...com>
To:	<linux-kernel@...r.kernel.org>, <rostedt@...dmis.org>
Subject: [PATCH 2/2] trace-cmd: make libtracecmd a little more library friendly

You get a lot of debug output if you link directly against libtracecmd if you
don't provide your own pr_stat() function because we default to something that
actually prints stuff out.  Fix this by making pr_stat() do nothing by default.
This also changes the printf() for the version number to a pr_stat().  Thanks,

Signed-off-by: Josef Bacik <jbacik@...com>
---
 parse-utils.c     | 6 ------
 plugin_function.c | 1 +
 trace-cmd-local.h | 1 +
 trace-cmd.c       | 1 +
 trace-cmd.h       | 2 --
 trace-input.c     | 2 +-
 trace-local.h     | 1 +
 trace-recorder.c  | 1 +
 trace-util.c      | 1 +
 9 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/parse-utils.c b/parse-utils.c
index f023a13..c5b0487 100644
--- a/parse-utils.c
+++ b/parse-utils.c
@@ -87,16 +87,10 @@ void __pr_stat(const char *fmt, ...)
 
 void __weak vpr_stat(const char *fmt, va_list ap)
 {
-	__vpr_stat(fmt, ap);
 }
 
 void __weak pr_stat(const char *fmt, ...)
 {
-	va_list ap;
-
-	va_start(ap, fmt);
-	__vpr_stat(fmt, ap);
-	va_end(ap);
 }
 
 void __weak *malloc_or_die(unsigned int size)
diff --git a/plugin_function.c b/plugin_function.c
index 0defd11..9ae4cf1 100644
--- a/plugin_function.c
+++ b/plugin_function.c
@@ -22,6 +22,7 @@
 #include <string.h>
 
 #include "trace-cmd.h"
+#include "event-utils.h"
 
 static struct func_stack {
 	int size;
diff --git a/trace-cmd-local.h b/trace-cmd-local.h
index 6f502c5..06809dd 100644
--- a/trace-cmd-local.h
+++ b/trace-cmd-local.h
@@ -23,6 +23,7 @@
 /* Local for trace-input.c and trace-output.c */
 
 #include "trace-cmd.h"
+#include "event-utils.h"
 
 static ssize_t __do_write(int fd, void *data, size_t size)
 {
diff --git a/trace-cmd.c b/trace-cmd.c
index ebf9c7a..1b776de 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
+#include <stdlib.h>
 
 #include "trace-local.h"
 
diff --git a/trace-cmd.h b/trace-cmd.h
index 92b4ff2..37d2fa8 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -20,8 +20,6 @@
 #ifndef _TRACE_CMD_H
 #define _TRACE_CMD_H
 
-#include <stdlib.h>
-#include "event-utils.h"
 #include "event-parse.h"
 
 #define TRACECMD_ERR_MSK	((unsigned long)(-1) & ~((1UL << 14) - 1))
diff --git a/trace-input.c b/trace-input.c
index 8118b22..090ee59 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -2237,7 +2237,7 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd)
 	version = read_string(handle);
 	if (!version)
 		goto failed_read;
-	printf("version = %s\n", version);
+	pr_stat("version = %s\n", version);
 	free(version);
 
 	if (do_read_check(handle, buf, 1))
diff --git a/trace-local.h b/trace-local.h
index 3c82c2f..d187005 100644
--- a/trace-local.h
+++ b/trace-local.h
@@ -21,6 +21,7 @@
 #define __TRACE_LOCAL_H
 
 #include "trace-cmd.h"
+#include "event-utils.h"
 
 /* fix stupid glib guint64 typecasts and printf formats */
 typedef unsigned long long u64;
diff --git a/trace-recorder.c b/trace-recorder.c
index 247bb2d..e922f26 100644
--- a/trace-recorder.c
+++ b/trace-recorder.c
@@ -34,6 +34,7 @@
 #include <errno.h>
 
 #include "trace-cmd.h"
+#include "event-utils.h"
 
 struct tracecmd_recorder {
 	int		fd;
diff --git a/trace-util.c b/trace-util.c
index 208f150..e1f8230 100644
--- a/trace-util.c
+++ b/trace-util.c
@@ -32,6 +32,7 @@
 #include <sys/stat.h>
 
 #include "trace-cmd.h"
+#include "event-utils.h"
 
 #define LOCAL_PLUGIN_DIR ".trace-cmd/plugins"
 #define DEBUGFS_PATH "/sys/kernel/debug"
-- 
1.8.3.1

--
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