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*36805Sbostic * @(#)param.h 7.7 (Berkeley) 02/16/89 723430Smckusick */ 863Sbill 935813Smarc #define BSD 198810 /* system version (year & month) */ 1025297Skarels #define BSD4_3 1 1124654Sbloom 12*36805Sbostic #include <sys/syslimits.h> 13*36805Sbostic 1463Sbill /* 158993Sroot * Machine-independent constants 168993Sroot */ 1717556Skarels #define NMOUNT 20 /* 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 */ 20*36805Sbostic #define MAXUPRC CHILD_MAX /* max processes per user */ 21*36805Sbostic #define NOFILE OPEN_MAX /* max open files per process */ 2263Sbill #define CANBSIZ 256 /* max size of typewriter line */ 23*36805Sbostic #define NCARGS ARG_MAX /* # characters in exec arglist */ 2430576Sbostic #define MAXINTERP 32 /* maximum interpreter file name length */ 25*36805Sbostic #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 3663Sbill #define PRIUBA 24 3763Sbill #define PZERO 25 3863Sbill #define PPIPE 26 3963Sbill #define PWAIT 30 407688Ssam #define PLOCK 35 4163Sbill #define PSLEP 40 4263Sbill #define PUSER 50 4363Sbill 4417556Skarels #define NZERO 0 4563Sbill 4630406Skarels #ifndef KERNEL 4730406Skarels #include <sys/types.h> 4830406Skarels #else 4930406Skarels #ifndef LOCORE 5030406Skarels #include "types.h" 5130406Skarels #endif 5230406Skarels #endif 5330406Skarels 5463Sbill /* 558993Sroot * Signals 5663Sbill */ 5712880Ssam #ifdef KERNEL 5817033Sbloom #include "signal.h" 5912880Ssam #else 60176Sbill #include <signal.h> 61176Sbill #endif 6263Sbill 6312880Ssam #define ISSIG(p) \ 6412880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 6512965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 668467Sroot 6730406Skarels /* 6830406Skarels * Machine type dependent parameters. 6930406Skarels */ 7030406Skarels #ifdef KERNEL 7130406Skarels #include "../machine/machparam.h" 7230406Skarels #else 7330406Skarels #include <machine/machparam.h> 7430406Skarels #endif 7530406Skarels 7612880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 7763Sbill 7863Sbill #define NULL 0 7916796Skarels #define CMASK 022 /* default mask for file creation */ 8063Sbill #define NODEV (dev_t)(-1) 8163Sbill 8263Sbill /* 8363Sbill * Clustering of hardware pages on machines with ridiculously small 8463Sbill * page sizes is done here. The paging subsystem deals with units of 8530406Skarels * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 8663Sbill * 8763Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8863Sbill */ 895080Swnj #define CLBYTES (CLSIZE*NBPG) 902637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 915080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 925080Swnj #define CLOFF CLOFSET 938993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 9463Sbill 958993Sroot #if CLSIZE==1 968993Sroot #define clbase(i) (i) 978993Sroot #define clrnd(i) (i) 988993Sroot #else 9963Sbill /* give the base virtual address (first of CLSIZE) */ 10063Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 10163Sbill /* round a number of clicks up to a whole cluster */ 10263Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 1038993Sroot #endif 10463Sbill 10524930Skarels /* CBLOCK is the size of a clist block, must be power of 2 */ 10624930Skarels #define CBLOCK 64 10735813Smarc #define CBQSIZE (CBLOCK/NBBY) /* quote bytes/cblock - can do better */ 10835813Smarc #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) /* data chars/clist */ 10924930Skarels #define CROUND (CBLOCK - 1) /* clist rounding */ 11063Sbill 11163Sbill /* 1126564Smckusic * File system parameters and macros. 1136564Smckusic * 1146564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1156564Smckusic * with smaller units (fragments) only in the last direct block. 1166564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1176564Smckusic * pool. It may be made larger without any effect on existing 1186564Smckusic * file systems; however making it smaller make make some file 1196564Smckusic * systems unmountable. 1206564Smckusic * 1216564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1226564Smckusic * "sectors" and that fragments must be some multiple of this size. 1237147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1247147Smckusick * be a power of two and in the range of 1257147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1267147Smckusick * This size has no effect upon the file system, but is usually set 1277147Smckusick * to the block size of the root file system, so as to maximize the 1287147Smckusick * speed of ``fsck''. 1293069Swnj */ 1306564Smckusic #define MAXBSIZE 8192 1316564Smckusic #define MAXFRAG 8 1326564Smckusic 1336564Smckusic /* 1346564Smckusic * MAXPATHLEN defines the longest permissable path length 1356564Smckusic * after expanding symbolic links. It is used to allocate 1366564Smckusic * a temporary buffer from the buffer pool in which to do the 1376564Smckusic * name expansion, hence should be a power of two, and must 1386564Smckusic * be less than or equal to MAXBSIZE. 1396564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1406564Smckusic * that may be expanded in a path name. It should be set high 1416564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1426564Smckusic * reasonably quickly. 1436564Smckusic */ 144*36805Sbostic #define MAXPATHLEN PATH_MAX 1456564Smckusic #define MAXSYMLINKS 8 1466564Smckusic 1476564Smckusic /* 14831414Smckusick * Constants for setting the parameters of the kernel memory allocator. 14931414Smckusick * 15031414Smckusick * 2 ** MINBUCKET is the smallest unit of memory that will be 15131414Smckusick * allocated. It must be at least large enough to hold a pointer. 15231414Smckusick * 15331414Smckusick * Units of memory less or equal to MAXALLOCSAVE will permanently 15431414Smckusick * allocate physical memory; requests for these size pieces of 15531414Smckusick * memory are quite fast. Allocations greater than MAXALLOCSAVE must 15631414Smckusick * always allocate and free physical memory; requests for these 15731414Smckusick * size allocations should be done infrequently as they will be slow. 15831414Smckusick * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14) 15931414Smckusick * and MAXALLOCSIZE must be a power of two. 16031414Smckusick */ 16131414Smckusick #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ 16231414Smckusick #define MAXALLOCSAVE (2 * CLBYTES) 16331414Smckusick 16431414Smckusick /* 1656564Smckusic * bit map related macros 1666564Smckusic */ 1676564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1686564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1696564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1706564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1716564Smckusic 1726564Smckusic /* 1736564Smckusic * Macros for fast min/max. 1746564Smckusic */ 1756564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1766564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1776564Smckusic 1786564Smckusic /* 1796564Smckusic * Macros for counting and rounding. 1806564Smckusic */ 18123756Skarels #ifndef howmany 1826564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 18323756Skarels #endif 1846564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 18531414Smckusick #define powerof2(x) ((((x)-1)&(x))==0) 186