aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f4fc576ed4c4..5c1ec1f84eab 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -24,11 +24,15 @@ extern const char linux_banner[];
24#define LONG_MAX ((long)(~0UL>>1)) 24#define LONG_MAX ((long)(~0UL>>1))
25#define LONG_MIN (-LONG_MAX - 1) 25#define LONG_MIN (-LONG_MAX - 1)
26#define ULONG_MAX (~0UL) 26#define ULONG_MAX (~0UL)
27#define LLONG_MAX ((long long)(~0ULL>>1))
28#define LLONG_MIN (-LLONG_MAX - 1)
29#define ULLONG_MAX (~0ULL)
27 30
28#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
29 32
30#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
31#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) 34#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
32 36
33#define KERN_EMERG "<0>" /* system is unusable */ 37#define KERN_EMERG "<0>" /* system is unusable */
34#define KERN_ALERT "<1>" /* action must be taken immediately */ 38#define KERN_ALERT "<1>" /* action must be taken immediately */
@@ -75,7 +79,7 @@ extern int cond_resched(void);
75# define might_sleep() do { might_resched(); } while (0) 79# define might_sleep() do { might_resched(); } while (0)
76#endif 80#endif
77 81
78#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) 82#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
79 83
80#define abs(x) ({ \ 84#define abs(x) ({ \
81 int __x = (x); \ 85 int __x = (x); \
@@ -114,6 +118,8 @@ extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
114 __attribute__ ((format (printf, 3, 4))); 118 __attribute__ ((format (printf, 3, 4)));
115extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 119extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
116 __attribute__ ((format (printf, 3, 0))); 120 __attribute__ ((format (printf, 3, 0)));
121extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
122 __attribute__ ((format (printf, 2, 3)));
117 123
118extern int sscanf(const char *, const char *, ...) 124extern int sscanf(const char *, const char *, ...)
119 __attribute__ ((format (scanf, 2, 3))); 125 __attribute__ ((format (scanf, 2, 3)));
@@ -331,6 +337,12 @@ struct sysinfo {
331/* Force a compilation error if condition is true */ 337/* Force a compilation error if condition is true */
332#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 338#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
333 339
340/* Force a compilation error if condition is true, but also produce a
341 result (of value 0 and type size_t), so the expression can be used
342 e.g. in a structure initializer (or where-ever else comma expressions
343 aren't permitted). */
344#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
345
334/* Trap pasters of __FUNCTION__ at compile-time */ 346/* Trap pasters of __FUNCTION__ at compile-time */
335#define __FUNCTION__ (__func__) 347#define __FUNCTION__ (__func__)
336 348