1*2751Swnj /* param.h 4.8 81/02/27 */ 263Sbill 363Sbill /* 4*2751Swnj * Tunable variables which do not usually vary per system. 563Sbill * 6*2751Swnj * The sizes of most system tables are configured 7*2751Swnj * into each system description. The file system buffer 8*2751Swnj * cache size is assigned based on available memory. 9*2751Swnj * The tables whose sizes don't vary often are given here. 1063Sbill */ 1163Sbill 12356Sbill #define NMOUNT 15 /* number of mountable file systems */ 13356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 1463Sbill #define MAXUPRC 25 /* max processes per user */ 1563Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 1663Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 1763Sbill #define NOFILE 20 /* max open files per process */ 18*2751Swnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 1963Sbill #define CANBSIZ 256 /* max size of typewriter line */ 20874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 21*2751Swnj 2263Sbill /* 2363Sbill * priorities 2463Sbill * probably should not be 2563Sbill * altered too much 2663Sbill */ 2763Sbill 2863Sbill #define PSWP 0 2963Sbill #define PINOD 10 3063Sbill #define PRIBIO 20 3163Sbill #define PRIUBA 24 3263Sbill #define PZERO 25 3363Sbill #define PPIPE 26 3463Sbill #define PWAIT 30 3563Sbill #define PSLEP 40 3663Sbill #define PUSER 50 3763Sbill 3863Sbill #define NZERO 20 3963Sbill 4063Sbill /* 4163Sbill * signals 4263Sbill * dont change 4363Sbill */ 4463Sbill 45176Sbill #ifndef NSIG 46176Sbill #include <signal.h> 47176Sbill #endif 4863Sbill 4963Sbill /* 5097Sbill * Return values from tsleep(). 5197Sbill */ 5297Sbill #define TS_OK 0 /* normal wakeup */ 5397Sbill #define TS_TIME 1 /* timed-out wakeup */ 5497Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 5597Sbill 5697Sbill /* 5763Sbill * fundamental constants of the implementation-- 5863Sbill * cannot be changed easily. 5963Sbill */ 6063Sbill 612637Swnj #define NBBY 8 /* number of bits in a byte */ 622637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 632637Swnj #define NBPG 512 642637Swnj #define PGOFSET (NBPG-1) /* byte offset into page */ 652637Swnj #define PGSHIFT 9 /* LOG2(NBPG) */ 6663Sbill 672637Swnj #define UPAGES 8 /* pages of u-area */ 6863Sbill #define NULL 0 6963Sbill #define CMASK 0 /* default mask for file creation */ 7063Sbill #define NODEV (dev_t)(-1) 7163Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 7263Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 7363Sbill #define DIRSIZ 14 /* max characters per directory */ 7463Sbill 7563Sbill /* 7663Sbill * Clustering of hardware pages on machines with ridiculously small 7763Sbill * page sizes is done here. The paging subsystem deals with units of 7863Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 7963Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 8063Sbill * deals with the same size blocks that the file system uses. 8163Sbill * 8263Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8363Sbill */ 8463Sbill #define CLSIZE 2 852637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 8663Sbill 8763Sbill /* give the base virtual address (first of CLSIZE) */ 8863Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8963Sbill 9063Sbill /* round a number of clicks up to a whole cluster */ 9163Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 9263Sbill 9363Sbill #if CLSIZE==1 9463Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 9563Sbill #define INOPB 8 /* 8 inodes per block */ 9663Sbill #define BMASK 0777 /* BSIZE-1 */ 9763Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 9863Sbill #define NMASK 0177 /* NINDIR-1 */ 9963Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 10063Sbill #define NICINOD 100 /* number of superblock inodes */ 10163Sbill #define NICFREE 50 /* number of superblock free blocks */ 10263Sbill 10363Sbill #endif 10463Sbill 10563Sbill #if CLSIZE==2 10663Sbill #define BSIZE 1024 10763Sbill #define INOPB 16 10863Sbill #define BMASK 01777 10963Sbill #define BSHIFT 10 11063Sbill #define NMASK 0377 11163Sbill #define NSHIFT 8 11263Sbill #define NICINOD 100 11363Sbill #define NICFREE 178 11463Sbill #endif 11563Sbill 11663Sbill #if CLSIZE==4 11763Sbill #define BSIZE 2048 11863Sbill #define INOPB 32 11963Sbill #define BMASK 03777 12063Sbill #define BSHIFT 11 12163Sbill #define NMASK 0777 12263Sbill #define NSHIFT 9 12363Sbill #define NICINOD 100 12463Sbill #define NICFREE 434 12563Sbill #endif 12663Sbill 12763Sbill #ifndef INTRLVE 12863Sbill /* macros replacing interleaving functions */ 12963Sbill #define dkblock(bp) ((bp)->b_blkno) 13063Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 13163Sbill #endif 13263Sbill 13363Sbill /* inumber to disk address and inumber to disk offset */ 13463Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 13563Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 13663Sbill 13763Sbill /* file system blocks to disk blocks and back */ 13863Sbill #define fsbtodb(b) ((b)*CLSIZE) 13963Sbill #define dbtofsb(b) ((b)/CLSIZE) 14063Sbill 14163Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 14263Sbill 14363Sbill #define CBSIZE 28 /* number of chars in a clist block */ 14463Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 14563Sbill #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 14663Sbill 14763Sbill /* 14863Sbill * Macros for fast min/max 14963Sbill */ 15063Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 15163Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 15263Sbill 15363Sbill /* 15463Sbill * Some macros for units conversion 15563Sbill */ 15663Sbill /* Core clicks (512 bytes) to segments and vice versa */ 15763Sbill #define ctos(x) (x) 15863Sbill #define stoc(x) (x) 15963Sbill 16063Sbill /* Core clicks (512 bytes) to disk blocks */ 16163Sbill #define ctod(x) (x) 16263Sbill 16363Sbill /* clicks to bytes */ 16463Sbill #define ctob(x) ((x)<<9) 16563Sbill 16663Sbill /* bytes to clicks */ 16763Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 16863Sbill 16963Sbill /* major part of a device */ 17063Sbill #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 17163Sbill 17263Sbill /* minor part of a device */ 17363Sbill #define minor(x) ((int)((x)&0377)) 17463Sbill 17563Sbill /* make a device number */ 17663Sbill #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) 17763Sbill 17863Sbill typedef struct { int r[1]; } * physadr; 17963Sbill typedef int daddr_t; 18063Sbill typedef char * caddr_t; 18163Sbill typedef unsigned short ino_t; 18263Sbill typedef int swblk_t; 18363Sbill typedef int size_t; 18463Sbill typedef int time_t; 18563Sbill typedef int label_t[14]; 18663Sbill typedef short dev_t; 18763Sbill typedef int off_t; 18863Sbill 189582Sbill typedef unsigned char u_char; 190582Sbill typedef unsigned short u_short; 191582Sbill typedef unsigned int u_int; 192582Sbill typedef unsigned long u_long; 193582Sbill 19463Sbill /* 19563Sbill * Machine-dependent bits and macros 19663Sbill */ 19763Sbill #define UMODE PSL_CURMOD /* usermode bits */ 19863Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 19963Sbill 20063Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 201