Remove two unnecessary volatile qualifications.
[dragonfly.git] / sys / sys / systm.h
CommitLineData
984263bc
MD
1/*-
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 * $FreeBSD: src/sys/sys/systm.h,v 1.111.2.18 2002/12/17 18:04:02 sam Exp $
377d4740 40 * $DragonFly: src/sys/sys/systm.h,v 1.9 2003/07/19 21:14:50 dillon Exp $
984263bc
MD
41 */
42
43#ifndef _SYS_SYSTM_H_
44#define _SYS_SYSTM_H_
45
46#include <machine/atomic.h>
47#include <machine/cpufunc.h>
48#include <sys/callout.h>
49
50extern int securelevel; /* system security level (see init(8)) */
51
52extern int cold; /* nonzero if we are doing a cold boot */
53extern const char *panicstr; /* panic message */
54extern int dumping; /* system is dumping */
55extern int safepri; /* safe ipl when cold or panicing */
56extern char version[]; /* system version */
57extern char copyright[]; /* system copyright */
58
59extern int nswap; /* size of swap space */
60
61extern int selwait; /* select timeout address */
62
63extern u_char curpriority; /* priority of current process */
64
65extern int physmem; /* physical memory */
66
67extern dev_t dumpdev; /* dump device */
68extern long dumplo; /* offset into dumpdev */
69
70extern dev_t rootdev; /* root device */
71extern dev_t rootdevs[2]; /* possible root devices */
72extern char *rootdevnames[2]; /* names of possible root devices */
73extern struct vnode *rootvp; /* vnode equivalent to above */
74
75extern int boothowto; /* reboot flags, from console subsystem */
76extern int bootverbose; /* nonzero to print verbose messages */
77
78extern int maxusers; /* system tune hint */
79
17a9f566
MD
80extern int ncpus; /* total number of cpus (real, hyper, virtual)*/
81
984263bc
MD
82#ifdef INVARIANTS /* The option is always available */
83#define KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0)
41c20dac 84#define KKASSERT(exp) if (!(exp)) panic("assertion: " #exp " in " __FUNCTION__)
984263bc
MD
85#define SPLASSERT(level, msg) __CONCAT(__CONCAT(spl,level),assert)(msg)
86#define CONDSPLASSERT(cond, level, msg) do { \
87 if (cond) \
88 SPLASSERT(level, msg); \
89} while (0)
90#else
91#define KASSERT(exp,msg)
41c20dac 92#define KKASSERT(exp)
984263bc
MD
93#define SPLASSERT(level, msg)
94#define CONDSPLASSERT(cond, level, msg)
95#endif
96
97/*
98 * General function declarations.
99 */
100
101struct clockframe;
102struct malloc_type;
103struct proc;
f1d1c3fa 104struct xwait;
984263bc
MD
105struct timeval;
106struct tty;
107struct uio;
8ad65e08 108struct globaldata;
41c20dac 109struct thread;
984263bc
MD
110
111void Debugger __P((const char *msg));
8ad65e08 112void mi_gdinit __P((struct globaldata *gd, int cpu));
984263bc
MD
113int dumpstatus __P((vm_offset_t addr, off_t count));
114int nullop __P((void));
115int eopnotsupp __P((void));
116int einval __P((void));
41c20dac 117int seltrue __P((dev_t dev, int which, struct thread *td));
984263bc
MD
118int ureadc __P((int, struct uio *));
119void *hashinit __P((int count, struct malloc_type *type, u_long *hashmask));
120void *phashinit __P((int count, struct malloc_type *type, u_long *nentries));
121
122void cpu_boot __P((int));
123void cpu_rootconf __P((void));
124extern uint32_t crc32_tab[];
125uint32_t crc32(const void *buf, size_t size);
126void init_param1 __P((void));
127void init_param2 __P((int physpages));
128void tablefull __P((const char *));
129int addlog __P((const char *, ...)) __printflike(1, 2);
130int kvprintf __P((char const *, void (*)(int, void*), void *, int,
131 _BSD_VA_LIST_)) __printflike(1, 0);
132int log __P((int, const char *, ...)) __printflike(2, 3);
133void logwakeup __P((void));
134void log_console __P((struct uio *));
135int printf __P((const char *, ...)) __printflike(1, 2);
136int snprintf __P((char *, size_t, const char *, ...)) __printflike(3, 4);
137int sprintf __P((char *buf, const char *, ...)) __printflike(2, 3);
138int uprintf __P((const char *, ...)) __printflike(1, 2);
139int vprintf __P((const char *, _BSD_VA_LIST_)) __printflike(1, 0);
140int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_)) __printflike(3, 0);
141int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_)) __printflike(2, 0);
142int ttyprintf __P((struct tty *, const char *, ...)) __printflike(2, 3);
143int sscanf __P((const char *, char const *, ...));
144int vsscanf __P((const char *, char const *, _BSD_VA_LIST_));
145long strtol __P((const char *, char **, int));
146u_long strtoul __P((const char *, char **, int));
147quad_t strtoq __P((const char *, char **, int));
148u_quad_t strtouq __P((const char *, char **, int));
149
150void bcopy __P((const void *from, void *to, size_t len));
151void ovbcopy __P((const void *from, void *to, size_t len));
152
153#ifdef __i386__
154extern void (*bzero) __P((void *buf, size_t len));
155#else
156void bzero __P((void *buf, size_t len));
157#endif
158
159void *memcpy __P((void *to, const void *from, size_t len));
160
161int copystr __P((const void *kfaddr, void *kdaddr, size_t len,
162 size_t *lencopied));
163int copyinstr __P((const void *udaddr, void *kaddr, size_t len,
164 size_t *lencopied));
165int copyin __P((const void *udaddr, void *kaddr, size_t len));
166int copyout __P((const void *kaddr, void *udaddr, size_t len));
167
168int fubyte __P((const void *base));
169int subyte __P((void *base, int byte));
170int suibyte __P((void *base, int byte));
171long fuword __P((const void *base));
172int suword __P((void *base, long word));
173int fusword __P((void *base));
174int susword __P((void *base, int word));
175
176void realitexpire __P((void *));
177
178void hardclock __P((struct clockframe *frame));
984263bc
MD
179void statclock __P((struct clockframe *frame));
180
181void startprofclock __P((struct proc *));
182void stopprofclock __P((struct proc *));
183void setstatclockrate __P((int hzrate));
184
185char *getenv __P((const char *name));
186#define testenv getenv
187#define freeenv
188int getenv_int __P((const char *name, int *data));
189int getenv_string __P((const char *name, char *data, int size));
190int getenv_quad __P((const char *name, quad_t *data));
191extern char *kern_envp;
192
193#ifdef APM_FIXUP_CALLTODO
194void adjust_timeout_calltodo __P((struct timeval *time_change));
195#endif /* APM_FIXUP_CALLTODO */
196
197#include <sys/libkern.h>
198
199/* Initialize the world */
200void consinit __P((void));
201void cpu_initclocks __P((void));
202void nchinit __P((void));
203void usrinfoinit __P((void));
204void vntblinit __P((void));
205
206/* Finalize the world. */
207void shutdown_nice __P((int));
208
209/*
210 * Kernel to clock driver interface.
211 */
212void inittodr __P((time_t base));
213void resettodr __P((void));
214void startrtclock __P((void));
215
216/* Timeouts */
217typedef void timeout_t __P((void *)); /* timeout function type */
218#define CALLOUT_HANDLE_INITIALIZER(handle) \
219 { NULL }
220
221void callout_handle_init __P((struct callout_handle *));
222struct callout_handle timeout __P((timeout_t *, void *, int));
223void untimeout __P((timeout_t *, void *, struct callout_handle));
224
225/* Interrupt management */
226
227/*
228 * For the alpha arch, some of these functions are static __inline, and
229 * the others should be.
230 */
231#ifdef __i386__
232void setdelayed __P((void));
233void setsoftast __P((void));
234void setsoftcambio __P((void));
235void setsoftcamnet __P((void));
236void setsoftclock __P((void));
237void setsoftcrypto __P((void));
238void setsoftnet __P((void));
239void setsofttty __P((void));
240void setsoftvm __P((void));
241void setsofttq __P((void));
242void schedsoftcamnet __P((void));
243void schedsoftcambio __P((void));
244void schedsoftnet __P((void));
245void schedsofttty __P((void));
246void schedsoftvm __P((void));
247void schedsofttq __P((void));
248intrmask_t softclockpending __P((void));
249void spl0 __P((void));
250intrmask_t splbio __P((void));
251intrmask_t splcam __P((void));
252intrmask_t splclock __P((void));
253intrmask_t splcrypto __P((void));
254intrmask_t splhigh __P((void));
255intrmask_t splimp __P((void));
256intrmask_t splnet __P((void));
257intrmask_t splsoftcam __P((void));
258intrmask_t splsoftcambio __P((void));
259intrmask_t splsoftcamnet __P((void));
260intrmask_t splsoftclock __P((void));
261intrmask_t splsofttty __P((void));
262intrmask_t splsoftvm __P((void));
263intrmask_t splsofttq __P((void));
264intrmask_t splstatclock __P((void));
265intrmask_t spltty __P((void));
266intrmask_t splvm __P((void));
267void splx __P((intrmask_t ipl));
268void splz __P((void));
269#endif /* __i386__ */
270
271#ifdef __alpha__
272#include <machine/ipl.h>
273#endif
274
275#ifdef INVARIANT_SUPPORT
276void splbioassert __P((const char *msg));
277void splcamassert __P((const char *msg));
278void splclockassert __P((const char *msg));
279void splcryptoassert __P((const char *msg));
280void splhighassert __P((const char *msg));
281void splimpassert __P((const char *msg));
282void splnetassert __P((const char *msg));
283void splsoftcamassert __P((const char *msg));
284void splsoftcambioassert __P((const char *msg));
285void splsoftcamnetassert __P((const char *msg));
286void splsoftclockassert __P((const char *msg));
287void splsoftttyassert __P((const char *msg));
288void splsoftvmassert __P((const char *msg));
289void splsofttqassert __P((const char *msg));
290void splstatclockassert __P((const char *msg));
291void splttyassert __P((const char *msg));
292void splvmassert __P((const char *msg));
293#endif /* INVARIANT_SUPPORT */
294
295/*
296 * XXX It's not clear how "machine independent" these will be yet, but
297 * they are used all over the place especially in pci drivers. We would
298 * have to modify lots of drivers since <machine/cpufunc.h> no longer
299 * implicitly causes these to be defined when it #included <machine/spl.h>
300 */
301extern intrmask_t bio_imask; /* group of interrupts masked with splbio() */
302extern intrmask_t cam_imask; /* group of interrupts masked with splcam() */
303extern intrmask_t net_imask; /* group of interrupts masked with splimp() */
304extern intrmask_t stat_imask; /* interrupts masked with splstatclock() */
305extern intrmask_t tty_imask; /* group of interrupts masked with spltty() */
306
307/* Read only */
308extern const intrmask_t soft_imask; /* interrupts masked with splsoft*() */
309extern const intrmask_t softnet_imask; /* interrupt masked with splnet() */
310extern const intrmask_t softtty_imask; /* interrupt masked with splsofttty() */
311
312/*
313 * Various callout lists.
314 */
315
316/* Exit callout list declarations. */
dadab5e9 317typedef void (*exitlist_fn) __P((struct thread *td));
984263bc
MD
318
319int at_exit __P((exitlist_fn function));
320int rm_at_exit __P((exitlist_fn function));
321
322/* Fork callout list declarations. */
323typedef void (*forklist_fn) __P((struct proc *parent, struct proc *child,
324 int flags));
325
326int at_fork __P((forklist_fn function));
327int rm_at_fork __P((forklist_fn function));
328
329/*
330 * Not exactly a callout LIST, but a callout entry.
331 * Allow an external module to define a hardware watchdog tickler.
332 * Normally a process would do this, but there are times when the
333 * kernel needs to be able to hold off the watchdog, when the process
334 * is not active, e.g., when dumping core.
335 */
336typedef void (*watchdog_tickle_fn) __P((void));
337
338extern watchdog_tickle_fn wdog_tickler;
339
340/*
341 * Common `proc' functions are declared here so that proc.h can be included
342 * less often.
343 */
377d4740 344int tsleep __P((void *chan, int slpflags, const char *wmesg, int timo));
984263bc
MD
345void wakeup __P((void *chan));
346void wakeup_one __P((void *chan));
347
348/*
349 * Common `dev_t' stuff are declared here to avoid #include poisoning
350 */
351
352int major(dev_t x);
353int minor(dev_t x);
354dev_t makedev(int x, int y);
355udev_t dev2udev(dev_t x);
356dev_t udev2dev(udev_t x, int b);
357int uminor(udev_t dev);
358int umajor(udev_t dev);
359udev_t makeudev(int x, int y);
360#endif /* !_SYS_SYSTM_H_ */