kernel.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _LINUX_KERNEL_H
  2. #define _LINUX_KERNEL_H
  3. /*
  4. * 'kernel.h' contains some often-used function prototypes etc
  5. */
  6. #define SI_LOAD_SHIFT 16
  7. struct sysinfo {
  8. long uptime; /* Seconds since boot */
  9. unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
  10. unsigned long totalram; /* Total usable main memory size */
  11. unsigned long freeram; /* Available memory size */
  12. unsigned long sharedram; /* Amount of shared memory */
  13. unsigned long bufferram; /* Memory used by buffers */
  14. unsigned long totalswap; /* Total swap space size */
  15. unsigned long freeswap; /* swap space still available */
  16. unsigned short procs; /* Number of current processes */
  17. unsigned short pad; /* explicit padding for m68k */
  18. unsigned long totalhigh; /* Total high memory size */
  19. unsigned long freehigh; /* Available high memory size */
  20. unsigned int mem_unit; /* Memory unit size in bytes */
  21. char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
  22. };
  23. /* Force a compilation error if condition is true */
  24. #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
  25. /* Force a compilation error if condition is constant and true */
  26. #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
  27. /* Force a compilation error if a constant expression is not a power of 2 */
  28. #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
  29. BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
  30. /* Force a compilation error if condition is true, but also produce a
  31. result (of value 0 and type size_t), so the expression can be used
  32. e.g. in a structure initializer (or where-ever else comma expressions
  33. aren't permitted). */
  34. #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
  35. #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
  36. /* Trap pasters of __FUNCTION__ at compile-time */
  37. #define __FUNCTION__ (__func__)
  38. /* This helps us to avoid #ifdef CONFIG_NUMA */
  39. #ifdef CONFIG_NUMA
  40. #define NUMA_BUILD 1
  41. #else
  42. #define NUMA_BUILD 0
  43. #endif
  44. /* This helps us avoid #ifdef CONFIG_COMPACTION */
  45. #ifdef CONFIG_COMPACTION
  46. #define COMPACTION_BUILD 1
  47. #else
  48. #define COMPACTION_BUILD 0
  49. #endif
  50. /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
  51. #ifdef CONFIG_FTRACE_MCOUNT_RECORD
  52. # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
  53. #endif
  54. struct module;
  55. void mark_hardware_unsupported(const char *msg);
  56. void mark_tech_preview(const char *msg, struct module *mod);
  57. #endif