1 |
30 |
unneback |
/*-
|
2 |
|
|
* Copyright (c) 1982, 1988, 1991, 1993
|
3 |
|
|
* The Regents of the University of California. All rights reserved.
|
4 |
|
|
* (c) UNIX System Laboratories, Inc.
|
5 |
|
|
* All or some portions of this file are derived from material licensed
|
6 |
|
|
* to the University of California by American Telephone and Telegraph
|
7 |
|
|
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
8 |
|
|
* the permission of UNIX System Laboratories, Inc.
|
9 |
|
|
*
|
10 |
|
|
* Redistribution and use in source and binary forms, with or without
|
11 |
|
|
* modification, are permitted provided that the following conditions
|
12 |
|
|
* are met:
|
13 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
14 |
|
|
* notice, this list of conditions and the following disclaimer.
|
15 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
* documentation and/or other materials provided with the distribution.
|
18 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
19 |
|
|
* must display the following acknowledgement:
|
20 |
|
|
* This product includes software developed by the University of
|
21 |
|
|
* California, Berkeley and its contributors.
|
22 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
23 |
|
|
* may be used to endorse or promote products derived from this software
|
24 |
|
|
* without specific prior written permission.
|
25 |
|
|
*
|
26 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
27 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
28 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
29 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
30 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
31 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
32 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
33 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
34 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
35 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
36 |
|
|
* SUCH DAMAGE.
|
37 |
|
|
*
|
38 |
|
|
* @(#)systm.h 8.7 (Berkeley) 3/29/95
|
39 |
|
|
* $Id: systm.h,v 1.2 2001-09-27 12:02:00 chris Exp $
|
40 |
|
|
*/
|
41 |
|
|
|
42 |
|
|
#ifndef _SYS_SYSTM_H_
|
43 |
|
|
#define _SYS_SYSTM_H_
|
44 |
|
|
|
45 |
|
|
#include <machine/cpufunc.h>
|
46 |
|
|
|
47 |
|
|
extern int securelevel; /* system security level (see init(8)) */
|
48 |
|
|
|
49 |
|
|
extern int cold; /* nonzero if we are doing a cold boot */
|
50 |
|
|
extern const char *panicstr; /* panic message */
|
51 |
|
|
extern char version[]; /* system version */
|
52 |
|
|
extern char copyright[]; /* system copyright */
|
53 |
|
|
|
54 |
|
|
extern int nblkdev; /* number of entries in bdevsw */
|
55 |
|
|
extern int nchrdev; /* number of entries in cdevsw */
|
56 |
|
|
extern struct swdevt *swdevt; /* swap-device information */
|
57 |
|
|
extern int nswdev; /* number of swap devices */
|
58 |
|
|
extern int nswap; /* size of swap space */
|
59 |
|
|
|
60 |
|
|
extern int selwait; /* select timeout address */
|
61 |
|
|
|
62 |
|
|
extern u_char curpriority; /* priority of current process */
|
63 |
|
|
|
64 |
|
|
extern int physmem; /* physical memory */
|
65 |
|
|
|
66 |
|
|
extern dev_t dumpdev; /* dump device */
|
67 |
|
|
extern long dumplo; /* offset into dumpdev */
|
68 |
|
|
|
69 |
|
|
extern dev_t rootdev; /* root device */
|
70 |
|
|
extern struct vnode *rootvp; /* vnode equivalent to above */
|
71 |
|
|
|
72 |
|
|
extern dev_t swapdev; /* swapping device */
|
73 |
|
|
extern struct vnode *swapdev_vp;/* vnode equivalent to above */
|
74 |
|
|
|
75 |
|
|
extern int boothowto; /* reboot flags, from console subsystem */
|
76 |
|
|
extern int bootverbose; /* nonzero to print verbose messages */
|
77 |
|
|
|
78 |
|
|
/*
|
79 |
|
|
* General function declarations.
|
80 |
|
|
*/
|
81 |
|
|
void Debugger __P((const char *msg));
|
82 |
|
|
int nullop __P((void));
|
83 |
|
|
int eopnotsupp __P((void));
|
84 |
|
|
int einval __P((void));
|
85 |
|
|
int seltrue __P((dev_t dev, int which, struct proc *p));
|
86 |
|
|
int ureadc __P((int, struct uio *));
|
87 |
|
|
void *hashinit __P((int count, int type, u_long *hashmask));
|
88 |
|
|
void *phashinit __P((int count, int type, u_long *nentries));
|
89 |
|
|
|
90 |
|
|
void panic __P((const char *, ...)) __dead2;
|
91 |
|
|
void boot __P((int)) __dead2;
|
92 |
|
|
void cpu_boot __P((int));
|
93 |
|
|
void tablefull __P((const char *));
|
94 |
|
|
int addlog __P((const char *, ...));
|
95 |
|
|
int kvprintf __P((char const *, void (*)(int, void*), void *, int,
|
96 |
|
|
_BSD_VA_LIST_));
|
97 |
|
|
void log __P((int, const char *, ...));
|
98 |
|
|
int printf __P((const char *, ...));
|
99 |
|
|
int sprintf __P((char *buf, const char *, ...));
|
100 |
|
|
void uprintf __P((const char *, ...));
|
101 |
|
|
void ttyprintf __P((struct tty *, const char *, ...));
|
102 |
|
|
|
103 |
|
|
#define bcopy(f,t,n) memcpy((t),(f),(n))
|
104 |
|
|
#define bzero(p,n) memset((p),(0),(n))
|
105 |
|
|
|
106 |
|
|
int copystr __P((const void *kfaddr, void *kdaddr, size_t len,
|
107 |
|
|
size_t *lencopied));
|
108 |
|
|
int copyinstr __P((const void *udaddr, void *kaddr, size_t len,
|
109 |
|
|
size_t *lencopied));
|
110 |
|
|
int copyin __P((const void *udaddr, void *kaddr, size_t len));
|
111 |
|
|
int copyout __P((const void *kaddr, void *udaddr, size_t len));
|
112 |
|
|
|
113 |
|
|
int fubyte __P((const void *base));
|
114 |
|
|
int fuibyte __P((const void *base));
|
115 |
|
|
int subyte __P((void *base, int byte));
|
116 |
|
|
int suibyte __P((void *base, int byte));
|
117 |
|
|
int fuword __P((const void *base));
|
118 |
|
|
int suword __P((void *base, int word));
|
119 |
|
|
int susword __P((void *base, int word));
|
120 |
|
|
|
121 |
|
|
int hzto __P((struct timeval *tv));
|
122 |
|
|
void realitexpire __P((void *));
|
123 |
|
|
|
124 |
|
|
struct clockframe;
|
125 |
|
|
void hardclock __P((struct clockframe *frame));
|
126 |
|
|
void softclock __P((void));
|
127 |
|
|
void statclock __P((struct clockframe *frame));
|
128 |
|
|
|
129 |
|
|
void startprofclock __P((struct proc *));
|
130 |
|
|
void stopprofclock __P((struct proc *));
|
131 |
|
|
void setstatclockrate __P((int hzrate));
|
132 |
|
|
|
133 |
|
|
void hardupdate __P((long));
|
134 |
|
|
void hardpps __P((struct timeval *tvp, long usec));
|
135 |
|
|
|
136 |
|
|
#include <sys/libkern.h>
|
137 |
|
|
|
138 |
|
|
/* Initialize the world */
|
139 |
|
|
extern void consinit(void);
|
140 |
|
|
extern void usrinfoinit(void);
|
141 |
|
|
extern void cpu_initclocks(void);
|
142 |
|
|
extern void vntblinit(void);
|
143 |
|
|
extern void nchinit(void);
|
144 |
|
|
|
145 |
|
|
/* Finalize the world. */
|
146 |
|
|
void shutdown_nice __P((void));
|
147 |
|
|
|
148 |
|
|
/*
|
149 |
|
|
* Kernel to clock driver interface.
|
150 |
|
|
*/
|
151 |
|
|
void inittodr __P((time_t base));
|
152 |
|
|
void resettodr __P((void));
|
153 |
|
|
void startrtclock __P((void));
|
154 |
|
|
|
155 |
|
|
/* Timeouts */
|
156 |
|
|
typedef void (timeout_t)(void *); /* actual timeout function type */
|
157 |
|
|
typedef timeout_t *timeout_func_t; /* a pointer to this type */
|
158 |
|
|
|
159 |
|
|
void timeout(timeout_func_t, void *, int);
|
160 |
|
|
void untimeout(timeout_func_t, void *);
|
161 |
|
|
void logwakeup __P((void));
|
162 |
|
|
|
163 |
|
|
/* Various other callout lists that modules might want to know about */
|
164 |
|
|
/* shutdown callout list definitions */
|
165 |
|
|
typedef void (*bootlist_fn)(int,void *);
|
166 |
|
|
int at_shutdown(bootlist_fn function, void *arg, int);
|
167 |
|
|
int rm_at_shutdown(bootlist_fn function, void *arg);
|
168 |
|
|
#define SHUTDOWN_PRE_SYNC 0
|
169 |
|
|
#define SHUTDOWN_POST_SYNC 1
|
170 |
|
|
|
171 |
|
|
/* forking */ /* XXX not yet */
|
172 |
|
|
typedef void (*forklist_fn)(struct proc *parent,struct proc *child,int flags);
|
173 |
|
|
int at_fork(forklist_fn function);
|
174 |
|
|
int rm_at_fork(forklist_fn function);
|
175 |
|
|
|
176 |
|
|
/* exiting */
|
177 |
|
|
typedef void (*exitlist_fn)(struct proc *procp);
|
178 |
|
|
int at_exit(exitlist_fn function);
|
179 |
|
|
int rm_at_exit(exitlist_fn function);
|
180 |
|
|
|
181 |
|
|
/* Not exactly a callout LIST, but a callout entry.. */
|
182 |
|
|
/* Allow an external module to define a hardware watchdog tickler */
|
183 |
|
|
/* Normally a process would do this, but there are times when the */
|
184 |
|
|
/* kernel needs to be able to hold off the watchdog, when the process */
|
185 |
|
|
/* is not active, e.g. when dumping core. Costs us a whole 4 bytes to */
|
186 |
|
|
/* make this generic. the variable is in kern_shutdown.c */
|
187 |
|
|
typedef void (*watchdog_tickle_fn)(void);
|
188 |
|
|
extern watchdog_tickle_fn wdog_tickler;
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
/*
|
192 |
|
|
* Common `proc' functions are declared here so that proc.h can be included
|
193 |
|
|
* less often.
|
194 |
|
|
*/
|
195 |
|
|
int tsleep __P((void *chan, int pri, char *wmesg, int timo));
|
196 |
|
|
void wakeup __P((void *chan));
|
197 |
|
|
|
198 |
|
|
#endif /* !_SYS_SYSTM_H_ */
|