linux-old/include/linux/kernel.h
<<
>>
Prefs
   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 <stdarg.h>
  11#include <linux/linkage.h>
  12
  13#define INT_MAX         ((int)(~0U>>1))
  14#define UINT_MAX        (~0U)
  15#define LONG_MAX        ((long)(~0UL>>1))
  16#define ULONG_MAX       (~0UL)
  17
  18#define STACK_MAGIC     0xdeadbeef
  19
  20#define KERN_EMERG      "<0>"   /* system is unusable                   */
  21#define KERN_ALERT      "<1>"   /* action must be taken immediately     */
  22#define KERN_CRIT       "<2>"   /* critical conditions                  */
  23#define KERN_ERR        "<3>"   /* error conditions                     */
  24#define KERN_WARNING    "<4>"   /* warning conditions                   */
  25#define KERN_NOTICE     "<5>"   /* normal but significant condition     */
  26#define KERN_INFO       "<6>"   /* informational                        */
  27#define KERN_DEBUG      "<7>"   /* debug-level messages                 */
  28
  29#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  30# define NORET_TYPE    __volatile__
  31# define ATTRIB_NORET  /**/
  32# define NORET_AND     /**/
  33#else
  34# define NORET_TYPE    /**/
  35# define ATTRIB_NORET  __attribute__((noreturn))
  36# define NORET_AND     noreturn,
  37#endif
  38
  39extern void math_error(void);
  40NORET_TYPE void panic(const char * fmt, ...)
  41        __attribute__ ((NORET_AND format (printf, 1, 2)));
  42NORET_TYPE void do_exit(long error_code)
  43        ATTRIB_NORET;
  44extern unsigned long simple_strtoul(const char *,char **,unsigned int);
  45extern int sprintf(char * buf, const char * fmt, ...);
  46extern int vsprintf(char *buf, const char *, va_list);
  47
  48extern int session_of_pgrp(int pgrp);
  49
  50extern int kill_proc(int pid, int sig, int priv);
  51extern int kill_pg(int pgrp, int sig, int priv);
  52extern int kill_sl(int sess, int sig, int priv);
  53
  54asmlinkage int printk(const char * fmt, ...)
  55        __attribute__ ((format (printf, 1, 2)));
  56
  57/*
  58 * This is defined as a macro, but at some point this might become a
  59 * real subroutine that sets a flag if it returns true (to do
  60 * BSD-style accounting where the process is flagged if it uses root
  61 * privs).  The implication of this is that you should do normal
  62 * permissions checks first, and check suser() last.
  63 *
  64 * "suser()" checks against the effective user id, while "fsuser()"
  65 * is used for file permission checking and checks against the fsuid..
  66 */
  67#define suser() (current->euid == 0)
  68#define fsuser() (current->fsuid == 0)
  69
  70#endif /* __KERNEL__ */
  71
  72#define SI_LOAD_SHIFT   16
  73struct sysinfo {
  74        long uptime;                    /* Seconds since boot */
  75        unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
  76        unsigned long totalram;         /* Total usable main memory size */
  77        unsigned long freeram;          /* Available memory size */
  78        unsigned long sharedram;        /* Amount of shared memory */
  79        unsigned long bufferram;        /* Memory used by buffers */
  80        unsigned long totalswap;        /* Total swap space size */
  81        unsigned long freeswap;         /* swap space still available */
  82        unsigned short procs;           /* Number of current processes */
  83        char _f[22];                    /* Pads structure to 64 bytes */
  84};
  85
  86#endif
  87
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.