]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
1c79356b A |
27 | */ |
28 | /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ | |
29 | /*- | |
30 | * Copyright (c) 1982, 1986, 1989, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * (c) UNIX System Laboratories, Inc. | |
33 | * All or some portions of this file are derived from material licensed | |
34 | * to the University of California by American Telephone and Telegraph | |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
36 | * the permission of UNIX System Laboratories, Inc. | |
37 | * | |
38 | * Redistribution and use in source and binary forms, with or without | |
39 | * modification, are permitted provided that the following conditions | |
40 | * are met: | |
41 | * 1. Redistributions of source code must retain the above copyright | |
42 | * notice, this list of conditions and the following disclaimer. | |
43 | * 2. Redistributions in binary form must reproduce the above copyright | |
44 | * notice, this list of conditions and the following disclaimer in the | |
45 | * documentation and/or other materials provided with the distribution. | |
46 | * 3. All advertising materials mentioning features or use of this software | |
47 | * must display the following acknowledgement: | |
48 | * This product includes software developed by the University of | |
49 | * California, Berkeley and its contributors. | |
50 | * 4. Neither the name of the University nor the names of its contributors | |
51 | * may be used to endorse or promote products derived from this software | |
52 | * without specific prior written permission. | |
53 | * | |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | |
65 | * | |
66 | * @(#)param.h 8.3 (Berkeley) 4/4/95 | |
67 | */ | |
68 | ||
69 | #ifndef _SYS_PARAM_H_ | |
70 | #define _SYS_PARAM_H_ | |
71 | ||
72 | #define BSD 199506 /* System version (year & month). */ | |
73 | #define BSD4_3 1 | |
74 | #define BSD4_4 1 | |
75 | ||
76 | #define NeXTBSD 1995064 /* NeXTBSD version (year, month, release) */ | |
77 | #define NeXTBSD4_0 0 /* NeXTBSD 4.0 */ | |
78 | ||
91447636 A |
79 | #include <sys/_types.h> |
80 | ||
1c79356b | 81 | #ifndef NULL |
91447636 A |
82 | #define NULL __DARWIN_NULL |
83 | #endif /* ! NULL */ | |
1c79356b A |
84 | |
85 | #ifndef LOCORE | |
86 | #include <sys/types.h> | |
87 | #endif | |
88 | ||
89 | /* | |
90 | * Machine-independent constants (some used in following include files). | |
91 | * Redefined constants are from POSIX 1003.1 limits file. | |
92 | * | |
93 | * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>) | |
94 | * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>) | |
95 | */ | |
96 | #include <sys/syslimits.h> | |
97 | ||
98 | #define MAXCOMLEN 16 /* max command name remembered */ | |
99 | #define MAXINTERP 64 /* max interpreter file name length */ | |
9bccf70c | 100 | #define MAXLOGNAME 255 /* max login name length */ |
1c79356b A |
101 | #define MAXUPRC CHILD_MAX /* max simultaneous processes */ |
102 | #define NCARGS ARG_MAX /* max bytes for an exec function */ | |
103 | #define NGROUPS NGROUPS_MAX /* max number groups */ | |
104 | #define NOFILE 256 /* default max open files per process */ | |
105 | #define NOGROUP 65535 /* marker for empty group set member */ | |
106 | #define MAXHOSTNAMELEN 256 /* max hostname size */ | |
107 | #define MAXDOMNAMELEN 256 /* maximum domain name length */ | |
108 | ||
109 | /* Machine type dependent parameters. */ | |
110 | #include <machine/param.h> | |
1c79356b A |
111 | |
112 | /* More types and definitions used throughout the kernel. */ | |
113 | #ifdef KERNEL | |
55e303ae | 114 | #include <machine/limits.h> |
1c79356b A |
115 | #include <sys/cdefs.h> |
116 | #include <sys/errno.h> | |
117 | #include <sys/time.h> | |
118 | #include <sys/resource.h> | |
119 | #include <sys/ucred.h> | |
120 | #include <sys/uio.h> | |
55e303ae A |
121 | #else |
122 | #include <limits.h> | |
1c79356b A |
123 | #endif |
124 | ||
125 | /* Signals. */ | |
126 | #include <sys/signal.h> | |
127 | ||
128 | /* | |
129 | * Priorities. Note that with 32 run queues, differences less than 4 are | |
130 | * insignificant. | |
131 | */ | |
132 | #define PSWP 0 | |
133 | #define PVM 4 | |
134 | #define PINOD 8 | |
135 | #define PRIBIO 16 | |
136 | #define PVFS 20 | |
137 | #define PZERO 22 /* No longer magic, shouldn't be here. XXX */ | |
138 | #define PSOCK 24 | |
139 | #define PWAIT 32 | |
140 | #define PLOCK 36 | |
141 | #define PPAUSE 40 | |
142 | #define PUSER 50 | |
143 | #define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ | |
144 | ||
145 | #define PRIMASK 0x0ff | |
146 | #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ | |
147 | #define PTTYBLOCK 0x200 /* for tty SIGTTOU and SIGTTIN blocking */ | |
91447636 | 148 | #define PDROP 0x400 /* OR'd with pri to stop re-entry of interlock mutex */ |
1c79356b A |
149 | |
150 | #define NZERO 0 /* default "nice" */ | |
151 | ||
152 | #define NBPW sizeof(int) /* number of bytes per word (integer) */ | |
153 | ||
154 | #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ | |
155 | #define NODEV (dev_t)(-1) /* non-existent device */ | |
156 | ||
157 | /* | |
158 | * Clustering of hardware pages on machines with ridiculously small | |
159 | * page sizes is done here. The paging subsystem deals with units of | |
160 | * CLSIZE pte's describing NBPG (from machine/param.h) pages each. | |
161 | */ | |
162 | #define CLBYTES (CLSIZE*NBPG) | |
163 | #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ | |
164 | #define claligned(x) ((((int)(x))&CLOFSET)==0) | |
165 | #define CLOFF CLOFSET | |
166 | #define CLSHIFT (PGSHIFT+CLSIZELOG2) | |
167 | ||
168 | #if CLSIZE==1 | |
169 | #define clbase(i) (i) | |
170 | #define clrnd(i) (i) | |
171 | #else | |
172 | /* Give the base virtual address (first of CLSIZE). */ | |
173 | #define clbase(i) ((i) &~ (CLSIZE-1)) | |
174 | /* Round a number of clicks up to a whole cluster. */ | |
175 | #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) | |
176 | #endif | |
177 | ||
178 | #define CBLOCK 64 /* Clist block size, must be a power of 2. */ | |
179 | #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ | |
180 | /* Data chars/clist. */ | |
181 | #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) | |
182 | #define CROUND (CBLOCK - 1) /* Clist rounding. */ | |
183 | ||
184 | /* | |
185 | * File system parameters and macros. | |
186 | * | |
91447636 | 187 | * The file system is made out of blocks of at most MAXPHYS units, with |
1c79356b A |
188 | * smaller units (fragments) only in the last direct block. MAXBSIZE |
189 | * primarily determines the size of buffers in the buffer pool. It may be | |
91447636 A |
190 | * made larger than MAXPHYS without any effect on existing file systems; |
191 | * however making it smaller may make some file systems unmountable. | |
192 | * We set this to track the value of (MAX_UPL_TRANSFER*PAGE_SIZE) from | |
193 | * osfmk/mach/memory_object_types.h to bound it at the maximum UPL size. | |
1c79356b | 194 | */ |
91447636 | 195 | #define MAXBSIZE (256 * 4096) |
1c79356b A |
196 | #define MAXPHYSIO MAXPHYS |
197 | #define MAXFRAG 8 | |
198 | ||
91447636 A |
199 | #define MAXPHYSIO_WIRED (16 * 1024 * 1024) |
200 | ||
1c79356b A |
201 | /* |
202 | * MAXPATHLEN defines the longest permissable path length after expanding | |
203 | * symbolic links. It is used to allocate a temporary buffer from the buffer | |
204 | * pool in which to do the name expansion, hence should be a power of two, | |
205 | * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the | |
206 | * maximum number of symbolic links that may be expanded in a path name. | |
207 | * It should be set high enough to allow all legitimate uses, but halt | |
208 | * infinite loops reasonably quickly. | |
209 | */ | |
210 | #define MAXPATHLEN PATH_MAX | |
211 | #define MAXSYMLINKS 32 | |
212 | ||
213 | /* Bit map related macros. */ | |
214 | #define setbit(a,i) (((char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) | |
215 | #define clrbit(a,i) (((char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) | |
216 | #define isset(a,i) (((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) | |
217 | #define isclr(a,i) ((((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) | |
218 | ||
219 | /* Macros for counting and rounding. */ | |
220 | #ifndef howmany | |
221 | #define howmany(x, y) (((x)+((y)-1))/(y)) | |
222 | #endif | |
223 | #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) | |
224 | #define powerof2(x) ((((x)-1)&(x))==0) | |
225 | ||
226 | /* Macros for min/max. */ | |
227 | #ifndef MIN | |
228 | #define MIN(a,b) (((a)<(b))?(a):(b)) | |
229 | #endif /* MIN */ | |
230 | #ifndef MAX | |
231 | #define MAX(a,b) (((a)>(b))?(a):(b)) | |
232 | #endif /* MAX */ | |
233 | ||
234 | /* | |
235 | * Constants for setting the parameters of the kernel memory allocator. | |
236 | * | |
237 | * 2 ** MINBUCKET is the smallest unit of memory that will be | |
238 | * allocated. It must be at least large enough to hold a pointer. | |
239 | * | |
240 | * Units of memory less or equal to MAXALLOCSAVE will permanently | |
241 | * allocate physical memory; requests for these size pieces of | |
242 | * memory are quite fast. Allocations greater than MAXALLOCSAVE must | |
243 | * always allocate and free physical memory; requests for these | |
244 | * size allocations should be done infrequently as they will be slow. | |
245 | * | |
246 | * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and | |
247 | * MAXALLOCSIZE must be a power of two. | |
248 | */ | |
249 | #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ | |
250 | #define MAXALLOCSAVE (2 * CLBYTES) | |
251 | ||
252 | /* | |
253 | * Scale factor for scaled integers used to count %cpu time and load avgs. | |
254 | * | |
255 | * The number of CPU `tick's that map to a unique `%age' can be expressed | |
256 | * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that | |
257 | * can be calculated (assuming 32 bits) can be closely approximated using | |
258 | * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). | |
259 | * | |
260 | * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', | |
261 | * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. | |
262 | */ | |
263 | #define FSHIFT 11 /* bits to right of fixed binary point */ | |
264 | #define FSCALE (1<<FSHIFT) | |
265 | ||
266 | #endif /* _SYS_PARAM_H_ */ |