4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1989 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Machine type dependent parameters.
35 #include <machine/param.h>
37 #define NPTEPG (NBPG/(sizeof (struct pte)))
40 * Machine-independent constants
42 #define NMOUNT 40 /* est. of # mountable fs for quota calc */
43 #define MSWAPX 15 /* pseudo mount table index for swapdev */
44 #define MAXUPRC 25 /* max processes per user */
45 #define NOFILE 256 /* max open files per process */
46 #define MAXPID 30000 /* max process id */
47 #define MAXUID 0xfffd /* max user id (from 60000) */
48 #define MAXLINK 32767 /* max links */
49 #define CANBSIZ 256 /* max size of typewriter line */
50 #define VDISABLE 0 /* use this to turn off c_cc[i] */
51 #define PIPE_BUF 4096 /* pipe buffer size */
54 * HZ defines the ticks/second for system calls, eg, times(), which
55 * return values just in ticks; but not for getrusage(), which returns
56 * values in ticks*pages. HZ *must* be 60 for compatibility reasons.
60 #define NCARGS 0x100000 /* (absolute) max # characters in exec arglist */
61 /* If NGROUPS changes, change <sys/limits.h> NGROUPS_MAX at the same time. */
62 #define NGROUPS 16 /* max number groups */
64 #define NOGROUP -1 /* marker for empty group set member */
71 #define PCATCH 0400 /* return if sleep interrupted, don't longjmp */
88 #define PFLCK 42 /* File/Record lock */
98 #include <sys/signal.h>
100 #define ISSIG(p, flag) \
101 ((p)->p_sig && ((p)->p_flag&STRC || \
102 ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig(flag))
104 #define NBPW sizeof (int) /* number of bytes in an integer */
109 #define CMASK 0 /* default mask for file creation */
110 #define NODEV (dev_t)(-1)
113 /* macros replacing interleaving functions */
114 #define dkblock(bp) ((bp)->b_blkno)
115 #define dkunit(bp) (minor((bp)->b_dev) >> 3)
118 #define CBSIZE 28 /* number of chars in a clist block */
119 #define CROUND 0x1F /* clist rounding; sizeof (int *) + CBSIZE-1 */
121 #if !defined(LOCORE) || !defined(KERNEL)
122 #include <sys/types.h>
126 * File system parameters and macros.
128 * The file system is made out of blocks of at most MAXBSIZE units,
129 * with smaller units (fragments) only in the last direct block.
130 * MAXBSIZE primarily determines the size of buffers in the buffer
131 * pool. It may be made larger without any effect on existing
132 * file systems; however making it smaller make make some file
133 * systems unmountable.
135 * Note that the blocked devices are assumed to have DEV_BSIZE
136 * "sectors" and that fragments must be some multiple of this size.
138 #define MAXBSIZE 8192
139 #define DEV_BSIZE 512
140 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
143 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
144 ((unsigned)(bytes) >> DEV_BSHIFT)
145 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
146 ((unsigned)(db) << DEV_BSHIFT)
149 * Map a ``block device block'' to a file system block.
150 * XXX - this is currently only being used for tape drives.
152 #define BLKDEV_IOSIZE 2048
153 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
156 * MAXPATHLEN defines the longest permissable path length,
157 * including the terminating null, after expanding symbolic links.
158 * MAXSYMLINKS defines the maximum number of symbolic links
159 * that may be expanded in a path name. It should be set high
160 * enough to allow all legitimate uses, but halt infinite loops
161 * reasonably quickly.
163 #define MAXPATHLEN 1024
164 #define MAXSYMLINKS 20
167 * bit map related macros
169 #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
170 #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
171 #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
172 #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
175 * Macros for fast min/max.
178 #define MIN(a,b) (((a)<(b))?(a):(b))
181 #define MAX(a,b) (((a)>(b))?(a):(b))
185 * Macros for counting and rounding.
188 #define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y)))
189 #define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y))
191 #define howmany(x, y) (((x)+((y)-1))/(y))
192 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
196 * Scale factor for scaled integers used to count
197 * %cpu time and load averages.
199 #define FSHIFT 8 /* bits to right of fixed binary point */
200 #define FSCALE (1<<FSHIFT)
203 * Maximum size of hostname recognized and stored in the kernel.
205 #define MAXHOSTNAMELEN 64
207 #endif /* !__sys_param_h */