]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/systm.h
xnu-517.tar.gz
[apple/xnu.git] / bsd / sys / systm.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
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
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
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.
1c79356b
A
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
9bccf70c 97#include <sys/appleapiopts.h>
1c79356b 98#include <sys/cdefs.h>
1c79356b
A
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
9bccf70c 109#ifdef __APPLE_API_PRIVATE
1c79356b
A
110extern int securelevel; /* system security level */
111extern const char *panicstr; /* panic message */
112extern char version[]; /* system version */
113extern char copyright[]; /* system copyright */
114
1c79356b
A
115
116extern 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[];
122extern int nsysent;
123
124extern int boothowto; /* reboot flags, from console subsystem */
125extern int show_space;
126
9bccf70c
A
127extern int nblkdev; /* number of entries in bdevsw */
128extern int nchrdev; /* number of entries in cdevsw */
129extern dev_t rootdev; /* root device */
130extern 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
1c79356b
A
138extern funnel_t * kernel_flock;
139extern funnel_t * network_flock;
9bccf70c 140#endif /* __APPLE_API_UNSTABLE */
1c79356b
A
141
142#define SYSINIT(a,b,c,d,e)
143#define MALLOC_DEFINE(a,b,c)
144
1c79356b
A
145#define getenv_int(a,b) (*b = 0)
146#define KASSERT(exp,msg)
147
148/*
149 * General function declarations.
150 */
151__BEGIN_DECLS
152int nullop __P((void));
153int enodev (); /* avoid actual prototype for multiple use */
154void enodev_strat();
155int nulldev();
156int enoioctl __P((void));
157int enxio __P((void));
158int eopnotsupp __P((void));
159int einval __P((void));
9bccf70c
A
160
161#ifdef __APPLE_API_UNSTABLE
1c79356b 162int seltrue __P((dev_t dev, int which, struct proc *p));
9bccf70c
A
163#endif /* __APPLE_API_UNSTABLE */
164
1c79356b
A
165void *hashinit __P((int count, int type, u_long *hashmask));
166int nosys __P((struct proc *, void *, register_t *));
167
168#ifdef __GNUC__
169volatile void panic __P((const char *, ...));
170#else
171void panic __P((const char *, ...));
172#endif
173void tablefull __P((const char *));
174void log __P((int, const char *, ...));
175void kprintf __P((const char *, ...));
176void ttyprintf __P((struct tty *, const char *, ...));
177
178int kvprintf __P((char const *, void (*)(int, void*), void *, int,
179 _BSD_VA_LIST_));
180
181int snprintf __P((char *, size_t, const char *, ...));
182int sprintf __P((char *buf, const char *, ...));
183void uprintf __P((const char *, ...));
184void vprintf __P((const char *, _BSD_VA_LIST_));
185int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_));
186int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_));
187
1c79356b
A
188void bcopy __P((const void *from, void *to, size_t len));
189void ovbcopy __P((const void *from, void *to, size_t len));
190void bzero __P((void *buf, size_t len));
191
192int copystr __P((void *kfaddr, void *kdaddr, size_t len, size_t *done));
193int copyinstr __P((void *udaddr, void *kaddr, size_t len, size_t *done));
194int copyoutstr __P((void *kaddr, void *udaddr, size_t len, size_t *done));
195int copyin __P((void *udaddr, void *kaddr, size_t len));
196int copyout __P((void *kaddr, void *udaddr, size_t len));
197int copywithin __P((void *saddr, void *daddr, size_t len));
198
199int fubyte __P((void *base));
200#ifdef notdef
201int fuibyte __P((void *base));
202#endif
203int subyte __P((void *base, int byte));
204int suibyte __P((void *base, int byte));
205long fuword __P((void *base));
206long fuiword __P((void *base));
207int suword __P((void *base, long word));
208int suiword __P((void *base, long word));
209
9bccf70c 210#ifdef __APPLE_API_UNSTABLE
1c79356b
A
211int hzto __P((struct timeval *tv));
212typedef void (*timeout_fcn_t)(void *);
213void timeout __P((void (*)(void *), void *arg, int ticks));
214void untimeout __P((void (*)(void *), void *arg));
215void realitexpire __P((void *));
9bccf70c 216#endif /* __APPLE_API_UNSTABLE */
1c79356b 217
9bccf70c 218#ifdef __APPLE_API_PRIVATE
1c79356b
A
219void bsd_hardclock __P((boolean_t usermode, caddr_t pc, int numticks));
220void gatherstats __P((boolean_t usermode, caddr_t pc));
221
222void initclocks __P((void));
223
224void startprofclock __P((struct proc *));
225void stopprofclock __P((struct proc *));
226void setstatclockrate __P((int hzrate));
9bccf70c
A
227#ifdef DDB
228/* debugger entry points */
229int Debugger __P((void)); /* in DDB only */
230#endif
231
1c79356b 232void set_fsblocksize __P((struct vnode *));
9bccf70c 233#endif /* __APPLE_API_PRIVATE */
1c79356b
A
234
235void addlog __P((const char *, ...));
236void printf __P((const char *, ...));
237
238extern boolean_t thread_funnel_switch(int oldfnl, int newfnl);
239
240#include <libkern/libkern.h>
241
1c79356b
A
242__END_DECLS
243
244#endif /* !_SYS_SYSTM_H_ */
245