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 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
45 * Fundamental variables; don't change too often.
47 * This file is included here for compatibility with
48 * SunOS, but it does *not* include all the values
49 * define in the SunOS version of this file.
52 #include <sys/isa_defs.h>
61 #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */
65 #define MAX_CANON 256 /* Maximum bytes for canoical processing */
68 #define UID_NOBODY 60001
69 #define GID_NOBODY 60001
71 #define UID_NOACCESS 60002 /* user ID no access */
73 #define MAXPID ((pid_t)sysconf(_SC_MAXPID)) /* max process id */
74 #define MAXUID 2147483647 /* max user id */
75 #define MAXLINK 32767 /* max links */
77 #define NMOUNT 40 /* est. of # mountable fs for quota calc */
79 /* The values below are defined in limits.h */
80 #define NOFILE OPEN_MAX /* max open files per process */
82 #define CANBSIZ 256 /* max size of typewriter line */
83 #define HZ ((int)sysconf(_SC_CLK_TCK)) /* ticks/second of the clock */
84 #define TICK (1000000000/((int)sysconf(_SC_CLK_TCK)))
86 #define NCARGS 0x100000 /* # characters in exec arglist */
87 /* must be multiple of NBPW. */
89 * These define the maximum and minimum allowable values of the
90 * configurable parameter NGROUPS_MAX.
92 #define NGROUPS_UMAX 32
93 #define NGROUPS_UMIN 8
95 #define NGROUPS NGROUPS_MAX /* max number groups, from limits.h */
96 #define NOGROUP -1 /* marker for empty group set member */
99 * Priorities. Should not be altered too much.
104 #define PNOSTOP 01000
123 * Fundamental constants of the implementation--cannot be changed easily.
126 #define NBPS 0x20000 /* Number of bytes per segment */
127 #define NBPW sizeof (int) /* number of bytes in an integer */
129 #define CMASK 0 /* default mask for file creation */
130 #define CDLIMIT (1L<<11) /* default max write address */
131 #define NODEV (dev_t)(-1)
132 #define NBPSCTR 512 /* Bytes per disk sector. */
133 #define UBSIZE 512 /* unix block size. */
134 #define SCTRSHFT 9 /* Shift for BPSECT. */
136 #define lobyte(X) (((unsigned char *)&(X))[1])
137 #define hibyte(X) (((unsigned char *)&(X))[0])
138 #define loword(X) (((ushort_t *)&(X))[1])
139 #define hiword(X) (((ushort_t *)&(X))[0])
141 /* REMOTE -- whether machine is primary, secondary, or regular */
142 #define SYSNAME 9 /* # chars in system name */
146 * MAXPATHLEN defines the longest permissible path length,
147 * including the terminating null, after expanding symbolic links.
148 * MAXSYMLINKS defines the maximum number of symbolic links
149 * that may be expanded in a path name. It should be set high
150 * enough to allow all legitimate uses, but halt infinite loops
151 * reasonably quickly.
152 * MAXNAMELEN is the length (including the terminating null) of
153 * the longest permissible file (component) name.
155 #define MAXPATHLEN 1024
156 #define MAXSYMLINKS 20
157 #define MAXNAMELEN 256
164 * The following are defined to be the same as
165 * defined in /usr/include/limits.h. They are
166 * needed for pipe and FIFO compatibility.
168 #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */
169 #define PIPE_BUF 5120
170 #endif /* PIPE_BUF */
172 #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */
173 #define PIPE_MAX 5120
174 #endif /* PIPE_MAX */
176 #define PIPEBUF PIPE_BUF /* pipe buffer size */
179 #define NBBY 8 /* number of bits per byte */
182 /* macros replacing interleaving functions */
183 #define dkblock(bp) ((bp)->b_blkno)
184 #define dkunit(bp) (minor((bp)->b_dev) >> 3)
187 * File system parameters and macros.
189 * The file system is made out of blocks of at most MAXBSIZE units,
190 * with smaller units (fragments) only in the last direct block.
191 * MAXBSIZE primarily determines the size of buffers in the buffer
192 * pool. It may be made larger without any effect on existing
193 * file systems; however making it smaller make make some file
194 * systems unmountable.
196 * Note that the blocked devices are assumed to have DEV_BSIZE
197 * "sectors" and that fragments must be some multiple of this size.
199 #define MAXBSIZE 8192
200 #define DEV_BSIZE 512
201 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
205 #define MAXOFF_T 0x7fffffffffffffffl
206 #define MAXOFFSET_T 0x7fffffffffffffffll
208 #define MAXOFF_T 0x7fffffff
209 #ifndef _LONGLONG_TYPE
210 #define MAXOFFSET_T 0x7fffffff
212 #define MAXOFFSET_T 0x7fffffffffffffffLL
216 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
217 ((unsigned)(bytes) >> DEV_BSHIFT)
218 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
219 ((unsigned)(db) << DEV_BSHIFT)
222 * PAGES* describes the logical page size used by the system.
225 #define PAGESIZE (sysconf(_SC_PAGESIZE)) /* All the above, for logical */
226 #define PAGEOFFSET (PAGESIZE - 1)
227 #define PAGEMASK (~PAGEOFFSET)
230 * Some random macros for units conversion.
234 * pages to bytes, and back (with and without rounding)
236 #define ptob(x) ((x) * PAGESIZE)
237 #define btop(x) (((unsigned)(x)) / PAGESIZE)
238 #define btopr(x) ((((unsigned)(x) + PAGEOFFSET) / PAGESIZE))
244 #include <sys/signal.h>
245 #include <sys/types.h>
248 * bit map related macros
250 #define setbit(a, i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
251 #define clrbit(a, i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
252 #define isset(a, i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
253 #define isclr(a, i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
256 * Macros for fast min/max.
259 #define MIN(a, b) (((a) < (b))?(a):(b))
262 #define MAX(a, b) (((a) > (b))?(a):(b))
265 #define howmany(x, y) (((x)+((y)-1))/(y))
266 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
269 * Scale factor for scaled integers used to count
270 * %cpu time and load averages.
272 #define FSHIFT 8 /* bits to right of fixed binary point */
273 #define FSCALE (1<<FSHIFT)
276 * Maximum size of hostname recognized and stored in the kernel.
277 * Same as in /usr/include/netdb.h
279 #ifndef MAXHOSTNAMELEN
280 #define MAXHOSTNAMELEN 256
287 #endif /* _SYS_PARAM_H */