123430Smckusick /* 229036Smckusick * Copyright (c) 1982, 1986 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*35813Smarc * @(#)param.h 7.6 (Berkeley) 10/18/88 723430Smckusick */ 863Sbill 9*35813Smarc #define BSD 198810 /* system version (year & month) */ 1025297Skarels #define BSD4_3 1 1124654Sbloom 1263Sbill /* 138993Sroot * Machine-independent constants 148993Sroot */ 1517556Skarels #define NMOUNT 20 /* number of mountable file systems */ 1616796Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 1715070Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 1825297Skarels #define MAXUPRC 40 /* max processes per user */ 1919955Skarels #define NOFILE 64 /* max open files per process */ 2063Sbill #define CANBSIZ 256 /* max size of typewriter line */ 2117556Skarels #define NCARGS 20480 /* # characters in exec arglist */ 2230576Sbostic #define MAXINTERP 32 /* maximum interpreter file name length */ 2317996Skarels #define NGROUPS 16 /* max number groups */ 2430406Skarels #define MAXHOSTNAMELEN 64 /* maximum hostname size */ 252751Swnj 2626257Skarels #define NOGROUP 65535 /* marker for empty group set member */ 2711808Ssam 2863Sbill /* 298993Sroot * Priorities 3063Sbill */ 3163Sbill #define PSWP 0 3263Sbill #define PINOD 10 3363Sbill #define PRIBIO 20 3463Sbill #define PRIUBA 24 3563Sbill #define PZERO 25 3663Sbill #define PPIPE 26 3763Sbill #define PWAIT 30 387688Ssam #define PLOCK 35 3963Sbill #define PSLEP 40 4063Sbill #define PUSER 50 4163Sbill 4217556Skarels #define NZERO 0 4363Sbill 4430406Skarels #ifndef KERNEL 4530406Skarels #include <sys/types.h> 4630406Skarels #else 4730406Skarels #ifndef LOCORE 4830406Skarels #include "types.h" 4930406Skarels #endif 5030406Skarels #endif 5130406Skarels 5263Sbill /* 538993Sroot * Signals 5463Sbill */ 5512880Ssam #ifdef KERNEL 5617033Sbloom #include "signal.h" 5712880Ssam #else 58176Sbill #include <signal.h> 59176Sbill #endif 6063Sbill 6112880Ssam #define ISSIG(p) \ 6212880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 6312965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 648467Sroot 6530406Skarels /* 6630406Skarels * Machine type dependent parameters. 6730406Skarels */ 6830406Skarels #ifdef KERNEL 6930406Skarels #include "../machine/machparam.h" 7030406Skarels #else 7130406Skarels #include <machine/machparam.h> 7230406Skarels #endif 7330406Skarels 7412880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 7563Sbill 7663Sbill #define NULL 0 7716796Skarels #define CMASK 022 /* default mask for file creation */ 7863Sbill #define NODEV (dev_t)(-1) 7963Sbill 8063Sbill /* 8163Sbill * Clustering of hardware pages on machines with ridiculously small 8263Sbill * page sizes is done here. The paging subsystem deals with units of 8330406Skarels * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 8463Sbill * 8563Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8663Sbill */ 875080Swnj #define CLBYTES (CLSIZE*NBPG) 882637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 895080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 905080Swnj #define CLOFF CLOFSET 918993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 9263Sbill 938993Sroot #if CLSIZE==1 948993Sroot #define clbase(i) (i) 958993Sroot #define clrnd(i) (i) 968993Sroot #else 9763Sbill /* give the base virtual address (first of CLSIZE) */ 9863Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 9963Sbill /* round a number of clicks up to a whole cluster */ 10063Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 1018993Sroot #endif 10263Sbill 10324930Skarels /* CBLOCK is the size of a clist block, must be power of 2 */ 10424930Skarels #define CBLOCK 64 105*35813Smarc #define CBQSIZE (CBLOCK/NBBY) /* quote bytes/cblock - can do better */ 106*35813Smarc #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) /* data chars/clist */ 10724930Skarels #define CROUND (CBLOCK - 1) /* clist rounding */ 10863Sbill 10963Sbill /* 1106564Smckusic * File system parameters and macros. 1116564Smckusic * 1126564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1136564Smckusic * with smaller units (fragments) only in the last direct block. 1146564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1156564Smckusic * pool. It may be made larger without any effect on existing 1166564Smckusic * file systems; however making it smaller make make some file 1176564Smckusic * systems unmountable. 1186564Smckusic * 1196564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1206564Smckusic * "sectors" and that fragments must be some multiple of this size. 1217147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1227147Smckusick * be a power of two and in the range of 1237147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1247147Smckusick * This size has no effect upon the file system, but is usually set 1257147Smckusick * to the block size of the root file system, so as to maximize the 1267147Smckusick * speed of ``fsck''. 1273069Swnj */ 1286564Smckusic #define MAXBSIZE 8192 1296564Smckusic #define MAXFRAG 8 1306564Smckusic 1316564Smckusic /* 1326564Smckusic * MAXPATHLEN defines the longest permissable path length 1336564Smckusic * after expanding symbolic links. It is used to allocate 1346564Smckusic * a temporary buffer from the buffer pool in which to do the 1356564Smckusic * name expansion, hence should be a power of two, and must 1366564Smckusic * be less than or equal to MAXBSIZE. 1376564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1386564Smckusic * that may be expanded in a path name. It should be set high 1396564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1406564Smckusic * reasonably quickly. 1416564Smckusic */ 1426564Smckusic #define MAXPATHLEN 1024 1436564Smckusic #define MAXSYMLINKS 8 1446564Smckusic 1456564Smckusic /* 14631414Smckusick * Constants for setting the parameters of the kernel memory allocator. 14731414Smckusick * 14831414Smckusick * 2 ** MINBUCKET is the smallest unit of memory that will be 14931414Smckusick * allocated. It must be at least large enough to hold a pointer. 15031414Smckusick * 15131414Smckusick * Units of memory less or equal to MAXALLOCSAVE will permanently 15231414Smckusick * allocate physical memory; requests for these size pieces of 15331414Smckusick * memory are quite fast. Allocations greater than MAXALLOCSAVE must 15431414Smckusick * always allocate and free physical memory; requests for these 15531414Smckusick * size allocations should be done infrequently as they will be slow. 15631414Smckusick * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14) 15731414Smckusick * and MAXALLOCSIZE must be a power of two. 15831414Smckusick */ 15931414Smckusick #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ 16031414Smckusick #define MAXALLOCSAVE (2 * CLBYTES) 16131414Smckusick 16231414Smckusick /* 1636564Smckusic * bit map related macros 1646564Smckusic */ 1656564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1666564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1676564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1686564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1696564Smckusic 1706564Smckusic /* 1716564Smckusic * Macros for fast min/max. 1726564Smckusic */ 1736564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1746564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1756564Smckusic 1766564Smckusic /* 1776564Smckusic * Macros for counting and rounding. 1786564Smckusic */ 17923756Skarels #ifndef howmany 1806564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 18123756Skarels #endif 1826564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 18331414Smckusick #define powerof2(x) ((((x)-1)&(x))==0) 184