1*65a1cfb1Smckusick /* 2*65a1cfb1Smckusick * Copyright (c) 1982 Regents of the University of California. 3*65a1cfb1Smckusick * All rights reserved. The Berkeley software License Agreement 4*65a1cfb1Smckusick * specifies the terms and conditions for redistribution. 5*65a1cfb1Smckusick * 6*65a1cfb1Smckusick * @(#)param.h 6.10 (Berkeley) 06/08/85 7*65a1cfb1Smckusick */ 85db792e4Sbill 95db792e4Sbill /* 104951e502Ssam * Machine type dependent parameters. 115db792e4Sbill */ 128a98aca3Ssam #ifdef KERNEL 13d747881bSkarels #include "../machine/machparam.h" 148a98aca3Ssam #else 15d747881bSkarels #include <machine/machparam.h> 16b481cdefSroot #endif 175db792e4Sbill 18b481cdefSroot #define NPTEPG (NBPG/(sizeof (struct pte))) 19b481cdefSroot 20b481cdefSroot /* 21b481cdefSroot * Machine-independent constants 22b481cdefSroot */ 2374c6c69bSkarels #define NMOUNT 20 /* number of mountable file systems */ 24f0028148Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 25818d21a2Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 265db792e4Sbill #define MAXUPRC 25 /* max processes per user */ 27e3c8cc35Skarels #define NOFILE 64 /* max open files per process */ 285db792e4Sbill #define CANBSIZ 256 /* max size of typewriter line */ 2974c6c69bSkarels #define NCARGS 20480 /* # characters in exec arglist */ 300b98f570Skarels #define NGROUPS 16 /* max number groups */ 3145ac661dSwnj 32e74c57f3Ssam #define NOGROUP -1 /* marker for empty group set member */ 33e74c57f3Ssam 345db792e4Sbill /* 35b481cdefSroot * Priorities 365db792e4Sbill */ 375db792e4Sbill #define PSWP 0 385db792e4Sbill #define PINOD 10 395db792e4Sbill #define PRIBIO 20 405db792e4Sbill #define PRIUBA 24 415db792e4Sbill #define PZERO 25 425db792e4Sbill #define PPIPE 26 435db792e4Sbill #define PWAIT 30 44bea46c20Ssam #define PLOCK 35 455db792e4Sbill #define PSLEP 40 465db792e4Sbill #define PUSER 50 475db792e4Sbill 4874c6c69bSkarels #define NZERO 0 495db792e4Sbill 505db792e4Sbill /* 51b481cdefSroot * Signals 525db792e4Sbill */ 53586761c3Ssam #ifdef KERNEL 5464691dc4Sbloom #include "signal.h" 55586761c3Ssam #else 5646cc71adSbill #include <signal.h> 5746cc71adSbill #endif 58c6983186Sbill 59586761c3Ssam #define ISSIG(p) \ 60586761c3Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 61eb2beebeSroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 6203c2128fSroot 63c6983186Sbill /* 64b481cdefSroot * Fundamental constants of the implementation. 65c6983186Sbill */ 66e163c03cSwnj #define NBBY 8 /* number of bits in a byte */ 675db792e4Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 685db792e4Sbill 695db792e4Sbill #define NULL 0 70f0028148Skarels #define CMASK 022 /* default mask for file creation */ 715db792e4Sbill #define NODEV (dev_t)(-1) 725db792e4Sbill 735db792e4Sbill /* 745db792e4Sbill * Clustering of hardware pages on machines with ridiculously small 755db792e4Sbill * page sizes is done here. The paging subsystem deals with units of 76f0028148Skarels * CLSIZE pte's describing NBPG (from vm.h) pages each. 775db792e4Sbill * 785db792e4Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 795db792e4Sbill */ 80248881f8Swnj #define CLBYTES (CLSIZE*NBPG) 81e163c03cSwnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 82248881f8Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 83248881f8Swnj #define CLOFF CLOFSET 84b481cdefSroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 855db792e4Sbill 86b481cdefSroot #if CLSIZE==1 87b481cdefSroot #define clbase(i) (i) 88b481cdefSroot #define clrnd(i) (i) 89b481cdefSroot #else 905db792e4Sbill /* give the base virtual address (first of CLSIZE) */ 915db792e4Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 925db792e4Sbill /* round a number of clicks up to a whole cluster */ 935db792e4Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 94b481cdefSroot #endif 955db792e4Sbill 965db792e4Sbill #ifndef INTRLVE 975db792e4Sbill /* macros replacing interleaving functions */ 985db792e4Sbill #define dkblock(bp) ((bp)->b_blkno) 995db792e4Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 1005db792e4Sbill #endif 1015db792e4Sbill 1025db792e4Sbill #define CBSIZE 28 /* number of chars in a clist block */ 1035db792e4Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 1045db792e4Sbill 105e0ff83f9Swnj #ifndef KERNEL 106e0ff83f9Swnj #include <sys/types.h> 107e0ff83f9Swnj #else 10872d10768Ssam #ifndef LOCORE 10964691dc4Sbloom #include "types.h" 110e0ff83f9Swnj #endif 11172d10768Ssam #endif 11276379a38Sbill 1135db792e4Sbill /* 114389af1dfSmckusic * File system parameters and macros. 115389af1dfSmckusic * 116389af1dfSmckusic * The file system is made out of blocks of at most MAXBSIZE units, 117389af1dfSmckusic * with smaller units (fragments) only in the last direct block. 118389af1dfSmckusic * MAXBSIZE primarily determines the size of buffers in the buffer 119389af1dfSmckusic * pool. It may be made larger without any effect on existing 120389af1dfSmckusic * file systems; however making it smaller make make some file 121389af1dfSmckusic * systems unmountable. 122389af1dfSmckusic * 123389af1dfSmckusic * Note that the blocked devices are assumed to have DEV_BSIZE 124389af1dfSmckusic * "sectors" and that fragments must be some multiple of this size. 12591d57239Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 12691d57239Smckusick * be a power of two and in the range of 12791d57239Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 12891d57239Smckusick * This size has no effect upon the file system, but is usually set 12991d57239Smckusick * to the block size of the root file system, so as to maximize the 13091d57239Smckusick * speed of ``fsck''. 131389af1dfSmckusic */ 132389af1dfSmckusic #define MAXBSIZE 8192 133389af1dfSmckusic #define DEV_BSIZE 512 134c6047a37Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 1351641975aSsam #define BLKDEV_IOSIZE 2048 136389af1dfSmckusic #define MAXFRAG 8 137389af1dfSmckusic 138c6047a37Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 139c6047a37Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 140c6047a37Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 141c6047a37Ssam ((unsigned)(db) << DEV_BSHIFT) 142c6047a37Ssam 143389af1dfSmckusic /* 144edc472f6Skre * Map a ``block device block'' to a file system block. 145edc472f6Skre * This should be device dependent, and will be after we 146edc472f6Skre * add an entry to cdevsw for that purpose. For now though 147edc472f6Skre * just use DEV_BSIZE. 148edc472f6Skre */ 149b481cdefSroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 150edc472f6Skre 151edc472f6Skre /* 152389af1dfSmckusic * MAXPATHLEN defines the longest permissable path length 153389af1dfSmckusic * after expanding symbolic links. It is used to allocate 154389af1dfSmckusic * a temporary buffer from the buffer pool in which to do the 155389af1dfSmckusic * name expansion, hence should be a power of two, and must 156389af1dfSmckusic * be less than or equal to MAXBSIZE. 157389af1dfSmckusic * MAXSYMLINKS defines the maximum number of symbolic links 158389af1dfSmckusic * that may be expanded in a path name. It should be set high 159389af1dfSmckusic * enough to allow all legitimate uses, but halt infinite loops 160389af1dfSmckusic * reasonably quickly. 161389af1dfSmckusic */ 162389af1dfSmckusic #define MAXPATHLEN 1024 163389af1dfSmckusic #define MAXSYMLINKS 8 164389af1dfSmckusic 165389af1dfSmckusic /* 166389af1dfSmckusic * bit map related macros 167389af1dfSmckusic */ 168389af1dfSmckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 169389af1dfSmckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 170389af1dfSmckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 171389af1dfSmckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 172389af1dfSmckusic 173389af1dfSmckusic /* 174389af1dfSmckusic * Macros for fast min/max. 175389af1dfSmckusic */ 176389af1dfSmckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 177389af1dfSmckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 178389af1dfSmckusic 179389af1dfSmckusic /* 180389af1dfSmckusic * Macros for counting and rounding. 181389af1dfSmckusic */ 182389af1dfSmckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 183389af1dfSmckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 184c446e4efSbloom 185c446e4efSbloom /* 186c446e4efSbloom * Maximum size of hostname recognized and stroed in the kernel. 187c446e4efSbloom */ 188c446e4efSbloom #define MAXHOSTNAMELEN 32 189