]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
23 | /*- | |
24 | * Copyright (c) 1982, 1988, 1991, 1993 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * (c) UNIX System Laboratories, Inc. | |
27 | * All or some portions of this file are derived from material licensed | |
28 | * to the University of California by American Telephone and Telegraph | |
29 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
30 | * the permission of UNIX System Laboratories, Inc. | |
31 | * | |
32 | * Redistribution and use in source and binary forms, with or without | |
33 | * modification, are permitted provided that the following conditions | |
34 | * are met: | |
35 | * 1. Redistributions of source code must retain the above copyright | |
36 | * notice, this list of conditions and the following disclaimer. | |
37 | * 2. Redistributions in binary form must reproduce the above copyright | |
38 | * notice, this list of conditions and the following disclaimer in the | |
39 | * documentation and/or other materials provided with the distribution. | |
40 | * 3. All advertising materials mentioning features or use of this software | |
41 | * must display the following acknowledgement: | |
42 | * This product includes software developed by the University of | |
43 | * California, Berkeley and its contributors. | |
44 | * 4. Neither the name of the University nor the names of its contributors | |
45 | * may be used to endorse or promote products derived from this software | |
46 | * without specific prior written permission. | |
47 | * | |
48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | |
59 | * | |
60 | * @(#)systm.h 8.7 (Berkeley) 3/29/95 | |
61 | */ | |
62 | ||
63 | /* | |
64 | * The `securelevel' variable controls the security level of the system. | |
65 | * It can only be decreased by process 1 (/sbin/init). | |
66 | * | |
67 | * Security levels are as follows: | |
68 | * -1 permannently insecure mode - always run system in level 0 mode. | |
69 | * 0 insecure mode - immutable and append-only flags make be turned off. | |
70 | * All devices may be read or written subject to permission modes. | |
71 | * 1 secure mode - immutable and append-only flags may not be changed; | |
72 | * raw disks of mounted filesystems, /dev/mem, and /dev/kmem are | |
73 | * read-only. | |
74 | * 2 highly secure mode - same as (1) plus raw disks are always | |
75 | * read-only whether mounted or not. This level precludes tampering | |
76 | * with filesystems by unmounting them, but also inhibits running | |
77 | * newfs while the system is secured. | |
78 | * | |
79 | * In normal operation, the system runs in level 0 mode while single user | |
80 | * and in level 1 mode while multiuser. If level 2 mode is desired while | |
81 | * running multiuser, it can be set in the multiuser startup script | |
82 | * (/etc/rc.local) using sysctl(1). If it is desired to run the system | |
83 | * in level 0 mode while multiuser, initialize the variable securelevel | |
84 | * in /sys/kern/kern_sysctl.c to -1. Note that it is NOT initialized to | |
85 | * zero as that would allow the vmunix binary to be patched to -1. | |
86 | * Without initialization, securelevel loads in the BSS area which only | |
87 | * comes into existence when the kernel is loaded and hence cannot be | |
88 | * patched by a stalking hacker. | |
89 | */ | |
90 | ||
91 | #ifndef _SYS_SYSTM_H_ | |
92 | #define _SYS_SYSTM_H_ | |
93 | ||
94 | #include <sys/cdefs.h> | |
95 | ||
96 | #include <sys/types.h> | |
97 | #include <sys/time.h> | |
98 | #include <sys/tty.h> | |
99 | #include <sys/vm.h> | |
100 | #include <sys/proc.h> | |
101 | #include <sys/linker_set.h> | |
102 | __BEGIN_DECLS | |
103 | #include <kern/thread.h> | |
104 | __END_DECLS | |
105 | ||
106 | #define KERNEL_FUNNEL 1 | |
107 | #define NETWORK_FUNNEL 2 | |
108 | ||
109 | extern int securelevel; /* system security level */ | |
110 | extern const char *panicstr; /* panic message */ | |
111 | extern char version[]; /* system version */ | |
112 | extern char copyright[]; /* system copyright */ | |
113 | ||
114 | extern int nblkdev; /* number of entries in bdevsw */ | |
115 | extern int nchrdev; /* number of entries in cdevsw */ | |
116 | ||
117 | extern dev_t rootdev; /* root device */ | |
118 | extern struct vnode *rootvp; /* vnode equivalent to above */ | |
119 | ||
120 | extern struct sysent { /* system call table */ | |
121 | int16_t sy_narg; /* number of args */ | |
122 | int8_t sy_parallel;/* can execute in parallel */ | |
123 | int8_t sy_funnel; /* funnel type */ | |
124 | int32_t (*sy_call)(); /* implementing function */ | |
125 | } sysent[]; | |
126 | extern int nsysent; | |
127 | ||
128 | extern int boothowto; /* reboot flags, from console subsystem */ | |
129 | extern int show_space; | |
130 | ||
131 | extern funnel_t * kernel_flock; | |
132 | extern funnel_t * network_flock; | |
133 | ||
134 | #define SYSINIT(a,b,c,d,e) | |
135 | #define MALLOC_DEFINE(a,b,c) | |
136 | ||
137 | ||
138 | #define getenv_int(a,b) (*b = 0) | |
139 | #define KASSERT(exp,msg) | |
140 | ||
141 | /* | |
142 | * General function declarations. | |
143 | */ | |
144 | __BEGIN_DECLS | |
145 | int nullop __P((void)); | |
146 | int enodev (); /* avoid actual prototype for multiple use */ | |
147 | void enodev_strat(); | |
148 | int nulldev(); | |
149 | int enoioctl __P((void)); | |
150 | int enxio __P((void)); | |
151 | int eopnotsupp __P((void)); | |
152 | int einval __P((void)); | |
153 | int seltrue __P((dev_t dev, int which, struct proc *p)); | |
154 | void *hashinit __P((int count, int type, u_long *hashmask)); | |
155 | int nosys __P((struct proc *, void *, register_t *)); | |
156 | ||
157 | #ifdef __GNUC__ | |
158 | volatile void panic __P((const char *, ...)); | |
159 | #else | |
160 | void panic __P((const char *, ...)); | |
161 | #endif | |
162 | void tablefull __P((const char *)); | |
163 | void log __P((int, const char *, ...)); | |
164 | void kprintf __P((const char *, ...)); | |
165 | void ttyprintf __P((struct tty *, const char *, ...)); | |
166 | ||
167 | int kvprintf __P((char const *, void (*)(int, void*), void *, int, | |
168 | _BSD_VA_LIST_)); | |
169 | ||
170 | int snprintf __P((char *, size_t, const char *, ...)); | |
171 | int sprintf __P((char *buf, const char *, ...)); | |
172 | void uprintf __P((const char *, ...)); | |
173 | void vprintf __P((const char *, _BSD_VA_LIST_)); | |
174 | int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_)); | |
175 | int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_)); | |
176 | ||
177 | ||
178 | void bcopy __P((const void *from, void *to, size_t len)); | |
179 | void ovbcopy __P((const void *from, void *to, size_t len)); | |
180 | void bzero __P((void *buf, size_t len)); | |
181 | ||
182 | int copystr __P((void *kfaddr, void *kdaddr, size_t len, size_t *done)); | |
183 | int copyinstr __P((void *udaddr, void *kaddr, size_t len, size_t *done)); | |
184 | int copyoutstr __P((void *kaddr, void *udaddr, size_t len, size_t *done)); | |
185 | int copyin __P((void *udaddr, void *kaddr, size_t len)); | |
186 | int copyout __P((void *kaddr, void *udaddr, size_t len)); | |
187 | int copywithin __P((void *saddr, void *daddr, size_t len)); | |
188 | ||
189 | int fubyte __P((void *base)); | |
190 | #ifdef notdef | |
191 | int fuibyte __P((void *base)); | |
192 | #endif | |
193 | int subyte __P((void *base, int byte)); | |
194 | int suibyte __P((void *base, int byte)); | |
195 | long fuword __P((void *base)); | |
196 | long fuiword __P((void *base)); | |
197 | int suword __P((void *base, long word)); | |
198 | int suiword __P((void *base, long word)); | |
199 | ||
200 | int hzto __P((struct timeval *tv)); | |
201 | typedef void (*timeout_fcn_t)(void *); | |
202 | void timeout __P((void (*)(void *), void *arg, int ticks)); | |
203 | void untimeout __P((void (*)(void *), void *arg)); | |
204 | void realitexpire __P((void *)); | |
205 | ||
206 | void bsd_hardclock __P((boolean_t usermode, caddr_t pc, int numticks)); | |
207 | void gatherstats __P((boolean_t usermode, caddr_t pc)); | |
208 | ||
209 | void initclocks __P((void)); | |
210 | ||
211 | void startprofclock __P((struct proc *)); | |
212 | void stopprofclock __P((struct proc *)); | |
213 | void setstatclockrate __P((int hzrate)); | |
214 | void set_fsblocksize __P((struct vnode *)); | |
215 | ||
216 | void addlog __P((const char *, ...)); | |
217 | void printf __P((const char *, ...)); | |
218 | ||
219 | extern boolean_t thread_funnel_switch(int oldfnl, int newfnl); | |
220 | ||
221 | #include <libkern/libkern.h> | |
222 | ||
223 | #ifdef DDB | |
224 | /* debugger entry points */ | |
225 | int Debugger __P((void)); /* in DDB only */ | |
226 | #endif | |
227 | ||
228 | __END_DECLS | |
229 | ||
230 | #endif /* !_SYS_SYSTM_H_ */ | |
231 |