d65fadadb60daedf99d35a358259d7792ed72ae6
[dragonfly.git] / sys / i386 / boot / dosboot / sysparam.h
1 /*-\r
2  * Copyright (c) 1982, 1986, 1989, 1993\r
3  *      The Regents of the University of California.  All rights reserved.\r
4  * (c) UNIX System Laboratories, Inc.\r
5  * All or some portions of this file are derived from material licensed\r
6  * to the University of California by American Telephone and Telegraph\r
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with\r
8  * the permission of UNIX System Laboratories, Inc.\r
9  *\r
10  * Redistribution and use in source and binary forms, with or without\r
11  * modification, are permitted provided that the following conditions\r
12  * are met:\r
13  * 1. Redistributions of source code must retain the above copyright\r
14  *    notice, this list of conditions and the following disclaimer.\r
15  * 2. Redistributions in binary form must reproduce the above copyright\r
16  *    notice, this list of conditions and the following disclaimer in the\r
17  *    documentation and/or other materials provided with the distribution.\r
18  * 3. All advertising materials mentioning features or use of this software\r
19  *    must display the following acknowledgement:\r
20  *      This product includes software developed by the University of\r
21  *      California, Berkeley and its contributors.\r
22  * 4. Neither the name of the University nor the names of its contributors\r
23  *    may be used to endorse or promote products derived from this software\r
24  *    without specific prior written permission.\r
25  *\r
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
36  * SUCH DAMAGE.\r
37  *\r
38  *      @(#)param.h     8.2 (Berkeley) 1/21/94\r
39  * $FreeBSD: src/sys/i386/boot/dosboot/sysparam.h,v 1.5 1999/08/28 00:43:25 peter Exp $\r
40  * $DragonFly: src/sys/i386/boot/dosboot/Attic/sysparam.h,v 1.3 2003/07/13 05:45:08 dillon Exp $\r
41  */\r
42 \r
43 #ifndef _DOSBOOT_SYS_PARAM_H_\r
44 #define _DOSBOOT_SYS_PARAM_H_\r
45 \r
46 #define BSD     199306          /* System version (year & month). */\r
47 #define BSD4_3  1\r
48 #define BSD4_4  1\r
49 \r
50 #ifndef NULL\r
51 #define NULL    0\r
52 #endif\r
53 \r
54 #ifndef LOCORE\r
55 #include "types.h"\r
56 #endif\r
57 \r
58 /*\r
59  * Machine-independent constants (some used in following include files).\r
60  * Redefined constants are from POSIX 1003.1 limits file.\r
61  *\r
62  * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)\r
63  * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)\r
64  */\r
65 #include "syslimits.h"\r
66 \r
67 #define MAXCOMLEN       16              /* max command name remembered */\r
68 #define MAXINTERP       32              /* max interpreter file name length */\r
69 #define MAXLOGNAME      12              /* max login name length */\r
70 #define MAXUPRC         CHILD_MAX       /* max simultaneous processes */\r
71 #define NCARGS          ARG_MAX         /* max bytes for an exec function */\r
72 #define NGROUPS         NGROUPS_MAX     /* max number groups */\r
73 #define NOFILE          OPEN_MAX        /* max open files per process */\r
74 #define NOGROUP         65535           /* marker for empty group set member */\r
75 #define MAXHOSTNAMELEN  256             /* max hostname size */\r
76 \r
77 /* More types and definitions used throughout the kernel. */\r
78 #ifdef KERNEL\r
79 /*\r
80 include <sys/cdefs.h>\r
81 include <sys/errno.h>\r
82 include <sys/time.h>\r
83 include <sys/resource.h>\r
84 include <sys/ucred.h>\r
85 include <sys/uio.h>\r
86 include <sys/rtprio.h>\r
87 */\r
88 #endif\r
89 \r
90 /* Signals. */\r
91 /*#include <sys/signal.h>*/\r
92 \r
93 /* Machine type dependent parameters. */\r
94 #include "param.h"\r
95 #include "limits.h"\r
96 \r
97 /*\r
98  * Priorities.  Note that with 32 run queues, differences less than 4 are\r
99  * insignificant.\r
100  */\r
101 #define PSWP    0\r
102 #define PVM     4\r
103 #define PINOD   8\r
104 #define PRIBIO  16\r
105 #define PVFS    20\r
106 #define PZERO   22              /* No longer magic, shouldn't be here.  XXX */\r
107 #define PSOCK   24\r
108 #define PWAIT   32\r
109 #define PLOCK   36\r
110 #define PPAUSE  40\r
111 #define PUSER   50\r
112 #define MAXPRI  127             /* Priorities range from 0 through MAXPRI. */\r
113 \r
114 #define PRIMASK 0x0ff\r
115 #define PCATCH  0x100           /* OR'd with pri for tsleep to check signals */\r
116 \r
117 #define NZERO   0               /* default "nice" */\r
118 \r
119 #define NBPW    sizeof(long)    /* number of bytes per word (integer) */\r
120 \r
121 #define CMASK   022             /* default file mask: S_IWGRP|S_IWOTH */\r
122 #define NODEV   (dev_t)(-1)     /* non-existent device */\r
123 \r
124 /*\r
125  * Clustering of hardware pages on machines with ridiculously small\r
126  * page sizes is done here.  The paging subsystem deals with units of\r
127  * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each.\r
128  */\r
129 #define CLBYTES         (CLSIZE*NBPG)\r
130 #define CLOFSET         (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */\r
131 #define claligned(x)    ((((long)(x))&CLOFSET)==0)\r
132 #define CLOFF           CLOFSET\r
133 #define CLSHIFT         (PGSHIFT+CLSIZELOG2)\r
134 \r
135 #if CLSIZE==1\r
136 #define clbase(i)       (i)\r
137 #define clrnd(i)        (i)\r
138 #else\r
139 /* Give the base virtual address (first of CLSIZE). */\r
140 #define clbase(i)       ((i) &~ (CLSIZE-1))\r
141 /* Round a number of clicks up to a whole cluster. */\r
142 #define clrnd(i)        (((i) + (CLSIZE-1)) &~ (CLSIZE-1))\r
143 #endif\r
144 \r
145 #define CBLOCK  128             /* Clist block size, must be a power of 2. */\r
146 #define CBQSIZE (CBLOCK/NBBY)   /* Quote bytes/cblock - can do better. */\r
147                                 /* Data chars/clist. */\r
148 #define CBSIZE  (CBLOCK - sizeof(struct cblock *) - CBQSIZE)\r
149 #define CROUND  (CBLOCK - 1)    /* Clist rounding. */\r
150 \r
151 /*\r
152  * File system parameters and macros.\r
153  *\r
154  * The file system is made out of blocks of at most MAXBSIZE units, with\r
155  * smaller units (fragments) only in the last direct block.  MAXBSIZE\r
156  * primarily determines the size of buffers in the buffer pool.  It may be\r
157  * made larger without any effect on existing file systems; however making\r
158  * it smaller make make some file systems unmountable.\r
159  */\r
160 #define MAXBSIZE        MAXPHYS\r
161 #define MAXFRAG         8\r
162 \r
163 /*\r
164  * MAXPATHLEN defines the longest permissable path length after expanding\r
165  * symbolic links. It is used to allocate a temporary buffer from the buffer\r
166  * pool in which to do the name expansion, hence should be a power of two,\r
167  * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the\r
168  * maximum number of symbolic links that may be expanded in a path name.\r
169  * It should be set high enough to allow all legitimate uses, but halt\r
170  * infinite loops reasonably quickly.\r
171  */\r
172 #define MAXPATHLEN      PATH_MAX\r
173 #define MAXSYMLINKS     8\r
174 \r
175 /* Bit map related macros. */\r
176 #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))\r
177 #define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))\r
178 #define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))\r
179 #define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)\r
180 \r
181 /* Macros for counting and rounding. */\r
182 #ifndef howmany\r
183 #define howmany(x, y)   (((x)+((y)-1))/(y))\r
184 #endif\r
185 #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))\r
186 #define powerof2(x)     ((((x)-1)&(x))==0)\r
187 \r
188 /* Macros for min/max. */\r
189 #ifndef KERNEL\r
190 #define MIN(a,b) (((a)<(b))?(a):(b))\r
191 #define MAX(a,b) (((a)>(b))?(a):(b))\r
192 #endif\r
193 \r
194 /*\r
195  * Constants for setting the parameters of the kernel memory allocator.\r
196  *\r
197  * 2 ** MINBUCKET is the smallest unit of memory that will be\r
198  * allocated. It must be at least large enough to hold a pointer.\r
199  *\r
200  * Units of memory less or equal to MAXALLOCSAVE will permanently\r
201  * allocate physical memory; requests for these size pieces of\r
202  * memory are quite fast. Allocations greater than MAXALLOCSAVE must\r
203  * always allocate and free physical memory; requests for these\r
204  * size allocations should be done infrequently as they will be slow.\r
205  *\r
206  * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and\r
207  * MAXALLOCSIZE must be a power of two.\r
208  */\r
209 #define MINBUCKET       4               /* 4 => min allocation of 16 bytes */\r
210 #define MAXALLOCSAVE    (2 * CLBYTES)\r
211 \r
212 /*\r
213  * Scale factor for scaled integers used to count %cpu time and load avgs.\r
214  *\r
215  * The number of CPU `tick's that map to a unique `%age' can be expressed\r
216  * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that\r
217  * can be calculated (assuming 32 bits) can be closely approximated using\r
218  * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).\r
219  *\r
220  * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',\r
221  * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.\r
222  */\r
223 #define FSHIFT  11              /* bits to right of fixed binary point */\r
224 #define FSCALE  (1<<FSHIFT)\r
225 \r
226 #endif\r