root/include/linux/kernel.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_KERNEL_H
   2 #define _LINUX_KERNEL_H
   3 
   4 /*
   5  * 'kernel.h' contains some often-used function prototypes etc
   6  */
   7 
   8 #ifdef __KERNEL__
   9 
  10 #include <linux/config.h>
  11 
  12 #define INT_MAX         ((int)(~0U>>1))
  13 #define UINT_MAX        (~0U)
  14 #define LONG_MAX        ((long)(~0UL>>1))
  15 #define ULONG_MAX       (~0UL)
  16 
  17 #define VERIFY_READ 0
  18 #define VERIFY_WRITE 1
  19 
  20 int verify_area(int type, void * addr, unsigned long count);
  21 
  22 extern void math_error(void);
  23 volatile void panic(const char * str);
  24 volatile void do_exit(long error_code);
  25 unsigned long simple_strtoul(const char *,char **,unsigned int);
  26 int sprintf(char * buf, const char * fmt, ...);
  27 
  28 extern "C" int printk(const char * fmt, ...);
  29 
  30 #ifdef CONFIG_DEBUG_MALLOC
  31 #define kmalloc(a,b) deb_kmalloc(__FILE__,__LINE__, a,b)
  32 #define kfree_s(a,b) deb_kfree_s(__FILE__,__LINE__,a,b)
  33 
  34 void *deb_kmalloc(const char *deb_file, unsigned short deb_line,unsigned int size, int priority);
  35 void deb_kfree_s (const char *deb_file, unsigned short deb_line,void * obj, int size);
  36 void deb_kcheck_s(const char *deb_file, unsigned short deb_line,void * obj, int size);
  37 
  38 #define kfree(a) deb_kfree_s(__FILE__,__LINE__, a,0)
  39 #define kcheck(a) deb_kcheck_s(__FILE__,__LINE__, a,0)
  40 #define kcheck_s(a,b) deb_kcheck_s(__FILE__,__LINE__, a,b)
  41 
  42 #else /* !debug */
  43 
  44 void * kmalloc(unsigned int size, int priority);
  45 void kfree_s(void * obj, int size);
  46 
  47 #define kcheck_s(a,b) 0
  48 
  49 #define kfree(x) kfree_s((x), 0)
  50 #define kcheck(x) kcheck_s((x), 0)
  51 
  52 #endif
  53 
  54 
  55 /*
  56  * This is defined as a macro, but at some point this might become a
  57  * real subroutine that sets a flag if it returns true (to do
  58  * BSD-style accounting where the process is flagged if it uses root
  59  * privs).  The implication of this is that you should do normal
  60  * permissions checks first, and check suser() last.
  61  */
  62 #define suser() (current->euid == 0)
  63 
  64 #endif /* __KERNEL__ */
  65 
  66 #define SI_LOAD_SHIFT   16
  67 struct sysinfo {
  68         long uptime;                    /* Seconds since boot */
  69         unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
  70         unsigned long totalram;         /* Total usable main memory size */
  71         unsigned long freeram;          /* Available memory size */
  72         unsigned long sharedram;        /* Amount of shared memory */
  73         unsigned long bufferram;        /* Memory used by buffers */
  74         unsigned long totalswap;        /* Total swap space size */
  75         unsigned long freeswap;         /* swap space still available */
  76         unsigned short procs;           /* Number of current processes */
  77         char _f[22];                    /* Pads structure to 64 bytes */
  78 };
  79 
  80 #endif

/* [previous][next][first][last][top][bottom][index][help] */