165a1cfb1Smckusick /* 2d1a9b8adSmckusick * Copyright (c) 1982, 1986 Regents of the University of California. 365a1cfb1Smckusick * All rights reserved. The Berkeley software License Agreement 465a1cfb1Smckusick * specifies the terms and conditions for redistribution. 565a1cfb1Smckusick * 6*f520e942Skarels * @(#)param.h 7.3 (Berkeley) 01/16/87 765a1cfb1Smckusick */ 85db792e4Sbill 91a9e6e3cSkarels #define BSD 43 /* 4.3 * 10, as cpp doesn't do floats */ 101a9e6e3cSkarels #define BSD4_3 1 112867d692Sbloom 125db792e4Sbill /* 13b481cdefSroot * Machine-independent constants 14b481cdefSroot */ 1574c6c69bSkarels #define NMOUNT 20 /* number of mountable file systems */ 16f0028148Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 17818d21a2Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 181a9e6e3cSkarels #define MAXUPRC 40 /* max processes per user */ 19e3c8cc35Skarels #define NOFILE 64 /* max open files per process */ 205db792e4Sbill #define CANBSIZ 256 /* max size of typewriter line */ 2174c6c69bSkarels #define NCARGS 20480 /* # characters in exec arglist */ 220b98f570Skarels #define NGROUPS 16 /* max number groups */ 23*f520e942Skarels #define MAXHOSTNAMELEN 64 /* maximum hostname size */ 2445ac661dSwnj 25ebd4ffb8Skarels #define NOGROUP 65535 /* marker for empty group set member */ 26e74c57f3Ssam 275db792e4Sbill /* 28b481cdefSroot * Priorities 295db792e4Sbill */ 305db792e4Sbill #define PSWP 0 315db792e4Sbill #define PINOD 10 325db792e4Sbill #define PRIBIO 20 335db792e4Sbill #define PRIUBA 24 345db792e4Sbill #define PZERO 25 355db792e4Sbill #define PPIPE 26 365db792e4Sbill #define PWAIT 30 37bea46c20Ssam #define PLOCK 35 385db792e4Sbill #define PSLEP 40 395db792e4Sbill #define PUSER 50 405db792e4Sbill 4174c6c69bSkarels #define NZERO 0 425db792e4Sbill 43*f520e942Skarels #ifndef KERNEL 44*f520e942Skarels #include <sys/types.h> 45*f520e942Skarels #else 46*f520e942Skarels #ifndef LOCORE 47*f520e942Skarels #include "types.h" 48*f520e942Skarels #endif 49*f520e942Skarels #endif 50*f520e942Skarels 515db792e4Sbill /* 52b481cdefSroot * Signals 535db792e4Sbill */ 54586761c3Ssam #ifdef KERNEL 5564691dc4Sbloom #include "signal.h" 56586761c3Ssam #else 5746cc71adSbill #include <signal.h> 5846cc71adSbill #endif 59c6983186Sbill 60586761c3Ssam #define ISSIG(p) \ 61586761c3Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 62eb2beebeSroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 6303c2128fSroot 64*f520e942Skarels /* 65*f520e942Skarels * Machine type dependent parameters. 66*f520e942Skarels */ 67*f520e942Skarels #ifdef KERNEL 68*f520e942Skarels #include "../machine/machparam.h" 69*f520e942Skarels #else 70*f520e942Skarels #include <machine/machparam.h> 71*f520e942Skarels #endif 72*f520e942Skarels 735db792e4Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 745db792e4Sbill 755db792e4Sbill #define NULL 0 76f0028148Skarels #define CMASK 022 /* default mask for file creation */ 775db792e4Sbill #define NODEV (dev_t)(-1) 785db792e4Sbill 795db792e4Sbill /* 805db792e4Sbill * Clustering of hardware pages on machines with ridiculously small 815db792e4Sbill * page sizes is done here. The paging subsystem deals with units of 82*f520e942Skarels * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 835db792e4Sbill * 845db792e4Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 855db792e4Sbill */ 86248881f8Swnj #define CLBYTES (CLSIZE*NBPG) 87e163c03cSwnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 88248881f8Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 89248881f8Swnj #define CLOFF CLOFSET 90b481cdefSroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 915db792e4Sbill 92b481cdefSroot #if CLSIZE==1 93b481cdefSroot #define clbase(i) (i) 94b481cdefSroot #define clrnd(i) (i) 95b481cdefSroot #else 965db792e4Sbill /* give the base virtual address (first of CLSIZE) */ 975db792e4Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 985db792e4Sbill /* round a number of clicks up to a whole cluster */ 995db792e4Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 100b481cdefSroot #endif 1015db792e4Sbill 1024bda8b2fSkarels /* CBLOCK is the size of a clist block, must be power of 2 */ 1034bda8b2fSkarels #define CBLOCK 64 1044bda8b2fSkarels #define CBSIZE (CBLOCK - sizeof(struct cblock *)) /* data chars/clist */ 1054bda8b2fSkarels #define CROUND (CBLOCK - 1) /* clist rounding */ 1065db792e4Sbill 1075db792e4Sbill /* 108389af1dfSmckusic * File system parameters and macros. 109389af1dfSmckusic * 110389af1dfSmckusic * The file system is made out of blocks of at most MAXBSIZE units, 111389af1dfSmckusic * with smaller units (fragments) only in the last direct block. 112389af1dfSmckusic * MAXBSIZE primarily determines the size of buffers in the buffer 113389af1dfSmckusic * pool. It may be made larger without any effect on existing 114389af1dfSmckusic * file systems; however making it smaller make make some file 115389af1dfSmckusic * systems unmountable. 116389af1dfSmckusic * 117389af1dfSmckusic * Note that the blocked devices are assumed to have DEV_BSIZE 118389af1dfSmckusic * "sectors" and that fragments must be some multiple of this size. 11991d57239Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 12091d57239Smckusick * be a power of two and in the range of 12191d57239Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 12291d57239Smckusick * This size has no effect upon the file system, but is usually set 12391d57239Smckusick * to the block size of the root file system, so as to maximize the 12491d57239Smckusick * speed of ``fsck''. 125389af1dfSmckusic */ 126389af1dfSmckusic #define MAXBSIZE 8192 127389af1dfSmckusic #define MAXFRAG 8 128389af1dfSmckusic 129edc472f6Skre /* 130389af1dfSmckusic * MAXPATHLEN defines the longest permissable path length 131389af1dfSmckusic * after expanding symbolic links. It is used to allocate 132389af1dfSmckusic * a temporary buffer from the buffer pool in which to do the 133389af1dfSmckusic * name expansion, hence should be a power of two, and must 134389af1dfSmckusic * be less than or equal to MAXBSIZE. 135389af1dfSmckusic * MAXSYMLINKS defines the maximum number of symbolic links 136389af1dfSmckusic * that may be expanded in a path name. It should be set high 137389af1dfSmckusic * enough to allow all legitimate uses, but halt infinite loops 138389af1dfSmckusic * reasonably quickly. 139389af1dfSmckusic */ 140389af1dfSmckusic #define MAXPATHLEN 1024 141389af1dfSmckusic #define MAXSYMLINKS 8 142389af1dfSmckusic 143389af1dfSmckusic /* 144389af1dfSmckusic * bit map related macros 145389af1dfSmckusic */ 146389af1dfSmckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 147389af1dfSmckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 148389af1dfSmckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 149389af1dfSmckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 150389af1dfSmckusic 151389af1dfSmckusic /* 152389af1dfSmckusic * Macros for fast min/max. 153389af1dfSmckusic */ 154389af1dfSmckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 155389af1dfSmckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 156389af1dfSmckusic 157389af1dfSmckusic /* 158389af1dfSmckusic * Macros for counting and rounding. 159389af1dfSmckusic */ 16083a906b7Skarels #ifndef howmany 161389af1dfSmckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 16283a906b7Skarels #endif 163389af1dfSmckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 164