Merge from vendor branch GCC:
[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.5 2003/08/01 17:46:20 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 MAXPRI  127             /* Priorities range from 0 through MAXPRI. */\r
102 \r
103 #define PRIMASK 0x0ff\r
104 #define PCATCH  0x100           /* OR'd with pri for tsleep to check signals */\r
105 \r
106 #define NZERO   0               /* default "nice" */\r
107 \r
108 #define NBPW    sizeof(long)    /* number of bytes per word (integer) */\r
109 \r
110 #define CMASK   022             /* default file mask: S_IWGRP|S_IWOTH */\r
111 #define NODEV   (dev_t)(-1)     /* non-existent device */\r
112 \r
113 /*\r
114  * Clustering of hardware pages on machines with ridiculously small\r
115  * page sizes is done here.  The paging subsystem deals with units of\r
116  * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each.\r
117  */\r
118 #define CLBYTES         (CLSIZE*NBPG)\r
119 #define CLOFSET         (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */\r
120 #define claligned(x)    ((((long)(x))&CLOFSET)==0)\r
121 #define CLOFF           CLOFSET\r
122 #define CLSHIFT         (PGSHIFT+CLSIZELOG2)\r
123 \r
124 #if CLSIZE==1\r
125 #define clbase(i)       (i)\r
126 #define clrnd(i)        (i)\r
127 #else\r
128 /* Give the base virtual address (first of CLSIZE). */\r
129 #define clbase(i)       ((i) &~ (CLSIZE-1))\r
130 /* Round a number of clicks up to a whole cluster. */\r
131 #define clrnd(i)        (((i) + (CLSIZE-1)) &~ (CLSIZE-1))\r
132 #endif\r
133 \r
134 #define CBLOCK  128             /* Clist block size, must be a power of 2. */\r
135 #define CBQSIZE (CBLOCK/NBBY)   /* Quote bytes/cblock - can do better. */\r
136                                 /* Data chars/clist. */\r
137 #define CBSIZE  (CBLOCK - sizeof(struct cblock *) - CBQSIZE)\r
138 #define CROUND  (CBLOCK - 1)    /* Clist rounding. */\r
139 \r
140 /*\r
141  * File system parameters and macros.\r
142  *\r
143  * The file system is made out of blocks of at most MAXBSIZE units, with\r
144  * smaller units (fragments) only in the last direct block.  MAXBSIZE\r
145  * primarily determines the size of buffers in the buffer pool.  It may be\r
146  * made larger without any effect on existing file systems; however making\r
147  * it smaller make make some file systems unmountable.\r
148  */\r
149 #define MAXBSIZE        MAXPHYS\r
150 #define MAXFRAG         8\r
151 \r
152 /*\r
153  * MAXPATHLEN defines the longest permissable path length after expanding\r
154  * symbolic links. It is used to allocate a temporary buffer from the buffer\r
155  * pool in which to do the name expansion, hence should be a power of two,\r
156  * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the\r
157  * maximum number of symbolic links that may be expanded in a path name.\r
158  * It should be set high enough to allow all legitimate uses, but halt\r
159  * infinite loops reasonably quickly.\r
160  */\r
161 #define MAXPATHLEN      PATH_MAX\r
162 #define MAXSYMLINKS     8\r
163 \r
164 /* Bit map related macros. */\r
165 #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))\r
166 #define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))\r
167 #define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))\r
168 #define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)\r
169 \r
170 /* Macros for counting and rounding. */\r
171 #ifndef howmany\r
172 #define howmany(x, y)   (((x)+((y)-1))/(y))\r
173 #endif\r
174 #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))\r
175 #define powerof2(x)     ((((x)-1)&(x))==0)\r
176 \r
177 /* Macros for min/max. */\r
178 #ifndef KERNEL\r
179 #define MIN(a,b) (((a)<(b))?(a):(b))\r
180 #define MAX(a,b) (((a)>(b))?(a):(b))\r
181 #endif\r
182 \r
183 /*\r
184  * Constants for setting the parameters of the kernel memory allocator.\r
185  *\r
186  * 2 ** MINBUCKET is the smallest unit of memory that will be\r
187  * allocated. It must be at least large enough to hold a pointer.\r
188  *\r
189  * Units of memory less or equal to MAXALLOCSAVE will permanently\r
190  * allocate physical memory; requests for these size pieces of\r
191  * memory are quite fast. Allocations greater than MAXALLOCSAVE must\r
192  * always allocate and free physical memory; requests for these\r
193  * size allocations should be done infrequently as they will be slow.\r
194  *\r
195  * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and\r
196  * MAXALLOCSIZE must be a power of two.\r
197  */\r
198 #define MINBUCKET       4               /* 4 => min allocation of 16 bytes */\r
199 #define MAXALLOCSAVE    (2 * CLBYTES)\r
200 \r
201 /*\r
202  * Scale factor for scaled integers used to count %cpu time and load avgs.\r
203  *\r
204  * The number of CPU `tick's that map to a unique `%age' can be expressed\r
205  * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that\r
206  * can be calculated (assuming 32 bits) can be closely approximated using\r
207  * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).\r
208  *\r
209  * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',\r
210  * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.\r
211  */\r
212 #define FSHIFT  11              /* bits to right of fixed binary point */\r
213 #define FSCALE  (1<<FSHIFT)\r
214 \r
215 #endif\r