source: GPL/trunk/include/linux/kernel.h@ 598

Last change on this file since 598 was 598, checked in by David Azarewicz, 8 years ago

Merged/reintegrated v2 branch into trunk. Trunk is now v2

File size: 3.2 KB
Line 
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 <stdlib.h>
11#include <stdarg.h>
12//#include <linux/linkage.h>
13
14/* Optimization barrier */
15/* The "volatile" is due to gcc bugs */
16//#define barrier() __asm__ __volatile__("": : :"memory")
17#define barrier()
18
19#define STACK_MAGIC 0xdeadbeef
20
21#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
22
23#define KERN_EMERG "<0>" /* system is unusable */
24#define KERN_ALERT "<1>" /* action must be taken immediately */
25#define KERN_CRIT "<2>" /* critical conditions */
26#define KERN_ERR "<3>" /* error conditions */
27#define KERN_WARNING "<4>" /* warning conditions */
28#define KERN_NOTICE "<5>" /* normal but significant condition */
29#define KERN_INFO "<6>" /* informational */
30#define KERN_DEBUG "<7>" /* debug-level messages */
31
32# define NORET_TYPE /**/
33# define ATTRIB_NORET __attribute__((noreturn))
34# define NORET_AND noreturn,
35
36#ifdef __i386__
37#define FASTCALL(x) x __attribute__((regparm(3)))
38#else
39#define FASTCALL(x) x
40#endif
41
42extern void math_error(void);
43extern struct notifier_block *panic_notifier_list;
44NORET_TYPE void panic(const char * fmt, ...);
45
46NORET_TYPE void do_exit(long error_code);
47
48#define simple_strtoul strtoul
49extern long simple_strtol(const char *,char **,unsigned int);
50extern int sprintf(char * buf, const char * fmt, ...);
51extern int vsprintf(char *buf, const char *, va_list);
52extern int get_option(char **str, int *pint);
53extern char *get_options(char *str, int nints, int *ints);
54
55extern int session_of_pgrp(int pgrp);
56
57int cdecl printk(const char * fmt, ...);
58
59
60#if DEBUG
61#define pr_debug(fmt,arg)
62#else
63#define pr_debug(fmt,arg)
64#endif
65
66#define pr_info(fmt,arg) \
67 printk(KERN_INFO fmt,##arg)
68
69/*
70 * Display an IP address in readable format.
71 */
72
73#define NIPQUAD(addr) \
74 ((unsigned char *)&addr)[0], \
75 ((unsigned char *)&addr)[1], \
76 ((unsigned char *)&addr)[2], \
77 ((unsigned char *)&addr)[3]
78
79#endif /* __KERNEL__ */
80
81#define SI_LOAD_SHIFT 16
82struct sysinfo {
83 long uptime; /* Seconds since boot */
84 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
85 unsigned long totalram; /* Total usable main memory size */
86 unsigned long freeram; /* Available memory size */
87 unsigned long sharedram; /* Amount of shared memory */
88 unsigned long bufferram; /* Memory used by buffers */
89 unsigned long totalswap; /* Total swap space size */
90 unsigned long freeswap; /* swap space still available */
91 unsigned short procs; /* Number of current processes */
92 unsigned long totalhigh; /* Total high memory size */
93 unsigned long freehigh; /* Available high memory size */
94 unsigned int mem_unit; /* Memory unit size in bytes */
95 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
96};
97
98static void complete_and_exit(struct completion *, long);
99#define printk_ratelimit() 1
100#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
101#define dump_stack()
102#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
103#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
104int strict_strtoul(const char *, unsigned int, unsigned long *);
105
106#endif
Note: See TracBrowser for help on using the repository browser.