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