kernel.h

Go to the documentation of this file.
00001 #ifndef _LINUX_KERNEL_H
00002 #define _LINUX_KERNEL_H
00003 
00004 /**
00005 *
00006 
00007  * 'kernel.h' contains some often-used function prototypes etc
00008 
00009 
00010 */
00011 
00012 #ifdef __KERNEL__
00013 
00014 #include <linux/linkage.h>
00015 
00016 #define INT_MAX         ((int)(~0U>>1))
00017 #define UINT_MAX        (~0U)
00018 #define LONG_MAX        ((long)(~0UL>>1))
00019 #define ULONG_MAX       (~0UL)
00020 
00021 #define KERN_EMERG      "<0>"   ///< system is unusable                 
00022 #define KERN_ALERT      "<1>"   ///< action must be taken immediately   
00023 #define KERN_CRIT       "<2>"   ///< critical conditions                        
00024 #define KERN_ERR        "<3>"   ///< error conditions                   
00025 #define KERN_WARNING    "<4>"   ///< warning conditions                 
00026 #define KERN_NOTICE     "<5>"   ///< normal but significant condition   
00027 #define KERN_INFO       "<6>"   ///< informational                      
00028 #define KERN_DEBUG      "<7>"   ///< debug-level messages                       
00029 
00030 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
00031 # define NORET_TYPE    __volatile__
00032 # define ATTRIB_NORET  ///<
00033 # define NORET_AND     ///<
00034 #else
00035 # define NORET_TYPE    ///<
00036 # define ATTRIB_NORET  __attribute__((noreturn))
00037 # define NORET_AND     noreturn,
00038 #endif
00039 
00040 extern void math_error(void);
00041 NORET_TYPE void panic(const char * fmt, ...)
00042         __attribute__ ((NORET_AND format (printf, 1, 2)));
00043 NORET_TYPE void do_exit(long error_code)
00044         ATTRIB_NORET;
00045 unsigned long simple_strtoul(const char *,char **,unsigned int);
00046 int sprintf(char * buf, const char * fmt, ...);
00047 
00048 int session_of_pgrp(int pgrp);
00049 
00050 int kill_proc(int pid, int sig, int priv);
00051 int kill_pg(int pgrp, int sig, int priv);
00052 int kill_sl(int sess, int sig, int priv);
00053 
00054 asmlinkage int printk(const char * fmt, ...)
00055         __attribute__ ((format (printf, 1, 2)));
00056 
00057 /**
00058 *
00059 
00060  * This is defined as a macro, but at some point this might become a
00061  * real subroutine that sets a flag if it returns true (to do
00062  * BSD-style accounting where the process is flagged if it uses root
00063  * privs).  The implication of this is that you should do normal
00064  * permissions checks first, and check suser() last.
00065 
00066 
00067 */
00068 #define suser() (current->euid == 0)
00069 
00070 #endif // __KERNEL__ 
00071 
00072 #define SI_LOAD_SHIFT   16
00073 struct sysinfo {
00074         long uptime;                    ///< Seconds since boot 
00075         unsigned long loads[3];         ///< 1, 5, and 15 minute load averages 
00076         unsigned long totalram;         ///< Total usable main memory size 
00077         unsigned long freeram;          ///< Available memory size 
00078         unsigned long sharedram;        ///< Amount of shared memory 
00079         unsigned long bufferram;        ///< Memory used by buffers 
00080         unsigned long totalswap;        ///< Total swap space size 
00081         unsigned long freeswap;         ///< swap space still available 
00082         unsigned short procs;           ///< Number of current processes 
00083         char _f[22];                    ///< Pads structure to 64 bytes 
00084 };
00085 
00086 #endif

Generated on Mon May 1 21:47:00 2006 for KernelAPI by  doxygen 1.4.6-5