Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
1810611d | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
95f51977 | 6 | * @(#)param.h 7.1 (Berkeley) 6/4/86 |
da7c5cc6 | 7 | */ |
eb401bce | 8 | |
c698cc52 MK |
9 | #define BSD 43 /* 4.3 * 10, as cpp doesn't do floats */ |
10 | #define BSD4_3 1 | |
7ca6930d | 11 | |
66b33372 C |
12 | /* |
13 | * Machine type dependent parameters. | |
14 | */ | |
15 | #ifdef KERNEL | |
95f51977 | 16 | #include "../machine/machparam.h" |
66b33372 | 17 | #else |
95f51977 | 18 | #include <machine/machparam.h> |
66b33372 C |
19 | #endif |
20 | ||
21 | #define NPTEPG (NBPG/(sizeof (struct pte))) | |
22 | ||
557ae0ad BJ |
23 | /* |
24 | * Machine-independent constants | |
25 | */ | |
3a1d681e | 26 | #define NMOUNT 20 /* number of mountable file systems */ |
6691aca1 | 27 | /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ |
af3615f2 | 28 | #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ |
c698cc52 | 29 | #define MAXUPRC 40 /* max processes per user */ |
daedd4ff | 30 | #define NOFILE 64 /* max open files per process */ |
eb401bce | 31 | #define CANBSIZ 256 /* max size of typewriter line */ |
3a1d681e | 32 | #define NCARGS 20480 /* # characters in exec arglist */ |
a6981044 | 33 | #define NGROUPS 16 /* max number groups */ |
62d0f535 | 34 | |
e6536319 | 35 | #define NOGROUP 65535 /* marker for empty group set member */ |
72ed8ae9 | 36 | |
eb401bce | 37 | /* |
557ae0ad | 38 | * Priorities |
eb401bce | 39 | */ |
eb401bce BJ |
40 | #define PSWP 0 |
41 | #define PINOD 10 | |
42 | #define PRIBIO 20 | |
43 | #define PRIUBA 24 | |
44 | #define PZERO 25 | |
45 | #define PPIPE 26 | |
46 | #define PWAIT 30 | |
85e197bd | 47 | #define PLOCK 35 |
eb401bce BJ |
48 | #define PSLEP 40 |
49 | #define PUSER 50 | |
50 | ||
3a1d681e | 51 | #define NZERO 0 |
eb401bce BJ |
52 | |
53 | /* | |
557ae0ad | 54 | * Signals |
eb401bce | 55 | */ |
40dc6933 | 56 | #ifdef KERNEL |
88fc1c0a | 57 | #include "signal.h" |
40dc6933 | 58 | #else |
92808ee4 BJ |
59 | #include <signal.h> |
60 | #endif | |
31037142 | 61 | |
40dc6933 SL |
62 | #define ISSIG(p) \ |
63 | ((p)->p_sig && ((p)->p_flag&STRC || \ | |
d6ccfc62 | 64 | ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) |
02dd5a44 | 65 | |
40dc6933 | 66 | #define NBPW sizeof(int) /* number of bytes in an integer */ |
eb401bce | 67 | |
eb401bce | 68 | #define NULL 0 |
6691aca1 | 69 | #define CMASK 022 /* default mask for file creation */ |
eb401bce | 70 | #define NODEV (dev_t)(-1) |
eb401bce BJ |
71 | |
72 | /* | |
73 | * Clustering of hardware pages on machines with ridiculously small | |
74 | * page sizes is done here. The paging subsystem deals with units of | |
95f51977 | 75 | * CLSIZE pte's describing NBPG (from vm.h) pages each. |
eb401bce BJ |
76 | * |
77 | * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE | |
eb401bce | 78 | */ |
114cd253 | 79 | #define CLBYTES (CLSIZE*NBPG) |
7070df31 | 80 | #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ |
114cd253 BJ |
81 | #define claligned(x) ((((int)(x))&CLOFSET)==0) |
82 | #define CLOFF CLOFSET | |
557ae0ad | 83 | #define CLSHIFT (PGSHIFT+CLSIZELOG2) |
eb401bce | 84 | |
557ae0ad BJ |
85 | #if CLSIZE==1 |
86 | #define clbase(i) (i) | |
87 | #define clrnd(i) (i) | |
88 | #else | |
eb401bce BJ |
89 | /* give the base virtual address (first of CLSIZE) */ |
90 | #define clbase(i) ((i) &~ (CLSIZE-1)) | |
eb401bce BJ |
91 | /* round a number of clicks up to a whole cluster */ |
92 | #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) | |
557ae0ad | 93 | #endif |
eb401bce | 94 | |
8981cbeb MK |
95 | /* CBLOCK is the size of a clist block, must be power of 2 */ |
96 | #define CBLOCK 64 | |
97 | #define CBSIZE (CBLOCK - sizeof(struct cblock *)) /* data chars/clist */ | |
98 | #define CROUND (CBLOCK - 1) /* clist rounding */ | |
eb401bce | 99 | |
66b33372 C |
100 | #ifndef KERNEL |
101 | #include <sys/types.h> | |
102 | #else | |
103 | #ifndef LOCORE | |
95f51977 | 104 | #include "types.h" |
66b33372 C |
105 | #endif |
106 | #endif | |
107 | ||
d5d4a859 | 108 | /* |
ad30fb67 KM |
109 | * File system parameters and macros. |
110 | * | |
111 | * The file system is made out of blocks of at most MAXBSIZE units, | |
112 | * with smaller units (fragments) only in the last direct block. | |
113 | * MAXBSIZE primarily determines the size of buffers in the buffer | |
114 | * pool. It may be made larger without any effect on existing | |
115 | * file systems; however making it smaller make make some file | |
116 | * systems unmountable. | |
117 | * | |
118 | * Note that the blocked devices are assumed to have DEV_BSIZE | |
119 | * "sectors" and that fragments must be some multiple of this size. | |
0f3b0b88 KM |
120 | * Block devices are read in BLKDEV_IOSIZE units. This number must |
121 | * be a power of two and in the range of | |
122 | * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE | |
123 | * This size has no effect upon the file system, but is usually set | |
124 | * to the block size of the root file system, so as to maximize the | |
125 | * speed of ``fsck''. | |
ad30fb67 KM |
126 | */ |
127 | #define MAXBSIZE 8192 | |
66b33372 C |
128 | #define DEV_BSIZE 512 |
129 | #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
130 | #define BLKDEV_IOSIZE 2048 | |
ad30fb67 KM |
131 | #define MAXFRAG 8 |
132 | ||
66b33372 C |
133 | #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ |
134 | ((unsigned)(bytes) >> DEV_BSHIFT) | |
135 | #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ | |
136 | ((unsigned)(db) << DEV_BSHIFT) | |
137 | ||
138 | /* | |
139 | * Map a ``block device block'' to a file system block. | |
140 | * This should be device dependent, and will be after we | |
141 | * add an entry to cdevsw for that purpose. For now though | |
142 | * just use DEV_BSIZE. | |
143 | */ | |
144 | #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) | |
145 | ||
ad30fb67 KM |
146 | /* |
147 | * MAXPATHLEN defines the longest permissable path length | |
148 | * after expanding symbolic links. It is used to allocate | |
149 | * a temporary buffer from the buffer pool in which to do the | |
150 | * name expansion, hence should be a power of two, and must | |
151 | * be less than or equal to MAXBSIZE. | |
152 | * MAXSYMLINKS defines the maximum number of symbolic links | |
153 | * that may be expanded in a path name. It should be set high | |
154 | * enough to allow all legitimate uses, but halt infinite loops | |
155 | * reasonably quickly. | |
156 | */ | |
157 | #define MAXPATHLEN 1024 | |
158 | #define MAXSYMLINKS 8 | |
159 | ||
160 | /* | |
161 | * bit map related macros | |
162 | */ | |
163 | #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) | |
164 | #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) | |
165 | #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) | |
166 | #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) | |
167 | ||
168 | /* | |
169 | * Macros for fast min/max. | |
170 | */ | |
171 | #define MIN(a,b) (((a)<(b))?(a):(b)) | |
172 | #define MAX(a,b) (((a)>(b))?(a):(b)) | |
173 | ||
174 | /* | |
175 | * Macros for counting and rounding. | |
176 | */ | |
9477baeb | 177 | #ifndef howmany |
ad30fb67 | 178 | #define howmany(x, y) (((x)+((y)-1))/(y)) |
9477baeb | 179 | #endif |
ad30fb67 | 180 | #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) |
95f51977 C |
181 | |
182 | /* | |
183 | * Maximum size of hostname recognized and stored in the kernel. | |
184 | */ | |
185 | #define MAXHOSTNAMELEN 64 |