Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

kernel.h

Go to the documentation of this file.
00001 #ifndef _LINUX_KERNEL_H
00002 #define _LINUX_KERNEL_H
00003 
00004 /*
00005  * 'kernel.h' contains some often-used function prototypes etc
00006  */
00007 
00008 #ifdef __KERNEL__
00009 
00010 #include <stdarg.h>
00011 #include <linux/linkage.h>
00012 
00013 /* Optimization barrier */
00014 /* The "volatile" is due to gcc bugs */
00015 #define barrier() __asm__ __volatile__("": : :"memory")
00016 
00017 #define INT_MAX         ((int)(~0U>>1))
00018 #define UINT_MAX        (~0U)
00019 #define LONG_MAX        ((long)(~0UL>>1))
00020 #define ULONG_MAX       (~0UL)
00021 
00022 #define STACK_MAGIC     0xdeadbeef
00023 
00024 #define KERN_EMERG      "<0>"   /* system is unusable                   */
00025 #define KERN_ALERT      "<1>"   /* action must be taken immediately     */
00026 #define KERN_CRIT       "<2>"   /* critical conditions                  */
00027 #define KERN_ERR        "<3>"   /* error conditions                     */
00028 #define KERN_WARNING    "<4>"   /* warning conditions                   */
00029 #define KERN_NOTICE     "<5>"   /* normal but significant condition     */
00030 #define KERN_INFO       "<6>"   /* informational                        */
00031 #define KERN_DEBUG      "<7>"   /* debug-level messages                 */
00032 
00033 # define NORET_TYPE    /**/
00034 # define ATTRIB_NORET  __attribute__((noreturn))
00035 # define NORET_AND     noreturn,
00036 
00037 #ifdef __i386__
00038 #define FASTCALL(x)     x __attribute__((regparm(3)))
00039 #else
00040 #define FASTCALL(x)     x
00041 #endif
00042 
00043 extern void math_error(void);
00044 extern struct notifier_block *panic_notifier_list;
00045 NORET_TYPE void panic(const char * fmt, ...)
00046         __attribute__ ((NORET_AND format (printf, 1, 2)));
00047 NORET_TYPE void do_exit(long error_code)
00048         ATTRIB_NORET;
00049 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
00050 extern long simple_strtol(const char *,char **,unsigned int);
00051 extern char *get_options(char *str, int *ints);
00052 extern int sprintf(char *buf, const char *fmt, ...)
00053         __attribute__ ((format (printf, 2, 3)));
00054 extern int vsprintf(char *buf, const char *, va_list)
00055         __attribute__ ((format (printf, 2, 0)));
00056 extern int _vsnprintf(char *buf, int n, const char *, va_list)
00057         __attribute__ ((format (printf, 3, 0)));
00058 
00059 extern int session_of_pgrp(int pgrp);
00060 
00061 asmlinkage int printk(const char * fmt, ...)
00062         __attribute__ ((format (printf, 1, 2)));
00063 
00064 #if DEBUG
00065 #define pr_debug(fmt,arg...) \
00066         printk(KERN_DEBUG fmt,##arg)
00067 #else
00068 #define pr_debug(fmt,arg...) \
00069         do { } while (0)
00070 #endif
00071 
00072 #define pr_info(fmt,arg...) \
00073         printk(KERN_INFO fmt,##arg)
00074 
00075 /*
00076  *      Display an IP address in readable format.
00077  */
00078 
00079 #define NIPQUAD(addr) \
00080         ((unsigned char *)&addr)[0], \
00081         ((unsigned char *)&addr)[1], \
00082         ((unsigned char *)&addr)[2], \
00083         ((unsigned char *)&addr)[3]
00084 
00085 #endif /* __KERNEL__ */
00086 
00087 #define SI_LOAD_SHIFT   16
00088 struct sysinfo {
00089         long uptime;                    /* Seconds since boot */
00090         unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
00091         unsigned long totalram;         /* Total usable main memory size */
00092         unsigned long freeram;          /* Available memory size */
00093         unsigned long sharedram;        /* Amount of shared memory */
00094         unsigned long bufferram;        /* Memory used by buffers */
00095         unsigned long totalswap;        /* Total swap space size */
00096         unsigned long freeswap;         /* swap space still available */
00097         unsigned short procs;           /* Number of current processes */
00098         char _f[22];                    /* Pads structure to 64 bytes */
00099 };
00100 
00101 #endif