]>
Commit | Line | Data |
---|---|---|
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, 1997 Apple Computer, Inc. All Rights Reserved */ | |
23 | /*- | |
24 | * Copyright (c) 1982, 1986, 1989, 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 | * @(#)param.h 8.3 (Berkeley) 4/4/95 | |
61 | */ | |
62 | ||
63 | #ifndef _SYS_PARAM_H_ | |
64 | #define _SYS_PARAM_H_ | |
65 | ||
66 | #define BSD 199506 /* System version (year & month). */ | |
67 | #define BSD4_3 1 | |
68 | #define BSD4_4 1 | |
69 | ||
70 | #define NeXTBSD 1995064 /* NeXTBSD version (year, month, release) */ | |
71 | #define NeXTBSD4_0 0 /* NeXTBSD 4.0 */ | |
72 | ||
73 | #ifndef NULL | |
74 | #define NULL 0 | |
75 | #endif | |
76 | ||
77 | #ifndef LOCORE | |
78 | #include <sys/types.h> | |
79 | #endif | |
80 | ||
81 | /* | |
82 | * Machine-independent constants (some used in following include files). | |
83 | * Redefined constants are from POSIX 1003.1 limits file. | |
84 | * | |
85 | * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>) | |
86 | * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>) | |
87 | */ | |
88 | #include <sys/syslimits.h> | |
89 | ||
90 | #define MAXCOMLEN 16 /* max command name remembered */ | |
91 | #define MAXINTERP 64 /* max interpreter file name length */ | |
9bccf70c | 92 | #define MAXLOGNAME 255 /* max login name length */ |
1c79356b A |
93 | #define MAXUPRC CHILD_MAX /* max simultaneous processes */ |
94 | #define NCARGS ARG_MAX /* max bytes for an exec function */ | |
95 | #define NGROUPS NGROUPS_MAX /* max number groups */ | |
96 | #define NOFILE 256 /* default max open files per process */ | |
97 | #define NOGROUP 65535 /* marker for empty group set member */ | |
98 | #define MAXHOSTNAMELEN 256 /* max hostname size */ | |
99 | #define MAXDOMNAMELEN 256 /* maximum domain name length */ | |
100 | ||
101 | /* Machine type dependent parameters. */ | |
102 | #include <machine/param.h> | |
103 | #include <machine/limits.h> | |
104 | ||
105 | /* More types and definitions used throughout the kernel. */ | |
106 | #ifdef KERNEL | |
107 | #include <sys/cdefs.h> | |
108 | #include <sys/errno.h> | |
109 | #include <sys/time.h> | |
110 | #include <sys/resource.h> | |
111 | #include <sys/ucred.h> | |
112 | #include <sys/uio.h> | |
113 | #endif | |
114 | ||
115 | /* Signals. */ | |
116 | #include <sys/signal.h> | |
117 | ||
118 | /* | |
119 | * Priorities. Note that with 32 run queues, differences less than 4 are | |
120 | * insignificant. | |
121 | */ | |
122 | #define PSWP 0 | |
123 | #define PVM 4 | |
124 | #define PINOD 8 | |
125 | #define PRIBIO 16 | |
126 | #define PVFS 20 | |
127 | #define PZERO 22 /* No longer magic, shouldn't be here. XXX */ | |
128 | #define PSOCK 24 | |
129 | #define PWAIT 32 | |
130 | #define PLOCK 36 | |
131 | #define PPAUSE 40 | |
132 | #define PUSER 50 | |
133 | #define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ | |
134 | ||
135 | #define PRIMASK 0x0ff | |
136 | #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ | |
137 | #define PTTYBLOCK 0x200 /* for tty SIGTTOU and SIGTTIN blocking */ | |
138 | ||
139 | #define NZERO 0 /* default "nice" */ | |
140 | ||
141 | #define NBPW sizeof(int) /* number of bytes per word (integer) */ | |
142 | ||
143 | #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ | |
144 | #define NODEV (dev_t)(-1) /* non-existent device */ | |
145 | ||
146 | /* | |
147 | * Clustering of hardware pages on machines with ridiculously small | |
148 | * page sizes is done here. The paging subsystem deals with units of | |
149 | * CLSIZE pte's describing NBPG (from machine/param.h) pages each. | |
150 | */ | |
151 | #define CLBYTES (CLSIZE*NBPG) | |
152 | #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ | |
153 | #define claligned(x) ((((int)(x))&CLOFSET)==0) | |
154 | #define CLOFF CLOFSET | |
155 | #define CLSHIFT (PGSHIFT+CLSIZELOG2) | |
156 | ||
157 | #if CLSIZE==1 | |
158 | #define clbase(i) (i) | |
159 | #define clrnd(i) (i) | |
160 | #else | |
161 | /* Give the base virtual address (first of CLSIZE). */ | |
162 | #define clbase(i) ((i) &~ (CLSIZE-1)) | |
163 | /* Round a number of clicks up to a whole cluster. */ | |
164 | #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) | |
165 | #endif | |
166 | ||
167 | #define CBLOCK 64 /* Clist block size, must be a power of 2. */ | |
168 | #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ | |
169 | /* Data chars/clist. */ | |
170 | #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) | |
171 | #define CROUND (CBLOCK - 1) /* Clist rounding. */ | |
172 | ||
173 | /* | |
174 | * File system parameters and macros. | |
175 | * | |
176 | * The file system is made out of blocks of at most MAXBSIZE units, with | |
177 | * smaller units (fragments) only in the last direct block. MAXBSIZE | |
178 | * primarily determines the size of buffers in the buffer pool. It may be | |
179 | * made larger without any effect on existing file systems; however making | |
180 | * it smaller make make some file systems unmountable. | |
181 | */ | |
182 | #define MAXBSIZE MAXPHYS | |
183 | #define MAXPHYSIO MAXPHYS | |
184 | #define MAXFRAG 8 | |
185 | ||
186 | /* | |
187 | * MAXPATHLEN defines the longest permissable path length after expanding | |
188 | * symbolic links. It is used to allocate a temporary buffer from the buffer | |
189 | * pool in which to do the name expansion, hence should be a power of two, | |
190 | * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the | |
191 | * maximum number of symbolic links that may be expanded in a path name. | |
192 | * It should be set high enough to allow all legitimate uses, but halt | |
193 | * infinite loops reasonably quickly. | |
194 | */ | |
195 | #define MAXPATHLEN PATH_MAX | |
196 | #define MAXSYMLINKS 32 | |
197 | ||
198 | /* Bit map related macros. */ | |
199 | #define setbit(a,i) (((char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) | |
200 | #define clrbit(a,i) (((char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) | |
201 | #define isset(a,i) (((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) | |
202 | #define isclr(a,i) ((((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) | |
203 | ||
204 | /* Macros for counting and rounding. */ | |
205 | #ifndef howmany | |
206 | #define howmany(x, y) (((x)+((y)-1))/(y)) | |
207 | #endif | |
208 | #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) | |
209 | #define powerof2(x) ((((x)-1)&(x))==0) | |
210 | ||
211 | /* Macros for min/max. */ | |
212 | #ifndef MIN | |
213 | #define MIN(a,b) (((a)<(b))?(a):(b)) | |
214 | #endif /* MIN */ | |
215 | #ifndef MAX | |
216 | #define MAX(a,b) (((a)>(b))?(a):(b)) | |
217 | #endif /* MAX */ | |
218 | ||
219 | /* | |
220 | * Constants for setting the parameters of the kernel memory allocator. | |
221 | * | |
222 | * 2 ** MINBUCKET is the smallest unit of memory that will be | |
223 | * allocated. It must be at least large enough to hold a pointer. | |
224 | * | |
225 | * Units of memory less or equal to MAXALLOCSAVE will permanently | |
226 | * allocate physical memory; requests for these size pieces of | |
227 | * memory are quite fast. Allocations greater than MAXALLOCSAVE must | |
228 | * always allocate and free physical memory; requests for these | |
229 | * size allocations should be done infrequently as they will be slow. | |
230 | * | |
231 | * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and | |
232 | * MAXALLOCSIZE must be a power of two. | |
233 | */ | |
234 | #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ | |
235 | #define MAXALLOCSAVE (2 * CLBYTES) | |
236 | ||
237 | /* | |
238 | * Scale factor for scaled integers used to count %cpu time and load avgs. | |
239 | * | |
240 | * The number of CPU `tick's that map to a unique `%age' can be expressed | |
241 | * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that | |
242 | * can be calculated (assuming 32 bits) can be closely approximated using | |
243 | * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). | |
244 | * | |
245 | * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', | |
246 | * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. | |
247 | */ | |
248 | #define FSHIFT 11 /* bits to right of fixed binary point */ | |
249 | #define FSCALE (1<<FSHIFT) | |
250 | ||
251 | #endif /* _SYS_PARAM_H_ */ |