source: GPL/include/linux/kernel.h@ 1

Last change on this file since 1 was 1, checked in by vladest, 20 years ago

initial import

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