|
|
1.1 root 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:
103: extern int securelevel; /* system security level */
104: extern const char *panicstr; /* panic message */
105: extern char version[]; /* system version */
106: extern char copyright[]; /* system copyright */
107:
108: extern int nblkdev; /* number of entries in bdevsw */
109: extern int nchrdev; /* number of entries in cdevsw */
110:
111: extern dev_t rootdev; /* root device */
112: extern struct vnode *rootvp; /* vnode equivalent to above */
113:
114: extern struct sysent { /* system call table */
115: int16_t sy_narg; /* number of args */
116: int16_t sy_parallel;/* can execute in parallel */
117: int32_t (*sy_call)(); /* implementing function */
118: } sysent[];
119: extern int nsysent;
120:
121: extern int boothowto; /* reboot flags, from console subsystem */
122: extern int show_space;
123:
124: #define SYSINIT(a,b,c,d,e)
125: #define MALLOC_DEFINE(a,b,c)
126:
127:
128: #define getenv_int(a,b) (*b = 0)
129: #define KASSERT(exp,msg)
130:
131: /*
132: * General function declarations.
133: */
134: __BEGIN_DECLS
135: int nullop __P((void));
136: int enodev (); /* avoid actual prototype for multiple use */
137: void enodev_strat();
138: int nulldev();
139: int enoioctl __P((void));
140: int enxio __P((void));
141: int eopnotsupp __P((void));
142: int einval __P((void));
143: int seltrue __P((dev_t dev, int which, struct proc *p));
144: void *hashinit __P((int count, int type, u_long *hashmask));
145: int nosys __P((struct proc *, void *, register_t *));
146:
147: #ifdef __GNUC__
148: volatile void panic __P((const char *, ...));
149: #else
150: void panic __P((const char *, ...));
151: #endif
152: void tablefull __P((const char *));
153: void log __P((int, const char *, ...));
154: void kprintf __P((const char *, ...));
155: void ttyprintf __P((struct tty *, const char *, ...));
156:
157: int kvprintf __P((char const *, void (*)(int, void*), void *, int,
158: _BSD_VA_LIST_));
159:
160: int snprintf __P((char *, size_t, const char *, ...));
161: int sprintf __P((char *buf, const char *, ...));
162: void uprintf __P((const char *, ...));
163: void vprintf __P((const char *, _BSD_VA_LIST_));
164: int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_));
165: int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_));
166:
167:
168: void bcopy __P((const void *from, void *to, size_t len));
169: void ovbcopy __P((const void *from, void *to, size_t len));
170: void bzero __P((void *buf, size_t len));
171:
172: int copystr __P((void *kfaddr, void *kdaddr, size_t len, size_t *done));
173: int copyinstr __P((void *udaddr, void *kaddr, size_t len, size_t *done));
174: int copyoutstr __P((void *kaddr, void *udaddr, size_t len, size_t *done));
175: int copyin __P((void *udaddr, void *kaddr, size_t len));
176: int copyout __P((void *kaddr, void *udaddr, size_t len));
177: int copywithin __P((void *saddr, void *daddr, size_t len));
178:
179: int fubyte __P((void *base));
180: #ifdef notdef
181: int fuibyte __P((void *base));
182: #endif
183: int subyte __P((void *base, int byte));
184: int suibyte __P((void *base, int byte));
185: long fuword __P((void *base));
186: long fuiword __P((void *base));
187: int suword __P((void *base, long word));
188: int suiword __P((void *base, long word));
189:
190: int hzto __P((struct timeval *tv));
191: typedef void (*timeout_fcn_t)(void *);
192: void timeout __P((void (*)(void *), void *arg, int ticks));
193: void untimeout __P((void (*)(void *), void *arg));
194: void realitexpire __P((void *));
195:
196: void bsd_hardclock __P((boolean_t usermode, caddr_t pc, int numticks));
197: void gatherstats __P((boolean_t usermode, caddr_t pc));
198:
199: void initclocks __P((void));
200:
201: void startprofclock __P((struct proc *));
202: void stopprofclock __P((struct proc *));
203: void setstatclockrate __P((int hzrate));
204: void set_fsblocksize __P((struct vnode *));
205:
206: void addlog __P((const char *, ...));
207: void printf __P((const char *, ...));
208:
209: #include <libkern/libkern.h>
210:
211: #ifdef DDB
212: /* debugger entry points */
213: int Debugger __P((void)); /* in DDB only */
214: int read_symtab_from_file __P((struct proc *,struct vnode *,const char *));
215: #endif
216:
217: __END_DECLS
218:
219: #endif /* !_SYS_SYSTM_H_ */
220:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.