systm.h revision 15113
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 * $Id: systm.h,v 1.37 1996/03/11 02:23:33 hsu Exp $ 40 */ 41 42#ifndef _SYS_SYSTM_H_ 43#define _SYS_SYSTM_H_ 44 45#include <machine/cpufunc.h> 46#include <machine/stdarg.h> 47 48/* 49 * The `securelevel' variable controls the security level of the system. 50 * It can only be decreased by process 1 (/sbin/init). 51 * 52 * Security levels are as follows: 53 * -1 permanently insecure mode - always run system in level 0 mode. 54 * 0 insecure mode - immutable and append-only flags make be turned off. 55 * All devices may be read or written subject to permission modes. 56 * 1 secure mode - immutable and append-only flags may not be changed; 57 * raw disks of mounted filesystems, /dev/mem, and /dev/kmem are 58 * read-only. 59 * 2 highly secure mode - same as (1) plus raw disks are always 60 * read-only whether mounted or not. This level precludes tampering 61 * with filesystems by unmounting them, but also inhibits running 62 * newfs while the system is secured. 63 * 64 * In normal operation, the system runs in level 0 mode while single user 65 * and in level 1 mode while multiuser. If level 2 mode is desired while 66 * running multiuser, it can be set in the multiuser startup script 67 * (/etc/rc.local) using sysctl(1). If it is desired to run the system 68 * in level 0 mode while multiuser, initialize the variable securelevel 69 * in /sys/kern/kern_sysctl.c to -1. Note that it is NOT initialized to 70 * zero as that would allow the kernel binary to be patched to -1. 71 * Without initialization, securelevel loads in the BSS area which only 72 * comes into existence when the kernel is loaded and hence cannot be 73 * patched by a stalking hacker. 74 */ 75extern int securelevel; /* system security level */ 76 77extern int cold; /* nonzero if we are doing a cold boot */ 78extern const char *panicstr; /* panic message */ 79extern char version[]; /* system version */ 80extern char copyright[]; /* system copyright */ 81 82extern int nblkdev; /* number of entries in bdevsw */ 83extern int nchrdev; /* number of entries in cdevsw */ 84extern struct swdevt *swdevt; /* swap-device information */ 85extern int nswdev; /* number of swap devices */ 86extern int nswap; /* size of swap space */ 87 88extern int selwait; /* select timeout address */ 89 90extern u_char curpriority; /* priority of current process */ 91 92extern int physmem; /* physical memory */ 93 94extern dev_t dumpdev; /* dump device */ 95extern long dumplo; /* offset into dumpdev */ 96 97extern dev_t rootdev; /* root device */ 98extern struct vnode *rootvp; /* vnode equivalent to above */ 99 100extern dev_t swapdev; /* swapping device */ 101extern struct vnode *swapdev_vp;/* vnode equivalent to above */ 102 103extern int boothowto; /* reboot flags, from console subsystem */ 104extern int bootverbose; /* nonzero to print verbose messages */ 105 106/* 107 * General function declarations. 108 */ 109int nullop __P((void)); 110int eopnotsupp __P((void)); 111int einval __P((void)); 112int seltrue __P((dev_t dev, int which, struct proc *p)); 113int ureadc __P((int, struct uio *)); 114void *hashinit __P((int count, int type, u_long *hashmask)); 115void *phashinit __P((int count, int type, u_long *nentries)); 116 117__dead void panic __P((const char *, ...)) __dead2; 118__dead void boot __P((int)) __dead2; 119void tablefull __P((const char *)); 120void addlog __P((const char *, ...)); 121int kvprintf __P((char const *, void (*)(int, void*), void *, int, va_list)); 122void log __P((int, const char *, ...)); 123int printf __P((const char *, ...)); 124int sprintf __P((char *buf, const char *, ...)); 125void uprintf __P((const char *, ...)); 126void vprintf __P((const char *, va_list)); 127void ttyprintf __P((struct tty *, const char *, ...)); 128 129void bcopy __P((const void *from, void *to, size_t len)); 130void ovbcopy __P((const void *from, void *to, size_t len)); 131extern void (*bzero) __P((void *buf, size_t len)); 132 133void *memcpy __P((void *to, const void *from, size_t len)); 134 135int copystr __P((const void *kfaddr, void *kdaddr, size_t len, 136 size_t *lencopied)); 137int copyinstr __P((const void *udaddr, void *kaddr, size_t len, 138 size_t *lencopied)); 139int copyin __P((const void *udaddr, void *kaddr, size_t len)); 140int copyout __P((const void *kaddr, void *udaddr, size_t len)); 141 142int fubyte __P((const void *base)); 143int fuibyte __P((const void *base)); 144int subyte __P((void *base, int byte)); 145int suibyte __P((void *base, int byte)); 146int fuword __P((const void *base)); 147int suword __P((void *base, int word)); 148int susword __P((void *base, int word)); 149 150int hzto __P((struct timeval *tv)); 151void realitexpire __P((void *)); 152 153struct clockframe; 154void hardclock __P((struct clockframe *frame)); 155void softclock __P((void)); 156void statclock __P((struct clockframe *frame)); 157 158void startprofclock __P((struct proc *)); 159void stopprofclock __P((struct proc *)); 160void setstatclockrate __P((int hzrate)); 161 162void hardupdate __P((long)); 163#include <sys/libkern.h> 164 165/* Initialize the world */ 166extern void consinit(void); 167extern void usrinfoinit(void); 168extern void cpu_initclocks(void); 169extern void vntblinit(void); 170extern void nchinit(void); 171 172/* Finalize the world. */ 173void shutdown_nice __P((void)); 174 175/* 176 * Kernel to clock driver interface. 177 */ 178void inittodr __P((time_t base)); 179void resettodr __P((void)); 180void startrtclock __P((void)); 181 182/* Timeouts */ 183typedef void (timeout_t)(void *); /* actual timeout function type */ 184typedef timeout_t *timeout_func_t; /* a pointer to this type */ 185 186void timeout(timeout_func_t, void *, int); 187void untimeout(timeout_func_t, void *); 188void logwakeup __P((void)); 189 190#endif /* !_SYS_SYSTM_H_ */ 191