systm.h revision 21101
1210284Sjmallett/*- 2210284Sjmallett * Copyright (c) 1982, 1988, 1991, 1993 3210284Sjmallett * The Regents of the University of California. All rights reserved. 4210284Sjmallett * (c) UNIX System Laboratories, Inc. 5210284Sjmallett * All or some portions of this file are derived from material licensed 6210284Sjmallett * to the University of California by American Telephone and Telegraph 7210284Sjmallett * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8210284Sjmallett * the permission of UNIX System Laboratories, Inc. 9210284Sjmallett * 10210284Sjmallett * Redistribution and use in source and binary forms, with or without 11210284Sjmallett * modification, are permitted provided that the following conditions 12210284Sjmallett * are met: 13210284Sjmallett * 1. Redistributions of source code must retain the above copyright 14210284Sjmallett * notice, this list of conditions and the following disclaimer. 15210284Sjmallett * 2. Redistributions in binary form must reproduce the above copyright 16210284Sjmallett * notice, this list of conditions and the following disclaimer in the 17210284Sjmallett * documentation and/or other materials provided with the distribution. 18210284Sjmallett * 3. All advertising materials mentioning features or use of this software 19210284Sjmallett * must display the following acknowledgement: 20210284Sjmallett * This product includes software developed by the University of 21210284Sjmallett * California, Berkeley and its contributors. 22210284Sjmallett * 4. Neither the name of the University nor the names of its contributors 23210284Sjmallett * may be used to endorse or promote products derived from this software 24210284Sjmallett * without specific prior written permission. 25210284Sjmallett * 26210284Sjmallett * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27210284Sjmallett * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28210284Sjmallett * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29210284Sjmallett * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30210284Sjmallett * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31210284Sjmallett * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32210284Sjmallett * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33210284Sjmallett * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34210284Sjmallett * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35210284Sjmallett * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36210284Sjmallett * SUCH DAMAGE. 37210284Sjmallett * 38210284Sjmallett * @(#)systm.h 8.7 (Berkeley) 3/29/95 39210284Sjmallett * $Id: systm.h,v 1.47 1996/10/12 16:11:55 bde Exp $ 40210284Sjmallett */ 41210284Sjmallett 42210284Sjmallett#ifndef _SYS_SYSTM_H_ 43210284Sjmallett#define _SYS_SYSTM_H_ 44210284Sjmallett 45210284Sjmallett#include <machine/cpufunc.h> 46210284Sjmallett 47210284Sjmallettextern int securelevel; /* system security level (see init(8)) */ 48210284Sjmallett 49210284Sjmallettextern int cold; /* nonzero if we are doing a cold boot */ 50210284Sjmallettextern const char *panicstr; /* panic message */ 51210284Sjmallettextern char version[]; /* system version */ 52210284Sjmallettextern char copyright[]; /* system copyright */ 53210284Sjmallett 54210284Sjmallettextern int nblkdev; /* number of entries in bdevsw */ 55210284Sjmallettextern int nchrdev; /* number of entries in cdevsw */ 56210284Sjmallettextern struct swdevt *swdevt; /* swap-device information */ 57210284Sjmallettextern int nswdev; /* number of swap devices */ 58210284Sjmallettextern int nswap; /* size of swap space */ 59210284Sjmallett 60210284Sjmallettextern int selwait; /* select timeout address */ 61210284Sjmallett 62210284Sjmallettextern u_char curpriority; /* priority of current process */ 63210284Sjmallett 64210284Sjmallettextern int physmem; /* physical memory */ 65210284Sjmallett 66210284Sjmallettextern dev_t dumpdev; /* dump device */ 67210284Sjmallettextern long dumplo; /* offset into dumpdev */ 68210284Sjmallett 69210284Sjmallettextern dev_t rootdev; /* root device */ 70210284Sjmallettextern struct vnode *rootvp; /* vnode equivalent to above */ 71210284Sjmallett 72210284Sjmallettextern dev_t swapdev; /* swapping device */ 73210284Sjmallettextern struct vnode *swapdev_vp;/* vnode equivalent to above */ 74210284Sjmallett 75210284Sjmallettextern int boothowto; /* reboot flags, from console subsystem */ 76210284Sjmallettextern int bootverbose; /* nonzero to print verbose messages */ 77210284Sjmallett 78210284Sjmallett/* 79210284Sjmallett * General function declarations. 80210284Sjmallett */ 81210284Sjmallettvoid Debugger __P((const char *msg)); 82210284Sjmallettint nullop __P((void)); 83210284Sjmallettint eopnotsupp __P((void)); 84210284Sjmallettint einval __P((void)); 85210284Sjmallettint seltrue __P((dev_t dev, int which, struct proc *p)); 86210284Sjmallettint ureadc __P((int, struct uio *)); 87210284Sjmallettvoid *hashinit __P((int count, int type, u_long *hashmask)); 88210284Sjmallettvoid *phashinit __P((int count, int type, u_long *nentries)); 89210284Sjmallett 90210284Sjmallettvoid panic __P((const char *, ...)) __dead2; 91210284Sjmallettvoid boot __P((int)) __dead2; 92210284Sjmallettvoid cpu_boot __P((int)); 93210284Sjmallettvoid tablefull __P((const char *)); 94210284Sjmallettint addlog __P((const char *, ...)); 95210284Sjmallettint kvprintf __P((char const *, void (*)(int, void*), void *, int, 96210284Sjmallett _BSD_VA_LIST_)); 97210284Sjmallettvoid log __P((int, const char *, ...)); 98210284Sjmallettint printf __P((const char *, ...)); 99210284Sjmallettint sprintf __P((char *buf, const char *, ...)); 100210284Sjmallettvoid uprintf __P((const char *, ...)); 101210284Sjmallettvoid vprintf __P((const char *, _BSD_VA_LIST_)); 102210284Sjmallettvoid ttyprintf __P((struct tty *, const char *, ...)); 103210284Sjmallett 104210284Sjmallettvoid bcopy __P((const void *from, void *to, size_t len)); 105210284Sjmallettvoid ovbcopy __P((const void *from, void *to, size_t len)); 106210284Sjmallettextern void (*bzero) __P((void *buf, size_t len)); 107210284Sjmallett 108210284Sjmallettvoid *memcpy __P((void *to, const void *from, size_t len)); 109210284Sjmallett 110210284Sjmallettint copystr __P((const void *kfaddr, void *kdaddr, size_t len, 111210284Sjmallett size_t *lencopied)); 112210284Sjmallettint copyinstr __P((const void *udaddr, void *kaddr, size_t len, 113210284Sjmallett size_t *lencopied)); 114210284Sjmallettint copyin __P((const void *udaddr, void *kaddr, size_t len)); 115210284Sjmallettint copyout __P((const void *kaddr, void *udaddr, size_t len)); 116210284Sjmallett 117210284Sjmallettint fubyte __P((const void *base)); 118210284Sjmallettint fuibyte __P((const void *base)); 119210284Sjmallettint subyte __P((void *base, int byte)); 120210284Sjmallettint suibyte __P((void *base, int byte)); 121210284Sjmallettint fuword __P((const void *base)); 122210284Sjmallettint suword __P((void *base, int word)); 123210284Sjmallettint susword __P((void *base, int word)); 124210284Sjmallett 125210284Sjmallettint hzto __P((struct timeval *tv)); 126210284Sjmallettvoid realitexpire __P((void *)); 127210284Sjmallett 128210284Sjmallettstruct clockframe; 129210284Sjmallettvoid hardclock __P((struct clockframe *frame)); 130210284Sjmallettvoid softclock __P((void)); 131210284Sjmallettvoid statclock __P((struct clockframe *frame)); 132210284Sjmallett 133210284Sjmallettvoid startprofclock __P((struct proc *)); 134210284Sjmallettvoid stopprofclock __P((struct proc *)); 135210284Sjmallettvoid setstatclockrate __P((int hzrate)); 136210284Sjmallett 137210284Sjmallettvoid hardupdate __P((long)); 138210284Sjmallettvoid hardpps __P((struct timeval *tvp, long usec)); 139210284Sjmallett 140210284Sjmallett#include <sys/libkern.h> 141210284Sjmallett 142210284Sjmallett/* Initialize the world */ 143210284Sjmallettextern void consinit(void); 144210284Sjmallettextern void usrinfoinit(void); 145210284Sjmallettextern void cpu_initclocks(void); 146210284Sjmallettextern void vntblinit(void); 147210284Sjmallettextern void nchinit(void); 148210284Sjmallett 149210284Sjmallett/* Finalize the world. */ 150210284Sjmallettvoid shutdown_nice __P((void)); 151210284Sjmallett 152210284Sjmallett/* 153210284Sjmallett * Kernel to clock driver interface. 154210284Sjmallett */ 155210284Sjmallettvoid inittodr __P((time_t base)); 156210284Sjmallettvoid resettodr __P((void)); 157210284Sjmallettvoid startrtclock __P((void)); 158210284Sjmallett 159210284Sjmallett/* Timeouts */ 160210284Sjmalletttypedef void (timeout_t)(void *); /* actual timeout function type */ 161210284Sjmalletttypedef timeout_t *timeout_func_t; /* a pointer to this type */ 162210284Sjmallett 163210284Sjmallettvoid timeout(timeout_func_t, void *, int); 164210284Sjmallettvoid untimeout(timeout_func_t, void *); 165210284Sjmallettvoid logwakeup __P((void)); 166210284Sjmallett 167/* Various other callout lists that modules might want to know about */ 168/* shutdown callout list definitions */ 169typedef void (*bootlist_fn)(int,void *); 170int at_shutdown(bootlist_fn function, void *arg, int); 171int rm_at_shutdown(bootlist_fn function, void *arg); 172#define SHUTDOWN_PRE_SYNC 0 173#define SHUTDOWN_POST_SYNC 1 174 175/* forking */ /* XXX not yet */ 176typedef void (*forklist_fn)(struct proc *parent,struct proc *child,int flags); 177int at_fork(forklist_fn function); 178int rm_at_fork(forklist_fn function); 179 180/* exiting */ 181typedef void (*exitlist_fn)(struct proc *procp); 182int at_exit(exitlist_fn function); 183int rm_at_exit(exitlist_fn function); 184 185/* 186 * Common `proc' functions are declared here so that proc.h can be included 187 * less often. 188 */ 189int tsleep __P((void *chan, int pri, char *wmesg, int timo)); 190void wakeup __P((void *chan)); 191 192#endif /* !_SYS_SYSTM_H_ */ 193