1 /*- 2 * Copyright (c) 1982, 1986, 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * $Id: param.h,v 1.2 94/07/26 19:14:36 bill Exp Locker: bill $ 34 */ 35 36 #define __386BSDREL__ 1 /* Release 1 */ 37 #define __386BSDREV__ 0 /* Revision 0 (e.g. 1.0) */ 38 39 #ifndef NULL 40 #define NULL 0 41 #endif 42 43 #ifndef LOCORE 44 #include <sys/types.h> 45 #endif 46 47 #include <sys/syslimits.h> 48 49 #ifndef _POSIX_SOURCE 50 /* 51 * BSD compatibility: machine-independent constants (some used in 52 * following include files). 53 * 54 * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>) 55 */ 56 57 #define MAXCOMLEN 16 /* max command name remembered */ 58 #define MAXLOGNAME 12 /* max login name length */ 59 #define NOGROUP 65535 /* marker for empty group set member */ 60 #define MAXHOSTNAMELEN 256 /* max hostname size */ 61 62 #ifdef nope 63 #if defined(_386BSD_ONLY) || defined(KERNEL) 64 /* 65 * iBCS2 compatibility: Many of these define obselete portions of the 66 * archaic UNIX implementation. Unfortunately, to be compliant the 67 * standard calls them out, however, nothing in 386BSD depends on 68 * them; the sole presence here is for minimal standards conformance. 69 * See Intel iBCS 2 spec, Figure 6-23, page 6-44. 70 */ 71 72 #define MAXPID 30000 /* PID_MAX from proc.h */ 73 #define MAXUID SHRT_MAX 74 #define HZ CLK_TCK 75 #define TICK 1000000 /* one microsecond resolution */ 76 #define NCARGS ARG_MAX 77 #define NOFILES_MIN 20 /* thank you V7 */ 78 #define NOFILES_MAX OPEN_MAX 79 #endif /* !_386BSD_ONLY */ 80 #endif 81 #endif /* !_POSIX_SOURCE */ 82 83 /* default inclusion of signal definitions */ 84 #include <sys/signal.h> 85 86 /* Machine type dependent parameters. */ 87 #include <machine/param.h> 88 #include <machine/endian.h> 89 #include <machine/limits.h> 90 91 /* 92 * Clustering of hardware pages on machines with ridiculously small 93 * page sizes is done here. The paging subsystem deals with units of 94 * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 95 */ 96 #define CLBYTES (CLSIZE*NBPG) 97 #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 98 #define claligned(x) ((((int)(x))&CLOFSET)==0) 99 #define CLOFF CLOFSET 100 #define CLSHIFT (PGSHIFT+CLSIZELOG2) 101 102 #if CLSIZE==1 103 #define clbase(i) (i) 104 #define clrnd(i) (i) 105 #else 106 /* Give the base virtual address (first of CLSIZE). */ 107 #define clbase(i) ((i) &~ (CLSIZE-1)) 108 /* Round a number of clicks up to a whole cluster. */ 109 #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 110 #endif 111 112 /* 113 * File system parameters and macros. 114 * 115 * The file system is made out of blocks of at most MAXBSIZE units, with 116 * smaller units (fragments) only in the last direct block. MAXBSIZE 117 * primarily determines the size of buffers in the buffer pool. It may be 118 * made larger without any effect on existing file systems; however making 119 * it smaller make make some file systems unmountable. 120 */ 121 #define MAXBSIZE 8192 122 #define MAXFRAG 8 123 124 /* 125 * MAXSYMLINKS defines the maximum number of symbolic links that may be 126 * expanded in a path name. It should be set high enough to allow all 127 * legitimate uses, but halt infinite loops reasonably quickly. 128 */ 129 #define MAXSYMLINKS 8 130 131 /* Macros for counting and rounding. */ 132 #ifndef howmany 133 #define howmany(x, y) (((x)+((y)-1))/(y)) 134 #endif 135 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 136 #define powerof2(x) ((((x)-1)&(x))==0) 137 138 /* Macros for fast min/max: with inline expansion, the "function" is faster. */ 139 #ifdef KERNEL 140 /*#define MIN(a,b) min((a), (b)) 141 #define MAX(a,b) max((a), (b))*/ 142 #else 143 #define MIN(a,b) (((a)<(b))?(a):(b)) 144 #define MAX(a,b) (((a)>(b))?(a):(b)) 145 #endif 146 147 /* 148 * Constants for setting the parameters of the kernel memory allocator. 149 * 150 * 2 ** MINBUCKET is the smallest unit of memory that will be 151 * allocated. It must be at least large enough to hold a pointer. 152 * 153 * Units of memory less or equal to MAXALLOCSAVE will permanently 154 * allocate physical memory; requests for these size pieces of 155 * memory are quite fast. Allocations greater than MAXALLOCSAVE must 156 * always allocate and free physical memory; requests for these 157 * size allocations should be done infrequently as they will be slow. 158 * 159 * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and 160 * MAXALLOCSIZE must be a power of two. 161 */ 162 #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ 163 #define MAXALLOCSAVE (2 * CLBYTES) 164 165 /* 166 * Scale factor for scaled integers used to count %cpu time and load avgs. 167 * 168 * The number of CPU `tick's that map to a unique `%age' can be expressed 169 * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that 170 * can be calculated (assuming 32 bits) can be closely approximated using 171 * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). 172 * 173 * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', 174 * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. 175 */ 176 #define FSHIFT 11 /* bits to right of fixed binary point */ 177 #define FSCALE (1<<FSHIFT) 178