include/linux/kernel.h
14924 #ifndef _LINUX_KERNEL_H
14925 #define _LINUX_KERNEL_H
14926
14927 /* 'kernel.h' contains some often-used function
14928 * prototypes etc */
14929
14930 #ifdef __KERNEL__
14931
14932 #include <stdarg.h>
14933 #include <linux/linkage.h>
14934
14935 /* Optimization barrier */
14936 /* The "volatile" is due to gcc bugs */
14937 #define barrier() __asm__ __volatile__("": : :"memory")
14938
14939 #define INT_MAX ((int)(~0U>>1))
14940 #define UINT_MAX (~0U)
14941 #define LONG_MAX ((long)(~0UL>>1))
14942 #define ULONG_MAX (~0UL)
14943
14944 #define STACK_MAGIC 0xdeadbeef
14945
14946 #define KERN_EMERG "<0>" /* system is unusable */
14947 #define KERN_ALERT "<1>" /* need immediate action */
14948 #define KERN_CRIT "<2>" /* critical conditions */
14949 #define KERN_ERR "<3>" /* error conditions */
14950 #define KERN_WARNING "<4>" /* warning conditions */
14951 #define KERN_NOTICE "<5>" /* normal but significant */
14952 #define KERN_INFO "<6>" /* informational */
14953 #define KERN_DEBUG "<7>" /* debug-level messages */
14954
14955 # define NORET_TYPE /**/
14956 # define ATTRIB_NORET __attribute__((noreturn))
14957 # define NORET_AND noreturn,
14958
14959 #ifdef __i386__
14960 #define FASTCALL(x) x __attribute__((regparm(3)))
14961 #else
14962 #define FASTCALL(x) x
14963 #endif
14964
14965 extern void math_error(void);
14966 NORET_TYPE void panic(const char * fmt, ...)
14967 __attribute__ ((NORET_AND format (printf, 1, 2)));
14968 NORET_TYPE void do_exit(long error_code)
14969 ATTRIB_NORET;
14970 extern unsigned long simple_strtoul(const char *,char **,
14971 unsigned int);
14972 extern long simple_strtol(const char *,char **,
14973 unsigned int);
14974 extern int sprintf(char * buf, const char * fmt, ...);
14975 extern int vsprintf(char *buf, const char *, va_list);
14976
14977 extern int session_of_pgrp(int pgrp);
14978
14979 asmlinkage int printk(const char * fmt, ...)
14980 __attribute__ ((format (printf, 1, 2)));
14981
14982 #if DEBUG
14983 #define pr_debug(fmt,arg...) \
14984 printk(KERN_DEBUG fmt,##arg)
14985 #else
14986 #define pr_debug(fmt,arg...) \
14987 do { } while (0)
14988 #endif
14989
14990 #define pr_info(fmt,arg...) \
14991 printk(KERN_INFO fmt,##arg)
14992
14993 /* Display an IP address in readable format. */
14994
14995 #define NIPQUAD(addr) \
14996 ((unsigned char *)&addr)[0], \
14997 ((unsigned char *)&addr)[1], \
14998 ((unsigned char *)&addr)[2], \
14999 ((unsigned char *)&addr)[3]
15000
15001 #endif /* __KERNEL__ */
15002
15003 #define SI_LOAD_SHIFT 16
15004 struct sysinfo {
15005 long uptime; /* Seconds since boot */
15006 unsigned long loads[3]; /* 1/5/15-min load averages */
15007 unsigned long totalram; /* Total usable main mem sz */
15008 unsigned long freeram; /* Available memory size */
15009 unsigned long sharedram; /* Amount of shared memory */
15010 unsigned long bufferram; /* Memory used by buffers */
15011 unsigned long totalswap; /* Total swap space size */
15012 unsigned long freeswap; /* swap spc still available */
15013 unsigned short procs; /* # of current processes */
15014 char _f[22]; /* Pads struct to 64 bytes */
15015 };
15016
15017 #endif
Сайт управляется системой
uCoz