6 * Default error logging functions
8 static int perf_stdio__error(const char *format, va_list args)
10 fprintf(stderr, "Error:\n");
11 vfprintf(stderr, format, args);
15 static int perf_stdio__warning(const char *format, va_list args)
17 fprintf(stderr, "Warning:\n");
18 vfprintf(stderr, format, args);
22 static struct perf_error_ops default_eops =
24 .error = perf_stdio__error,
25 .warning = perf_stdio__warning,
28 static struct perf_error_ops *perf_eops = &default_eops;
31 int ui__error(const char *format, ...)
36 va_start(args, format);
37 ret = perf_eops->error(format, args);
43 int ui__warning(const char *format, ...)
48 va_start(args, format);
49 ret = perf_eops->warning(format, args);
55 int ui__error_paranoid(void)
57 return ui__error("Permission error - are you root?\n"
58 "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
59 " -1 - Not paranoid at all\n"
60 " 0 - Disallow raw tracepoint access for unpriv\n"
61 " 1 - Disallow cpu events for unpriv\n"
62 " 2 - Disallow kernel profiling for unpriv\n");
67 * perf_error__register - Register error logging functions
68 * @eops: The pointer to error logging function struct
70 * Register UI-specific error logging functions. Before calling this,
71 * other logging functions should be unregistered, if any.
73 int perf_error__register(struct perf_error_ops *eops)
75 if (perf_eops != &default_eops)
83 * perf_error__unregister - Unregister error logging functions
84 * @eops: The pointer to error logging function struct
86 * Unregister already registered error logging functions.
88 int perf_error__unregister(struct perf_error_ops *eops)
90 if (perf_eops != eops)
93 perf_eops = &default_eops;