diff options
Diffstat (limited to 'tools/perf/util/include/linux/kernel.h')
| -rw-r--r-- | tools/perf/util/include/linux/kernel.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h index f2611655ab51..1eb804fd3fbf 100644 --- a/tools/perf/util/include/linux/kernel.h +++ b/tools/perf/util/include/linux/kernel.h | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | (type *)((char *)__mptr - offsetof(type, member)); }) | 28 | (type *)((char *)__mptr - offsetof(type, member)); }) |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
| 32 | |||
| 31 | #ifndef max | 33 | #ifndef max |
| 32 | #define max(x, y) ({ \ | 34 | #define max(x, y) ({ \ |
| 33 | typeof(x) _max1 = (x); \ | 35 | typeof(x) _max1 = (x); \ |
| @@ -85,16 +87,19 @@ simple_strtoul(const char *nptr, char **endptr, int base) | |||
| 85 | return strtoul(nptr, endptr, base); | 87 | return strtoul(nptr, endptr, base); |
| 86 | } | 88 | } |
| 87 | 89 | ||
| 90 | int eprintf(int level, | ||
| 91 | const char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
| 92 | |||
| 88 | #ifndef pr_fmt | 93 | #ifndef pr_fmt |
| 89 | #define pr_fmt(fmt) fmt | 94 | #define pr_fmt(fmt) fmt |
| 90 | #endif | 95 | #endif |
| 91 | 96 | ||
| 92 | #define pr_err(fmt, ...) \ | 97 | #define pr_err(fmt, ...) \ |
| 93 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 98 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
| 94 | #define pr_warning(fmt, ...) \ | 99 | #define pr_warning(fmt, ...) \ |
| 95 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 100 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
| 96 | #define pr_info(fmt, ...) \ | 101 | #define pr_info(fmt, ...) \ |
| 97 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 102 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
| 98 | #define pr_debug(fmt, ...) \ | 103 | #define pr_debug(fmt, ...) \ |
| 99 | eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) | 104 | eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) |
| 100 | #define pr_debugN(n, fmt, ...) \ | 105 | #define pr_debugN(n, fmt, ...) \ |
