summaryrefslogtreecommitdiff
path: root/tools/lib/api/debug.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-03-20 04:05:24 +0300
committerDavid S. Miller <davem@davemloft.net>2016-03-20 04:05:24 +0300
commitc78a85a8430e35aecd53e190a2f6b999062b1037 (patch)
treefbd69827579db437492fb77b5faa53814114bed3 /tools/lib/api/debug.c
parent133800d1f0288b9ddfc0d0aded10d9efa82d5b8c (diff)
parentde06dbfa7861c9019eedefc0c356ba86e5098f1b (diff)
downloadlinux-c78a85a8430e35aecd53e190a2f6b999062b1037.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Diffstat (limited to 'tools/lib/api/debug.c')
-rw-r--r--tools/lib/api/debug.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/lib/api/debug.c b/tools/lib/api/debug.c
new file mode 100644
index 000000000000..5fa5cf500a1f
--- /dev/null
+++ b/tools/lib/api/debug.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include "debug.h"
+#include "debug-internal.h"
+
+static int __base_pr(const char *format, ...)
+{
+ va_list args;
+ int err;
+
+ va_start(args, format);
+ err = vfprintf(stderr, format, args);
+ va_end(args);
+ return err;
+}
+
+libapi_print_fn_t __pr_warning = __base_pr;
+libapi_print_fn_t __pr_info = __base_pr;
+libapi_print_fn_t __pr_debug;
+
+void libapi_set_print(libapi_print_fn_t warn,
+ libapi_print_fn_t info,
+ libapi_print_fn_t debug)
+{
+ __pr_warning = warn;
+ __pr_info = info;
+ __pr_debug = debug;
+}