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*2fe64d92Smckusick * @(#)param.h 7.5 (Berkeley) 06/05/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 */ 22aeeef3fcSbostic #define MAXINTERP 32 /* maximum interpreter file name length */ 230b98f570Skarels #define NGROUPS 16 /* max number groups */ 24f520e942Skarels #define MAXHOSTNAMELEN 64 /* maximum hostname size */ 2545ac661dSwnj 26ebd4ffb8Skarels #define NOGROUP 65535 /* marker for empty group set member */ 27e74c57f3Ssam 285db792e4Sbill /* 29b481cdefSroot * Priorities 305db792e4Sbill */ 315db792e4Sbill #define PSWP 0 325db792e4Sbill #define PINOD 10 335db792e4Sbill #define PRIBIO 20 345db792e4Sbill #define PRIUBA 24 355db792e4Sbill #define PZERO 25 365db792e4Sbill #define PPIPE 26 375db792e4Sbill #define PWAIT 30 38bea46c20Ssam #define PLOCK 35 395db792e4Sbill #define PSLEP 40 405db792e4Sbill #define PUSER 50 415db792e4Sbill 4274c6c69bSkarels #define NZERO 0 435db792e4Sbill 44f520e942Skarels #ifndef KERNEL 45f520e942Skarels #include <sys/types.h> 46f520e942Skarels #else 47f520e942Skarels #ifndef LOCORE 48f520e942Skarels #include "types.h" 49f520e942Skarels #endif 50f520e942Skarels #endif 51f520e942Skarels 525db792e4Sbill /* 53b481cdefSroot * Signals 545db792e4Sbill */ 55586761c3Ssam #ifdef KERNEL 5664691dc4Sbloom #include "signal.h" 57586761c3Ssam #else 5846cc71adSbill #include <signal.h> 5946cc71adSbill #endif 60c6983186Sbill 61586761c3Ssam #define ISSIG(p) \ 62586761c3Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 63eb2beebeSroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 6403c2128fSroot 65f520e942Skarels /* 66f520e942Skarels * Machine type dependent parameters. 67f520e942Skarels */ 68f520e942Skarels #ifdef KERNEL 69f520e942Skarels #include "../machine/machparam.h" 70f520e942Skarels #else 71f520e942Skarels #include <machine/machparam.h> 72f520e942Skarels #endif 73f520e942Skarels 745db792e4Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 755db792e4Sbill 765db792e4Sbill #define NULL 0 77f0028148Skarels #define CMASK 022 /* default mask for file creation */ 785db792e4Sbill #define NODEV (dev_t)(-1) 795db792e4Sbill 805db792e4Sbill /* 815db792e4Sbill * Clustering of hardware pages on machines with ridiculously small 825db792e4Sbill * page sizes is done here. The paging subsystem deals with units of 83f520e942Skarels * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. 845db792e4Sbill * 855db792e4Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 865db792e4Sbill */ 87248881f8Swnj #define CLBYTES (CLSIZE*NBPG) 88e163c03cSwnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 89248881f8Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 90248881f8Swnj #define CLOFF CLOFSET 91b481cdefSroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 925db792e4Sbill 93b481cdefSroot #if CLSIZE==1 94b481cdefSroot #define clbase(i) (i) 95b481cdefSroot #define clrnd(i) (i) 96b481cdefSroot #else 975db792e4Sbill /* give the base virtual address (first of CLSIZE) */ 985db792e4Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 995db792e4Sbill /* round a number of clicks up to a whole cluster */ 1005db792e4Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 101b481cdefSroot #endif 1025db792e4Sbill 1034bda8b2fSkarels /* CBLOCK is the size of a clist block, must be power of 2 */ 1044bda8b2fSkarels #define CBLOCK 64 1054bda8b2fSkarels #define CBSIZE (CBLOCK - sizeof(struct cblock *)) /* data chars/clist */ 1064bda8b2fSkarels #define CROUND (CBLOCK - 1) /* clist rounding */ 1075db792e4Sbill 1085db792e4Sbill /* 109389af1dfSmckusic * File system parameters and macros. 110389af1dfSmckusic * 111389af1dfSmckusic * The file system is made out of blocks of at most MAXBSIZE units, 112389af1dfSmckusic * with smaller units (fragments) only in the last direct block. 113389af1dfSmckusic * MAXBSIZE primarily determines the size of buffers in the buffer 114389af1dfSmckusic * pool. It may be made larger without any effect on existing 115389af1dfSmckusic * file systems; however making it smaller make make some file 116389af1dfSmckusic * systems unmountable. 117389af1dfSmckusic * 118389af1dfSmckusic * Note that the blocked devices are assumed to have DEV_BSIZE 119389af1dfSmckusic * "sectors" and that fragments must be some multiple of this size. 12091d57239Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 12191d57239Smckusick * be a power of two and in the range of 12291d57239Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 12391d57239Smckusick * This size has no effect upon the file system, but is usually set 12491d57239Smckusick * to the block size of the root file system, so as to maximize the 12591d57239Smckusick * speed of ``fsck''. 126389af1dfSmckusic */ 127389af1dfSmckusic #define MAXBSIZE 8192 128389af1dfSmckusic #define MAXFRAG 8 129389af1dfSmckusic 130edc472f6Skre /* 131389af1dfSmckusic * MAXPATHLEN defines the longest permissable path length 132389af1dfSmckusic * after expanding symbolic links. It is used to allocate 133389af1dfSmckusic * a temporary buffer from the buffer pool in which to do the 134389af1dfSmckusic * name expansion, hence should be a power of two, and must 135389af1dfSmckusic * be less than or equal to MAXBSIZE. 136389af1dfSmckusic * MAXSYMLINKS defines the maximum number of symbolic links 137389af1dfSmckusic * that may be expanded in a path name. It should be set high 138389af1dfSmckusic * enough to allow all legitimate uses, but halt infinite loops 139389af1dfSmckusic * reasonably quickly. 140389af1dfSmckusic */ 141389af1dfSmckusic #define MAXPATHLEN 1024 142389af1dfSmckusic #define MAXSYMLINKS 8 143389af1dfSmckusic 144389af1dfSmckusic /* 145*2fe64d92Smckusick * Constants for setting the parameters of the kernel memory allocator. 146*2fe64d92Smckusick * 147*2fe64d92Smckusick * 2 ** MINBUCKET is the smallest unit of memory that will be 148*2fe64d92Smckusick * allocated. It must be at least large enough to hold a pointer. 149*2fe64d92Smckusick * 150*2fe64d92Smckusick * Units of memory less or equal to MAXALLOCSAVE will permanently 151*2fe64d92Smckusick * allocate physical memory; requests for these size pieces of 152*2fe64d92Smckusick * memory are quite fast. Allocations greater than MAXALLOCSAVE must 153*2fe64d92Smckusick * always allocate and free physical memory; requests for these 154*2fe64d92Smckusick * size allocations should be done infrequently as they will be slow. 155*2fe64d92Smckusick * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14) 156*2fe64d92Smckusick * and MAXALLOCSIZE must be a power of two. 157*2fe64d92Smckusick */ 158*2fe64d92Smckusick #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ 159*2fe64d92Smckusick #define MAXALLOCSAVE (2 * CLBYTES) 160*2fe64d92Smckusick 161*2fe64d92Smckusick /* 162389af1dfSmckusic * bit map related macros 163389af1dfSmckusic */ 164389af1dfSmckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 165389af1dfSmckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 166389af1dfSmckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 167389af1dfSmckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 168389af1dfSmckusic 169389af1dfSmckusic /* 170389af1dfSmckusic * Macros for fast min/max. 171389af1dfSmckusic */ 172389af1dfSmckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 173389af1dfSmckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 174389af1dfSmckusic 175389af1dfSmckusic /* 176389af1dfSmckusic * Macros for counting and rounding. 177389af1dfSmckusic */ 17883a906b7Skarels #ifndef howmany 179389af1dfSmckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 18083a906b7Skarels #endif 181389af1dfSmckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 182*2fe64d92Smckusick #define powerof2(x) ((((x)-1)&(x))==0) 183