diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
commit | 7a53c7f56bbfc9b0ef892e68f5cfae3d902544d1 (patch) | |
tree | 19dec256fc80ad06d631ece78b9eb68a457ce66b /include/linux/kernel.h | |
parent | e57130698fe3dd2b7d617d90bbf86474473cb40c (diff) | |
parent | 012abeea669ea49636cf952d13298bb68654146a (diff) |
Merge commit 'v2.6.32-rc5' into for-linus
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2b5b1e0899a8..f4e3184fa054 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -146,7 +146,7 @@ extern int _cond_resched(void); | |||
146 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) | 146 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) |
147 | 147 | ||
148 | #define abs(x) ({ \ | 148 | #define abs(x) ({ \ |
149 | int __x = (x); \ | 149 | long __x = (x); \ |
150 | (__x < 0) ? -__x : __x; \ | 150 | (__x < 0) ? -__x : __x; \ |
151 | }) | 151 | }) |
152 | 152 | ||
@@ -246,14 +246,16 @@ extern int printk_ratelimit(void); | |||
246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
247 | unsigned int interval_msec); | 247 | unsigned int interval_msec); |
248 | 248 | ||
249 | extern int printk_delay_msec; | ||
250 | |||
249 | /* | 251 | /* |
250 | * Print a one-time message (analogous to WARN_ONCE() et al): | 252 | * Print a one-time message (analogous to WARN_ONCE() et al): |
251 | */ | 253 | */ |
252 | #define printk_once(x...) ({ \ | 254 | #define printk_once(x...) ({ \ |
253 | static int __print_once = 1; \ | 255 | static bool __print_once = true; \ |
254 | \ | 256 | \ |
255 | if (__print_once) { \ | 257 | if (__print_once) { \ |
256 | __print_once = 0; \ | 258 | __print_once = false; \ |
257 | printk(x); \ | 259 | printk(x); \ |
258 | } \ | 260 | } \ |
259 | }) | 261 | }) |
@@ -657,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info); | |||
657 | 659 | ||
658 | #endif /* __KERNEL__ */ | 660 | #endif /* __KERNEL__ */ |
659 | 661 | ||
662 | #ifndef __EXPORTED_HEADERS__ | ||
663 | #ifndef __KERNEL__ | ||
664 | #warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders | ||
665 | #endif /* __KERNEL__ */ | ||
666 | #endif /* __EXPORTED_HEADERS__ */ | ||
667 | |||
660 | #define SI_LOAD_SHIFT 16 | 668 | #define SI_LOAD_SHIFT 16 |
661 | struct sysinfo { | 669 | struct sysinfo { |
662 | long uptime; /* Seconds since boot */ | 670 | long uptime; /* Seconds since boot */ |
@@ -676,13 +684,17 @@ struct sysinfo { | |||
676 | }; | 684 | }; |
677 | 685 | ||
678 | /* Force a compilation error if condition is true */ | 686 | /* Force a compilation error if condition is true */ |
679 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 687 | #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) |
688 | |||
689 | /* Force a compilation error if condition is constant and true */ | ||
690 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) | ||
680 | 691 | ||
681 | /* Force a compilation error if condition is true, but also produce a | 692 | /* Force a compilation error if condition is true, but also produce a |
682 | result (of value 0 and type size_t), so the expression can be used | 693 | result (of value 0 and type size_t), so the expression can be used |
683 | e.g. in a structure initializer (or where-ever else comma expressions | 694 | e.g. in a structure initializer (or where-ever else comma expressions |
684 | aren't permitted). */ | 695 | aren't permitted). */ |
685 | #define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) | 696 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
697 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
686 | 698 | ||
687 | /* Trap pasters of __FUNCTION__ at compile-time */ | 699 | /* Trap pasters of __FUNCTION__ at compile-time */ |
688 | #define __FUNCTION__ (__func__) | 700 | #define __FUNCTION__ (__func__) |