xref: /titanic_44/usr/src/lib/libbc/inc/include/sys/param.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #ifndef	__sys_param_h
30 #define	__sys_param_h
31 
32 /*
33  * Machine type dependent parameters.
34  */
35 #include <machine/param.h>
36 
37 #define	NPTEPG		(NBPG/(sizeof (struct pte)))
38 
39 /*
40  * Machine-independent constants
41  */
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 */
52 #ifndef	KERNEL
53 /*
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.
57  */
58 #define	HZ	60
59 #endif
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 */
63 
64 #define	NOGROUP	-1		/* marker for empty group set member */
65 
66 #ifdef	KERNEL
67 /*
68  * Priorities
69  */
70 #define	PMASK	0177
71 #define	PCATCH	0400		/* return if sleep interrupted, don't longjmp */
72 #define	PSWP	0
73 #define	PINOD	10
74 #define	PAMAP	10
75 #define	PRIBIO	20
76 #define	PRIUBA	24
77 #define	PZERO	25
78 #define	PPIPE	26
79 #define	PVFS	27
80 #define	PWAIT	30
81 #define	PLOCK	35
82 #define	PSLEP	40
83 
84 #ifdef	VPIX
85 #define	PV86	41
86 #endif
87 
88 #define	PFLCK	42	/* File/Record lock */
89 
90 #define	PUSER	50
91 
92 #define	NZERO	20
93 #endif	/* KERNEL */
94 
95 /*
96  * Signals
97  */
98 #include <sys/signal.h>
99 
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))
103 
104 #define	NBPW	sizeof (int)	/* number of bytes in an integer */
105 
106 #ifndef	NULL
107 #define	NULL	0
108 #endif
109 #define	CMASK	0		/* default mask for file creation */
110 #define	NODEV	(dev_t)(-1)
111 
112 #ifndef	INTRLVE
113 /* macros replacing interleaving functions */
114 #define	dkblock(bp)	((bp)->b_blkno)
115 #define	dkunit(bp)	(minor((bp)->b_dev) >> 3)
116 #endif
117 
118 #define	CBSIZE	28		/* number of chars in a clist block */
119 #define	CROUND	0x1F		/* clist rounding; sizeof (int *) + CBSIZE-1 */
120 
121 #if	!defined(LOCORE) || !defined(KERNEL)
122 #include <sys/types.h>
123 #endif
124 
125 /*
126  * File system parameters and macros.
127  *
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.
134  *
135  * Note that the blocked devices are assumed to have DEV_BSIZE
136  * "sectors" and that fragments must be some multiple of this size.
137  */
138 #define	MAXBSIZE	8192
139 #define	DEV_BSIZE	512
140 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
141 #define	MAXFRAG 	8
142 
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)
147 
148 /*
149  * Map a ``block device block'' to a file system block.
150  * XXX - this is currently only being used for tape drives.
151  */
152 #define	BLKDEV_IOSIZE	2048
153 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
154 
155 /*
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.
162  */
163 #define	MAXPATHLEN	1024
164 #define	MAXSYMLINKS	20
165 
166 /*
167  * bit map related macros
168  */
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)
173 
174 /*
175  * Macros for fast min/max.
176  */
177 #ifndef	MIN
178 #define	MIN(a,b) (((a)<(b))?(a):(b))
179 #endif
180 #ifndef	MAX
181 #define	MAX(a,b) (((a)>(b))?(a):(b))
182 #endif
183 
184 /*
185  * Macros for counting and rounding.
186  */
187 #ifdef	sun386
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))
190 #else
191 #define	howmany(x, y)	(((x)+((y)-1))/(y))
192 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
193 #endif
194 
195 /*
196  * Scale factor for scaled integers used to count
197  * %cpu time and load averages.
198  */
199 #define	FSHIFT	8		/* bits to right of fixed binary point */
200 #define	FSCALE	(1<<FSHIFT)
201 
202 /*
203  * Maximum size of hostname recognized and stored in the kernel.
204  */
205 #define	MAXHOSTNAMELEN  64
206 
207 #endif	/* !__sys_param_h */
208