123430Smckusick /* 238783Skarels * Copyright (c) 1982, 1986, 1989 Regents of the University of California. 323430Smckusick * All rights reserved. The Berkeley software License Agreement 423430Smckusick * specifies the terms and conditions for redistribution. 523430Smckusick * 6*40209Skarels * @(#)param.h 7.12 (Berkeley) 02/22/90 723430Smckusick */ 863Sbill 9*40209Skarels #define BSD 199002 /* system version (year & month) */ 1025297Skarels #define BSD4_3 1 1124654Sbloom 1236805Sbostic #include <sys/syslimits.h> 1336805Sbostic 1463Sbill /* 158993Sroot * Machine-independent constants 168993Sroot */ 17*40209Skarels #define NMOUNT 30 /* number of mountable file systems */ 1816796Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 1915070Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 2036805Sbostic #define MAXUPRC CHILD_MAX /* max processes per user */ 2136805Sbostic #define NOFILE OPEN_MAX /* max open files per process */ 22*40209Skarels #define CANBSIZ 256 /* max size of tty input line */ 2336805Sbostic #define NCARGS ARG_MAX /* # characters in exec arglist */ 2430576Sbostic #define MAXINTERP 32 /* maximum interpreter file name length */ 2536805Sbostic #define NGROUPS NGROUPS_MAX /* max number groups */ 2630406Skarels #define MAXHOSTNAMELEN 64 /* maximum hostname size */ 272751Swnj 2826257Skarels #define NOGROUP 65535 /* marker for empty group set member */ 2911808Ssam 3063Sbill /* 318993Sroot * Priorities 3263Sbill */ 3363Sbill #define PSWP 0 3463Sbill #define PINOD 10 3563Sbill #define PRIBIO 20 3637717Smckusick #define PVFS 22 3763Sbill #define PRIUBA 24 3863Sbill #define PZERO 25 3963Sbill #define PPIPE 26 4063Sbill #define PWAIT 30 417688Ssam #define PLOCK 35 4263Sbill #define PSLEP 40 4363Sbill #define PUSER 50 4463Sbill 4517556Skarels #define NZERO 0 4663Sbill 4730406Skarels #ifndef KERNEL 4830406Skarels #include <sys/types.h> 4930406Skarels #else 5030406Skarels #ifndef LOCORE 5130406Skarels #include "types.h" 5230406Skarels #endif 5330406Skarels #endif 5430406Skarels 5563Sbill /* 568993Sroot * Signals 5763Sbill */ 5812880Ssam #ifdef KERNEL 5917033Sbloom #include "signal.h" 6012880Ssam #else 6138783Skarels #include <sys/signal.h> 62176Sbill #endif 6363Sbill 6430406Skarels /* 6530406Skarels * Machine type dependent parameters. 6630406Skarels */ 6730406Skarels #ifdef KERNEL 6837497Smckusick #include "machine/machparam.h" 6930406Skarels #else 7030406Skarels #include <machine/machparam.h> 7130406Skarels #endif 7230406Skarels 7312880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 7463Sbill 7538783Skarels #ifndef NULL 7663Sbill #define NULL 0 7738783Skarels #endif 7816796Skarels #define CMASK 022 /* default mask for file creation */ 7963Sbill #define NODEV (dev_t)(-1) 8063Sbill 8163Sbill /* 8263Sbill * Clustering of hardware pages on machines with ridiculously small 8363Sbill * page sizes is done here. The paging subsystem deals with units of 8430406Skarels * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 8563Sbill * 8663Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8763Sbill */ 885080Swnj #define CLBYTES (CLSIZE*NBPG) 892637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 905080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 915080Swnj #define CLOFF CLOFSET 928993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 9363Sbill 948993Sroot #if CLSIZE==1 958993Sroot #define clbase(i) (i) 968993Sroot #define clrnd(i) (i) 978993Sroot #else 9863Sbill /* give the base virtual address (first of CLSIZE) */ 9963Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 10063Sbill /* round a number of clicks up to a whole cluster */ 10163Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 1028993Sroot #endif 10363Sbill 10424930Skarels /* CBLOCK is the size of a clist block, must be power of 2 */ 10524930Skarels #define CBLOCK 64 10635813Smarc #define CBQSIZE (CBLOCK/NBBY) /* quote bytes/cblock - can do better */ 10735813Smarc #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) /* data chars/clist */ 10824930Skarels #define CROUND (CBLOCK - 1) /* clist rounding */ 10963Sbill 11063Sbill /* 1116564Smckusic * File system parameters and macros. 1126564Smckusic * 1136564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1146564Smckusic * with smaller units (fragments) only in the last direct block. 1156564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1166564Smckusic * pool. It may be made larger without any effect on existing 1176564Smckusic * file systems; however making it smaller make make some file 1186564Smckusic * systems unmountable. 1193069Swnj */ 1206564Smckusic #define MAXBSIZE 8192 1216564Smckusic #define MAXFRAG 8 1226564Smckusic 1236564Smckusic /* 1246564Smckusic * MAXPATHLEN defines the longest permissable path length 1256564Smckusic * after expanding symbolic links. It is used to allocate 1266564Smckusic * a temporary buffer from the buffer pool in which to do the 1276564Smckusic * name expansion, hence should be a power of two, and must 1286564Smckusic * be less than or equal to MAXBSIZE. 1296564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1306564Smckusic * that may be expanded in a path name. It should be set high 1316564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1326564Smckusic * reasonably quickly. 1336564Smckusic */ 13436805Sbostic #define MAXPATHLEN PATH_MAX 1356564Smckusic #define MAXSYMLINKS 8 1366564Smckusic 1376564Smckusic /* 138*40209Skarels * bit map related macros 139*40209Skarels */ 140*40209Skarels #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 141*40209Skarels #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 142*40209Skarels #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 143*40209Skarels #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 144*40209Skarels 145*40209Skarels /* 146*40209Skarels * Macros for counting and rounding. 147*40209Skarels */ 148*40209Skarels #ifndef howmany 149*40209Skarels #define howmany(x, y) (((x)+((y)-1))/(y)) 150*40209Skarels #endif 151*40209Skarels #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 152*40209Skarels #define powerof2(x) ((((x)-1)&(x))==0) 153*40209Skarels 154*40209Skarels /* 155*40209Skarels * Macros for fast min/max: 156*40209Skarels * with inline expansion, the "function" is faster. 157*40209Skarels */ 158*40209Skarels #ifdef KERNEL 159*40209Skarels #define MIN(a,b) min((a), (b)) 160*40209Skarels #define MAX(a,b) max((a), (b)) 161*40209Skarels #else 162*40209Skarels #define MIN(a,b) (((a)<(b))?(a):(b)) 163*40209Skarels #define MAX(a,b) (((a)>(b))?(a):(b)) 164*40209Skarels #endif 165*40209Skarels 166*40209Skarels /* 16731414Smckusick * Constants for setting the parameters of the kernel memory allocator. 16831414Smckusick * 16931414Smckusick * 2 ** MINBUCKET is the smallest unit of memory that will be 17031414Smckusick * allocated. It must be at least large enough to hold a pointer. 17131414Smckusick * 17231414Smckusick * Units of memory less or equal to MAXALLOCSAVE will permanently 17331414Smckusick * allocate physical memory; requests for these size pieces of 17431414Smckusick * memory are quite fast. Allocations greater than MAXALLOCSAVE must 17531414Smckusick * always allocate and free physical memory; requests for these 17631414Smckusick * size allocations should be done infrequently as they will be slow. 17731414Smckusick * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14) 17831414Smckusick * and MAXALLOCSIZE must be a power of two. 17931414Smckusick */ 18031414Smckusick #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ 18131414Smckusick #define MAXALLOCSAVE (2 * CLBYTES) 18231414Smckusick 18331414Smckusick /* 18438161Smckusick * Scale factor for scaled integers used to count %cpu time and load avgs. 18538161Smckusick * 18638161Smckusick * The number of CPU `tick's that map to a unique `%age' can be expressed 18738161Smckusick * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that 18838161Smckusick * can be calculated (assuming 32 bits) can be closely approximated using 18938161Smckusick * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). 19038161Smckusick * 19138161Smckusick * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', 19238161Smckusick * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. 19338161Smckusick */ 19438161Smckusick #define FSHIFT 11 /* bits to right of fixed binary point */ 19538161Smckusick #define FSCALE (1<<FSHIFT) 196