stdio based implementations of ui_xxxx based functions for the python
library. Needed for patch 3 - consolidating open counters method.

Signed-off-by: David Ahern <dsah...@gmail.com>
Cc: Arnaldo Carvalho de Melo <a...@ghostprotocols.net>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Peter Zijlstra <pet...@infradead.org>
---
 tools/perf/util/python-ext-sources |    1 +
 tools/perf/util/python_stubs.c     |   54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 tools/perf/util/python_stubs.c

diff --git a/tools/perf/util/python-ext-sources 
b/tools/perf/util/python-ext-sources
index c40c2d3..92d9e05 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -19,3 +19,4 @@ util/debugfs.c
 util/rblist.c
 util/strlist.c
 ../../lib/rbtree.c
+util/python_stubs.c
diff --git a/tools/perf/util/python_stubs.c b/tools/perf/util/python_stubs.c
new file mode 100644
index 0000000..7b31880
--- /dev/null
+++ b/tools/perf/util/python_stubs.c
@@ -0,0 +1,54 @@
+/*
+ * stubs for various ui-specific functions for the python library
+ */
+
+#include <stdio.h>
+#include "debug.h"
+
+#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT)
+#undef ui__error
+#endif
+
+int verbose;
+
+int ui__warning(const char *format, ...)
+{
+       va_list args;
+
+       va_start(args, format);
+       vfprintf(stderr, format, args);
+       va_end(args);
+       return 0;
+}
+
+int ui__error(const char *format, ...)
+{
+       va_list args;
+
+       va_start(args, format);
+       vfprintf(stderr, format, args);
+       va_end(args);
+       return 0;
+}
+
+int ui__error_paranoid(void)
+{
+       return ui__error("Permission error - are you root?\n"
+                        "Consider tweaking 
/proc/sys/kernel/perf_event_paranoid:\n"
+                        " -1 - Not paranoid at all\n"
+                        "  0 - Disallow raw tracepoint access for unpriv\n"
+                        "  1 - Disallow cpu events for unpriv\n"
+                        "  2 - Disallow kernel profiling for unpriv\n");
+}
+
+int eprintf(int level, const char *fmt, ...)
+{
+       va_list args;
+       int ret = 0;
+
+       va_start(args, fmt);
+       ret = vfprintf(stderr, fmt, args);
+       va_end(args);
+
+       return ret;
+}
-- 
1.7.10.1

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

Reply via email to