Chameleon

Chameleon Svn Source Tree

Root/branches/slice/trunkM/i386/include/sys/param.h

1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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.h8.3 (Berkeley) 4/4/95
67 */
68
69#ifndef_SYS_PARAM_H_
70#define _SYS_PARAM_H_
71
72#defineBSD199506/* System version (year & month). */
73#define BSD4_31
74#define BSD4_41
75
76#define NeXTBSD1995064/* NeXTBSD version (year, month, release) */
77#define NeXTBSD4_0 0/* NeXTBSD 4.0 */
78
79#ifndef NULL
80#defineNULL__DARWIN_NULL
81#endif /* ! NULL */
82
83#ifndef LOCORE
84#include <sys/types.h>
85#endif
86
87/*
88 * Machine-independent constants (some used in following include files).
89 * Redefined constants are from POSIX 1003.1 limits file.
90 *
91 * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
92 * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
93 */
94#include <sys/syslimits.h>
95
96#defineMAXCOMLEN16/* max command name remembered */
97#defineMAXINTERP64/* max interpreter file name length */
98#defineMAXLOGNAME255/* max login name length */
99#defineMAXUPRCCHILD_MAX/* max simultaneous processes */
100#defineNCARGSARG_MAX/* max bytes for an exec function */
101#defineNGROUPSNGROUPS_MAX/* max number groups */
102#defineNOFILE256/* default max open files per process */
103#defineNOGROUP65535/* marker for empty group set member */
104#define MAXHOSTNAMELEN256/* max hostname size */
105#define MAXDOMNAMELEN256/* maximum domain name length */
106
107/* Machine type dependent parameters. */
108#include <i386/param.h>
109
110/* More types and definitions used throughout the kernel. */
111#include <limits.h>
112
113/*
114 * Priorities. Note that with 32 run queues, differences less than 4 are
115 * insignificant.
116 */
117#definePSWP0
118#definePVM4
119#definePINOD8
120#definePRIBIO16
121#definePVFS20
122#definePZERO22/* No longer magic, shouldn't be here. XXX */
123#definePSOCK24
124#definePWAIT32
125#definePLOCK36
126#definePPAUSE40
127#definePUSER50
128#defineMAXPRI127/* Priorities range from 0 through MAXPRI. */
129
130#definePRIMASK0x0ff
131#definePCATCH0x100/* OR'd with pri for tsleep to check signals */
132#define PTTYBLOCK 0x200/* for tty SIGTTOU and SIGTTIN blocking */
133#define PDROP0x400/* OR'd with pri to stop re-aquistion of mutex upon wakeup */
134#define PSPIN0x800/* OR'd with pri to require mutex in spin mode upon wakeup */
135
136#defineNBPWsizeof(int)/* number of bytes per word (integer) */
137
138#defineCMASK022/* default file mask: S_IWGRP|S_IWOTH */
139#defineNODEV(dev_t)(-1)/* non-existent device */
140
141/*
142 * Clustering of hardware pages on machines with ridiculously small
143 * page sizes is done here. The paging subsystem deals with units of
144 * CLSIZE pte's describing NBPG (from machine/param.h) pages each.
145 */
146#defineCLBYTES(CLSIZE*NBPG)
147#defineCLOFSET(CLSIZE*NBPG-1)/* for clusters, like PGOFSET */
148#defineclaligned(x)((((int)(x))&CLOFSET)==0)
149#defineCLOFFCLOFSET
150#defineCLSHIFT(PGSHIFT+CLSIZELOG2)
151
152#if CLSIZE==1
153#defineclbase(i)(i)
154#defineclrnd(i)(i)
155#else
156/* Give the base virtual address (first of CLSIZE). */
157#defineclbase(i)((i) &~ (CLSIZE-1))
158/* Round a number of clicks up to a whole cluster. */
159#defineclrnd(i)(((i) + (CLSIZE-1)) &~ (CLSIZE-1))
160#endif
161
162#defineCBLOCK64/* Clist block size, must be a power of 2. */
163#define CBQSIZE(CBLOCK/NBBY)/* Quote bytes/cblock - can do better. */
164/* Data chars/clist. */
165#defineCBSIZE(CBLOCK - sizeof(struct cblock *) - CBQSIZE)
166#defineCROUND(CBLOCK - 1)/* Clist rounding. */
167
168/*
169 * File system parameters and macros.
170 *
171 * The file system is made out of blocks of at most MAXPHYS units, with
172 * smaller units (fragments) only in the last direct block. MAXBSIZE
173 * primarily determines the size of buffers in the buffer pool. It may be
174 * made larger than MAXPHYS without any effect on existing file systems;
175 * however making it smaller may make some file systems unmountable.
176 * We set this to track the value of (MAX_UPL_TRANSFER*PAGE_SIZE) from
177 * osfmk/mach/memory_object_types.h to bound it at the maximum UPL size.
178 */
179#defineMAXBSIZE(256 * 4096)
180#define MAXPHYSIOMAXPHYS
181#define MAXFRAG 8
182
183#defineMAXPHYSIO_WIRED(16 * 1024 * 1024)
184
185/*
186 * MAXPATHLEN defines the longest permissable path length after expanding
187 * symbolic links. It is used to allocate a temporary buffer from the buffer
188 * pool in which to do the name expansion, hence should be a power of two,
189 * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
190 * maximum number of symbolic links that may be expanded in a path name.
191 * It should be set high enough to allow all legitimate uses, but halt
192 * infinite loops reasonably quickly.
193 */
194#defineMAXPATHLENPATH_MAX
195#define MAXSYMLINKS32
196
197/* Bit map related macros. */
198#definesetbit(a,i)(((char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))
199#defineclrbit(a,i)(((char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))
200#defineisset(a,i)(((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))
201#defineisclr(a,i)((((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
202
203/* Macros for counting and rounding. */
204#ifndef howmany
205#definehowmany(x, y)((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1))
206#endif
207#defineroundup(x, y)((((x)+((y)-1))/(y))*(y))
208#define powerof2(x)((((x)-1)&(x))==0)
209
210/* Macros for min/max. */
211#ifndef MIN
212#defineMIN(a,b) (((a)<(b))?(a):(b))
213#endif /* MIN */
214#ifndef MAX
215#defineMAX(a,b) (((a)>(b))?(a):(b))
216#endif/* MAX */
217
218/*
219 * Constants for setting the parameters of the kernel memory allocator.
220 *
221 * 2 ** MINBUCKET is the smallest unit of memory that will be
222 * allocated. It must be at least large enough to hold a pointer.
223 *
224 * Units of memory less or equal to MAXALLOCSAVE will permanently
225 * allocate physical memory; requests for these size pieces of
226 * memory are quite fast. Allocations greater than MAXALLOCSAVE must
227 * always allocate and free physical memory; requests for these
228 * size allocations should be done infrequently as they will be slow.
229 *
230 * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
231 * MAXALLOCSIZE must be a power of two.
232 */
233#define MINBUCKET4/* 4 => min allocation of 16 bytes */
234#define MAXALLOCSAVE(2 * CLBYTES)
235
236/*
237 * Scale factor for scaled integers used to count %cpu time and load avgs.
238 *
239 * The number of CPU `tick's that map to a unique `%age' can be expressed
240 * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
241 * can be calculated (assuming 32 bits) can be closely approximated using
242 * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
243 *
244 * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
245 * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
246 */
247#defineFSHIFT11/* bits to right of fixed binary point */
248#define FSCALE(1<<FSHIFT)
249
250#endif/* _SYS_PARAM_H_ */
251

Archive Download this file

Revision: 1171