1 /*- 2 * Copyright (c) 1982, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)systm.h 7.28 (Berkeley) 06/02/93 8 */ 9 10 /* 11 * The `securelevel' variable controls the security level of the system. 12 * It can only be decreased by process 1 (/sbin/init). 13 * 14 * Security levels are as follows: 15 * -1 permannently insecure mode - always run system in level 0 mode. 16 * 0 insecure mode - immutable and append-only flags make be turned off. 17 * All devices may be read or written subject to permission modes. 18 * 1 secure mode - immutable and append-only flags may not be changed; 19 * raw disks of mounted filesystems, /dev/mem, and /dev/kmem are 20 * read-only. 21 * 2 highly secure mode - same as (1) plus raw disks are always 22 * read-only whether mounted or not. This level precludes tampering 23 * with filesystems by unmounting them, but also inhibits running 24 * newfs while the system is secured. 25 * 26 * In normal operation, the system runs in level 0 mode while single user 27 * and in level 1 mode while multiuser. If level 2 mode is desired while 28 * running multiuser, it can be set in the multiuser startup script 29 * (/etc/rc.local) using sysctl(1). If it is desired to run the system 30 * in level 0 mode while multiuser, initialize the variable securelevel 31 * in /sys/kern/kern_sysctl.c to -1. Note that it is NOT initialized to 32 * zero as that would allow the vmunix binary to be patched to -1. 33 * Without initialization, securelevel loads in the BSS area which only 34 * comes into existence when the kernel is loaded and hence cannot be 35 * patched by a stalking hacker. 36 */ 37 extern int securelevel; /* system security level */ 38 extern const char *panicstr; /* panic message */ 39 extern char version[]; /* system version */ 40 extern char copyright[]; /* system copyright */ 41 42 extern int nblkdev; /* number of entries in bdevsw */ 43 extern int nchrdev; /* number of entries in cdevsw */ 44 extern int nswdev; /* number of swap devices */ 45 extern int nswap; /* size of swap space */ 46 47 extern int selwait; /* select timeout address */ 48 49 extern u_char curpri; /* priority of current process */ 50 51 extern int maxmem; /* max memory per process */ 52 extern int physmem; /* physical memory */ 53 54 extern dev_t dumpdev; /* dump device */ 55 extern long dumplo; /* offset into dumpdev */ 56 57 extern dev_t rootdev; /* root device */ 58 extern struct vnode *rootvp; /* vnode equivalent to above */ 59 60 extern dev_t swapdev; /* swapping device */ 61 extern struct vnode *swapdev_vp;/* vnode equivalent to above */ 62 63 extern struct sysent { /* system call table */ 64 int sy_narg; /* number of arguments */ 65 int (*sy_call)(); /* implementing function */ 66 } sysent[]; 67 68 extern int boothowto; /* reboot flags, from console subsystem */ 69 70 /* casts to keep lint happy */ 71 #define insque(q,p) _insque((caddr_t)q,(caddr_t)p) 72 #define remque(q) _remque((caddr_t)q) 73 74 /* 75 * General function declarations. 76 */ 77 int nullop __P((void)); 78 int enodev __P((void)); 79 int enoioctl __P((void)); 80 int enxio __P((void)); 81 int eopnotsupp __P((void)); 82 int seltrue __P((dev_t dev, int which, struct proc *p)); 83 void *hashinit __P((int count, int type, u_long *hashmask)); 84 85 #ifdef __GNUC__ 86 volatile void panic __P((const char *, ...)); 87 #else 88 void panic __P((const char *, ...)); 89 #endif 90 void tablefull __P((const char *)); 91 void addlog __P((const char *, ...)); 92 void log __P((int, const char *, ...)); 93 void printf __P((const char *, ...)); 94 int sprintf __P((char *buf, const char *, ...)); 95 void ttyprintf __P((struct tty *, const char *, ...)); 96 97 void bcopy __P((void *from, void *to, u_int len)); 98 void ovbcopy __P((void *from, void *to, u_int len)); 99 void bzero __P((void *buf, u_int len)); 100 101 int copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done)); 102 int copyinstr __P((void *udaddr, void *kaddr, u_int len, u_int *done)); 103 int copyoutstr __P((void *kaddr, void *udaddr, u_int len, u_int *done)); 104 int copyin __P((void *udaddr, void *kaddr, u_int len)); 105 int copyout __P((void *kaddr, void *udaddr, u_int len)); 106 107 int fubyte __P((void *base)); 108 #ifdef notdef 109 int fuibyte __P((void *base)); 110 #endif 111 int subyte __P((void *base, int byte)); 112 int suibyte __P((void *base, int byte)); 113 int fuword __P((void *base)); 114 int fuiword __P((void *base)); 115 int suword __P((void *base, int word)); 116 int suiword __P((void *base, int word)); 117 118 int hzto __P((struct timeval *tv)); 119 void timeout __P((void (*func)(void *), void *arg, int ticks)); 120 void untimeout __P((void (*func)(void *), void *arg)); 121 void realitexpire __P((void *)); 122 123 struct clockframe; 124 void hardclock __P((struct clockframe *frame)); 125 void softclock __P((void)); 126 void statclock __P((struct clockframe *frame)); 127 128 void initclocks __P((void)); 129 130 void startprofclock __P((struct proc *)); 131 void stopprofclock __P((struct proc *)); 132 void setstatclockrate __P((int hzrate)); 133 134 #include <libkern/libkern.h> 135