#ifndef _LINUX_KERNEL_H
|
#ifndef _LINUX_KERNEL_H
|
#define _LINUX_KERNEL_H
|
#define _LINUX_KERNEL_H
|
|
|
/*
|
/*
|
* 'kernel.h' contains some often-used function prototypes etc
|
* 'kernel.h' contains some often-used function prototypes etc
|
*/
|
*/
|
|
|
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
|
|
#include <stdarg.h>
|
#include <stdarg.h>
|
#include <linux/linkage.h>
|
#include <linux/linkage.h>
|
|
|
/* Optimization barrier */
|
/* Optimization barrier */
|
#define barrier() __asm__("": : :"memory")
|
#define barrier() __asm__("": : :"memory")
|
|
|
#define INT_MAX ((int)(~0U>>1))
|
#define INT_MAX ((int)(~0U>>1))
|
#define UINT_MAX (~0U)
|
#define UINT_MAX (~0U)
|
#define LONG_MAX ((long)(~0UL>>1))
|
#define LONG_MAX ((long)(~0UL>>1))
|
#define ULONG_MAX (~0UL)
|
#define ULONG_MAX (~0UL)
|
|
|
#define STACK_MAGIC 0xdeadbeef
|
#define STACK_MAGIC 0xdeadbeef
|
#define STACK_UNTOUCHED_MAGIC 0xfeef1ef0
|
#define STACK_UNTOUCHED_MAGIC 0xfeef1ef0
|
|
|
#define KERN_EMERG "<0>" /* system is unusable */
|
#define KERN_EMERG "<0>" /* system is unusable */
|
#define KERN_ALERT "<1>" /* action must be taken immediately */
|
#define KERN_ALERT "<1>" /* action must be taken immediately */
|
#define KERN_CRIT "<2>" /* critical conditions */
|
#define KERN_CRIT "<2>" /* critical conditions */
|
#define KERN_ERR "<3>" /* error conditions */
|
#define KERN_ERR "<3>" /* error conditions */
|
#define KERN_WARNING "<4>" /* warning conditions */
|
#define KERN_WARNING "<4>" /* warning conditions */
|
#define KERN_NOTICE "<5>" /* normal but significant condition */
|
#define KERN_NOTICE "<5>" /* normal but significant condition */
|
#define KERN_INFO "<6>" /* informational */
|
#define KERN_INFO "<6>" /* informational */
|
#define KERN_DEBUG "<7>" /* debug-level messages */
|
#define KERN_DEBUG "<7>" /* debug-level messages */
|
|
|
# define NORET_TYPE /**/
|
# define NORET_TYPE /**/
|
# define ATTRIB_NORET __attribute__((noreturn))
|
# define ATTRIB_NORET __attribute__((noreturn))
|
# define NORET_AND noreturn,
|
# define NORET_AND noreturn,
|
|
|
extern void math_error(void);
|
extern void math_error(void);
|
NORET_TYPE void panic(const char * fmt, ...)
|
NORET_TYPE void panic(const char * fmt, ...)
|
__attribute__ ((NORET_AND format (printf, 1, 2)));
|
__attribute__ ((NORET_AND format (printf, 1, 2)));
|
NORET_TYPE void do_exit(long error_code)
|
NORET_TYPE void do_exit(long error_code)
|
ATTRIB_NORET;
|
ATTRIB_NORET;
|
extern unsigned long simple_strtoul(const char *,char **,unsigned int);
|
extern unsigned long simple_strtoul(const char *,char **,unsigned int);
|
extern int sprintf(char * buf, const char * fmt, ...);
|
extern int sprintf(char * buf, const char * fmt, ...);
|
extern int vsprintf(char *buf, const char *, va_list);
|
extern int vsprintf(char *buf, const char *, va_list);
|
|
|
extern int session_of_pgrp(int pgrp);
|
extern int session_of_pgrp(int pgrp);
|
|
|
extern int kill_proc(int pid, int sig, int priv);
|
extern int kill_proc(int pid, int sig, int priv);
|
extern int kill_pg(int pgrp, int sig, int priv);
|
extern int kill_pg(int pgrp, int sig, int priv);
|
extern int kill_sl(int sess, int sig, int priv);
|
extern int kill_sl(int sess, int sig, int priv);
|
|
|
asmlinkage int printk(const char * fmt, ...)
|
asmlinkage int printk(const char * fmt, ...)
|
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
|
|
#if DEBUG
|
#if DEBUG
|
#define pr_debug(fmt,arg...) \
|
#define pr_debug(fmt,arg...) \
|
printk(KERN_DEBUG fmt,##arg)
|
printk(KERN_DEBUG fmt,##arg)
|
#else
|
#else
|
#define pr_debug(fmt,arg...) \
|
#define pr_debug(fmt,arg...) \
|
do { } while (0)
|
do { } while (0)
|
#endif
|
#endif
|
|
|
#define pr_info(fmt,arg...) \
|
#define pr_info(fmt,arg...) \
|
printk(KERN_INFO fmt,##arg)
|
printk(KERN_INFO fmt,##arg)
|
|
|
/*
|
/*
|
* "suser()" checks against the effective user id, while "fsuser()"
|
* "suser()" checks against the effective user id, while "fsuser()"
|
* is used for file permission checking and checks against the fsuid..
|
* is used for file permission checking and checks against the fsuid..
|
*/
|
*/
|
#define fsuser() (current->fsuid == 0)
|
#define fsuser() (current->fsuid == 0)
|
|
|
/*
|
/*
|
* Display an IP address in readable format.
|
* Display an IP address in readable format.
|
*/
|
*/
|
|
|
#define NIPQUAD(addr) \
|
#define NIPQUAD(addr) \
|
(((addr) >> 0) & 0xff), \
|
(((addr) >> 0) & 0xff), \
|
(((addr) >> 8) & 0xff), \
|
(((addr) >> 8) & 0xff), \
|
(((addr) >> 16) & 0xff), \
|
(((addr) >> 16) & 0xff), \
|
(((addr) >> 24) & 0xff)
|
(((addr) >> 24) & 0xff)
|
|
|
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
|
|
#define SI_LOAD_SHIFT 16
|
#define SI_LOAD_SHIFT 16
|
struct sysinfo {
|
struct sysinfo {
|
long uptime; /* Seconds since boot */
|
long uptime; /* Seconds since boot */
|
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
unsigned long totalram; /* Total usable main memory size */
|
unsigned long totalram; /* Total usable main memory size */
|
unsigned long freeram; /* Available memory size */
|
unsigned long freeram; /* Available memory size */
|
unsigned long sharedram; /* Amount of shared memory */
|
unsigned long sharedram; /* Amount of shared memory */
|
unsigned long bufferram; /* Memory used by buffers */
|
unsigned long bufferram; /* Memory used by buffers */
|
unsigned long totalswap; /* Total swap space size */
|
unsigned long totalswap; /* Total swap space size */
|
unsigned long freeswap; /* swap space still available */
|
unsigned long freeswap; /* swap space still available */
|
unsigned short procs; /* Number of current processes */
|
unsigned short procs; /* Number of current processes */
|
char _f[22]; /* Pads structure to 64 bytes */
|
char _f[22]; /* Pads structure to 64 bytes */
|
};
|
};
|
|
|
#endif
|
#endif
|
|
|