]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/systm.h
xnu-201.5.tar.gz
[apple/xnu.git] / bsd / sys / systm.h
CommitLineData
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
109extern int securelevel; /* system security level */
110extern const char *panicstr; /* panic message */
111extern char version[]; /* system version */
112extern char copyright[]; /* system copyright */
113
114extern int nblkdev; /* number of entries in bdevsw */
115extern int nchrdev; /* number of entries in cdevsw */
116
117extern dev_t rootdev; /* root device */
118extern struct vnode *rootvp; /* vnode equivalent to above */
119
120extern 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[];
126extern int nsysent;
127
128extern int boothowto; /* reboot flags, from console subsystem */
129extern int show_space;
130
131extern funnel_t * kernel_flock;
132extern 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
145int nullop __P((void));
146int enodev (); /* avoid actual prototype for multiple use */
147void enodev_strat();
148int nulldev();
149int enoioctl __P((void));
150int enxio __P((void));
151int eopnotsupp __P((void));
152int einval __P((void));
153int seltrue __P((dev_t dev, int which, struct proc *p));
154void *hashinit __P((int count, int type, u_long *hashmask));
155int nosys __P((struct proc *, void *, register_t *));
156
157#ifdef __GNUC__
158volatile void panic __P((const char *, ...));
159#else
160void panic __P((const char *, ...));
161#endif
162void tablefull __P((const char *));
163void log __P((int, const char *, ...));
164void kprintf __P((const char *, ...));
165void ttyprintf __P((struct tty *, const char *, ...));
166
167int kvprintf __P((char const *, void (*)(int, void*), void *, int,
168 _BSD_VA_LIST_));
169
170int snprintf __P((char *, size_t, const char *, ...));
171int sprintf __P((char *buf, const char *, ...));
172void uprintf __P((const char *, ...));
173void vprintf __P((const char *, _BSD_VA_LIST_));
174int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_));
175int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_));
176
177
178void bcopy __P((const void *from, void *to, size_t len));
179void ovbcopy __P((const void *from, void *to, size_t len));
180void bzero __P((void *buf, size_t len));
181
182int copystr __P((void *kfaddr, void *kdaddr, size_t len, size_t *done));
183int copyinstr __P((void *udaddr, void *kaddr, size_t len, size_t *done));
184int copyoutstr __P((void *kaddr, void *udaddr, size_t len, size_t *done));
185int copyin __P((void *udaddr, void *kaddr, size_t len));
186int copyout __P((void *kaddr, void *udaddr, size_t len));
187int copywithin __P((void *saddr, void *daddr, size_t len));
188
189int fubyte __P((void *base));
190#ifdef notdef
191int fuibyte __P((void *base));
192#endif
193int subyte __P((void *base, int byte));
194int suibyte __P((void *base, int byte));
195long fuword __P((void *base));
196long fuiword __P((void *base));
197int suword __P((void *base, long word));
198int suiword __P((void *base, long word));
199
200int hzto __P((struct timeval *tv));
201typedef void (*timeout_fcn_t)(void *);
202void timeout __P((void (*)(void *), void *arg, int ticks));
203void untimeout __P((void (*)(void *), void *arg));
204void realitexpire __P((void *));
205
206void bsd_hardclock __P((boolean_t usermode, caddr_t pc, int numticks));
207void gatherstats __P((boolean_t usermode, caddr_t pc));
208
209void initclocks __P((void));
210
211void startprofclock __P((struct proc *));
212void stopprofclock __P((struct proc *));
213void setstatclockrate __P((int hzrate));
214void set_fsblocksize __P((struct vnode *));
215
216void addlog __P((const char *, ...));
217void printf __P((const char *, ...));
218
219extern boolean_t thread_funnel_switch(int oldfnl, int newfnl);
220
221#include <libkern/libkern.h>
222
223#ifdef DDB
224/* debugger entry points */
225int Debugger __P((void)); /* in DDB only */
226#endif
227
228__END_DECLS
229
230#endif /* !_SYS_SYSTM_H_ */
231