1 #ifndef _LINUX_KERNEL_H
2 #define _LINUX_KERNEL_H
5 * 'kernel.h' contains some often-used function prototypes etc
11 #include <linux/linkage.h>
13 /* Optimization barrier */
14 /* The "volatile" is due to gcc bugs */
15 #define barrier() __asm__ __volatile__("": : :"memory")
17 #define INT_MAX ((int)(~0U>>1))
18 #define UINT_MAX (~0U)
19 #define LONG_MAX ((long)(~0UL>>1))
20 #define ULONG_MAX (~0UL)
22 #define STACK_MAGIC 0xdeadbeef
24 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
26 #define KERN_EMERG "<0>" /* system is unusable */
27 #define KERN_ALERT "<1>" /* action must be taken immediately */
28 #define KERN_CRIT "<2>" /* critical conditions */
29 #define KERN_ERR "<3>" /* error conditions */
30 #define KERN_WARNING "<4>" /* warning conditions */
31 #define KERN_NOTICE "<5>" /* normal but significant condition */
32 #define KERN_INFO "<6>" /* informational */
33 #define KERN_DEBUG "<7>" /* debug-level messages */
35 # define NORET_TYPE /**/
36 # define ATTRIB_NORET __attribute__((noreturn))
37 # define NORET_AND noreturn,
40 #define FASTCALL(x) x __attribute__((regparm(3)))
45 extern void math_error(void);
46 extern struct notifier_block
*panic_notifier_list
;
47 NORET_TYPE
void panic(const char * fmt
, ...)
48 __attribute__ ((NORET_AND
format (printf
, 1, 2)));
49 NORET_TYPE
void do_exit(long error_code
)
51 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
52 extern long simple_strtol(const char *,char **,unsigned int);
53 extern int sprintf(char * buf
, const char * fmt
, ...);
54 extern int vsprintf(char *buf
, const char *, va_list);
55 extern int get_option(char **str
, int *pint
);
56 extern char *get_options(char *str
, int nints
, int *ints
);
58 extern int session_of_pgrp(int pgrp
);
60 asmlinkage
int printk(const char * fmt
, ...)
61 __attribute__ ((format (printf
, 1, 2)));
64 #define pr_debug(fmt,arg...) \
65 printk(KERN_DEBUG fmt,##arg)
67 #define pr_debug(fmt,arg...) \
71 #define pr_info(fmt,arg...) \
72 printk(KERN_INFO fmt,##arg)
75 * Display an IP address in readable format.
78 #define NIPQUAD(addr) \
79 ((unsigned char *)&addr)[0], \
80 ((unsigned char *)&addr)[1], \
81 ((unsigned char *)&addr)[2], \
82 ((unsigned char *)&addr)[3]
84 #endif /* __KERNEL__ */
86 #define SI_LOAD_SHIFT 16
88 long uptime
; /* Seconds since boot */
89 unsigned long loads
[3]; /* 1, 5, and 15 minute load averages */
90 unsigned long totalram
; /* Total usable main memory size */
91 unsigned long freeram
; /* Available memory size */
92 unsigned long sharedram
; /* Amount of shared memory */
93 unsigned long bufferram
; /* Memory used by buffers */
94 unsigned long totalswap
; /* Total swap space size */
95 unsigned long freeswap
; /* swap space still available */
96 unsigned short procs
; /* Number of current processes */
97 unsigned long totalbig
; /* Total big memory size */
98 unsigned long freebig
; /* Available big memory size */
99 char _f
[20-2*sizeof(long)]; /* Padding: libc5 uses this.. */