bug.h 712 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _ASM_GENERIC_BUG_H
  2. #define _ASM_GENERIC_BUG_H
  3. #include <linux/compiler.h>
  4. #include <linux/config.h>
  5. #ifndef HAVE_ARCH_BUG
  6. #define BUG() do { \
  7. printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
  8. panic("BUG!"); \
  9. } while (0)
  10. #endif
  11. #ifndef HAVE_ARCH_PAGE_BUG
  12. #define PAGE_BUG(page) do { \
  13. printk("page BUG for page at %p\n", page); \
  14. BUG(); \
  15. } while (0)
  16. #endif
  17. #ifndef HAVE_ARCH_BUG_ON
  18. #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
  19. #endif
  20. #ifndef HAVE_ARCH_WARN_ON
  21. #define WARN_ON(condition) do { \
  22. if (unlikely((condition)!=0)) { \
  23. printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
  24. dump_stack(); \
  25. } \
  26. } while (0)
  27. #endif
  28. #endif