1*2637Swnj /* param.h 4.7 81/02/23 */ 263Sbill 363Sbill /* 463Sbill * tunable variables 563Sbill * 61558Sbill * NB: NBUF must be less than MAXNBUF in locore.s. 763Sbill */ 863Sbill 91907Swnj #ifdef notdef 101907Swnj #define NBUF 64 /* size of buffer cache */ 111907Swnj #define NINODE 200 /* number of in core inodes */ 121907Swnj #define NFILE 175 /* number of in core file structures */ 131907Swnj #define NMOUNT 7 /* number of mountable file systems */ 141907Swnj #define MSWAPX 7 /* pseudo mount table index for swapdev */ 151907Swnj #define NPROC 125 /* max number of processes */ 161907Swnj #define NTEXT 40 /* max number of pure texts */ 171907Swnj #define NCLIST 250 /* max total clist size */ 181907Swnj #endif 191558Sbill #define NBUF 128 /* size of buffer cache */ 20379Sbill #define NINODE 400 /* number of in core inodes */ 21379Sbill #define NFILE 350 /* number of in core file structures */ 22356Sbill #define NMOUNT 15 /* number of mountable file systems */ 23356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 241907Swnj #define NPROC 250 /* max number of processes */ 251907Swnj #define NTEXT 60 /* max number of pure texts */ 261907Swnj #define NCLIST 500 /* max total clist size */ 2763Sbill #define MAXUPRC 25 /* max processes per user */ 2863Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 2963Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 3063Sbill #define NOFILE 20 /* max open files per process */ 3163Sbill #define CANBSIZ 256 /* max size of typewriter line */ 3263Sbill #define SMAPSIZ (4*NPROC) /* size of swap allocation area */ 3363Sbill #define NCALL 40 /* max simultaneous time callouts */ 3463Sbill #define HZ 60 /* Ticks/second of the clock */ 3563Sbill #define TIMEZONE (8*60) /* Minutes westward from Greenwich */ 3663Sbill #define DSTFLAG 1 /* Daylight Saving Time applies in this locality */ 3763Sbill #define MSGBUFS 128 /* Characters saved from error messages */ 38874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 3963Sbill /* 4063Sbill * priorities 4163Sbill * probably should not be 4263Sbill * altered too much 4363Sbill */ 4463Sbill 4563Sbill #define PSWP 0 4663Sbill #define PINOD 10 4763Sbill #define PRIBIO 20 4863Sbill #define PRIUBA 24 4963Sbill #define PZERO 25 5063Sbill #define PPIPE 26 5163Sbill #define PWAIT 30 5263Sbill #define PSLEP 40 5363Sbill #define PUSER 50 5463Sbill 5563Sbill #define NZERO 20 5663Sbill 5763Sbill /* 5863Sbill * signals 5963Sbill * dont change 6063Sbill */ 6163Sbill 62176Sbill #ifndef NSIG 63176Sbill #include <signal.h> 64176Sbill #endif 6563Sbill 6663Sbill /* 6797Sbill * Return values from tsleep(). 6897Sbill */ 6997Sbill #define TS_OK 0 /* normal wakeup */ 7097Sbill #define TS_TIME 1 /* timed-out wakeup */ 7197Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 7297Sbill 7397Sbill /* 7463Sbill * fundamental constants of the implementation-- 7563Sbill * cannot be changed easily. 7663Sbill * note: UPAGES is well known in locore.s 7763Sbill */ 7863Sbill 79*2637Swnj #define NBBY 8 /* number of bits in a byte */ 80*2637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 81*2637Swnj #define NBPG 512 82*2637Swnj #define PGOFSET (NBPG-1) /* byte offset into page */ 83*2637Swnj #define PGSHIFT 9 /* LOG2(NBPG) */ 8463Sbill 85*2637Swnj #define UPAGES 8 /* pages of u-area */ 8663Sbill #define NULL 0 8763Sbill #define CMASK 0 /* default mask for file creation */ 8863Sbill #define NODEV (dev_t)(-1) 8963Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 9063Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 9163Sbill #define DIRSIZ 14 /* max characters per directory */ 9263Sbill 9363Sbill /* 9463Sbill * Clustering of hardware pages on machines with ridiculously small 9563Sbill * page sizes is done here. The paging subsystem deals with units of 9663Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 9763Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 9863Sbill * deals with the same size blocks that the file system uses. 9963Sbill * 10063Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 10163Sbill * 10263Sbill * NB: CLSIZE is well known in locore.s. 10363Sbill */ 10463Sbill #define CLSIZE 2 105*2637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 10663Sbill 10763Sbill /* give the base virtual address (first of CLSIZE) */ 10863Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 10963Sbill 11063Sbill /* round a number of clicks up to a whole cluster */ 11163Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 11263Sbill 11363Sbill #if CLSIZE==1 11463Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 11563Sbill #define INOPB 8 /* 8 inodes per block */ 11663Sbill #define BMASK 0777 /* BSIZE-1 */ 11763Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 11863Sbill #define NMASK 0177 /* NINDIR-1 */ 11963Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 12063Sbill #define NICINOD 100 /* number of superblock inodes */ 12163Sbill #define NICFREE 50 /* number of superblock free blocks */ 12263Sbill 12363Sbill #endif 12463Sbill 12563Sbill #if CLSIZE==2 12663Sbill #define BSIZE 1024 12763Sbill #define INOPB 16 12863Sbill #define BMASK 01777 12963Sbill #define BSHIFT 10 13063Sbill #define NMASK 0377 13163Sbill #define NSHIFT 8 13263Sbill #define NICINOD 100 13363Sbill #define NICFREE 178 13463Sbill #endif 13563Sbill 13663Sbill #if CLSIZE==4 13763Sbill #define BSIZE 2048 13863Sbill #define INOPB 32 13963Sbill #define BMASK 03777 14063Sbill #define BSHIFT 11 14163Sbill #define NMASK 0777 14263Sbill #define NSHIFT 9 14363Sbill #define NICINOD 100 14463Sbill #define NICFREE 434 14563Sbill #endif 14663Sbill 14763Sbill #ifndef INTRLVE 14863Sbill /* macros replacing interleaving functions */ 14963Sbill #define dkblock(bp) ((bp)->b_blkno) 15063Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 15163Sbill #endif 15263Sbill 15363Sbill /* inumber to disk address and inumber to disk offset */ 15463Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 15563Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 15663Sbill 15763Sbill /* file system blocks to disk blocks and back */ 15863Sbill #define fsbtodb(b) ((b)*CLSIZE) 15963Sbill #define dbtofsb(b) ((b)/CLSIZE) 16063Sbill 16163Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 16263Sbill 16363Sbill #define CBSIZE 28 /* number of chars in a clist block */ 16463Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 16563Sbill #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 16663Sbill 16763Sbill /* 16863Sbill * Macros for fast min/max 16963Sbill */ 17063Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 17163Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 17263Sbill 17363Sbill /* 17463Sbill * Some macros for units conversion 17563Sbill */ 17663Sbill /* Core clicks (512 bytes) to segments and vice versa */ 17763Sbill #define ctos(x) (x) 17863Sbill #define stoc(x) (x) 17963Sbill 18063Sbill /* Core clicks (512 bytes) to disk blocks */ 18163Sbill #define ctod(x) (x) 18263Sbill 18363Sbill /* clicks to bytes */ 18463Sbill #define ctob(x) ((x)<<9) 18563Sbill 18663Sbill /* bytes to clicks */ 18763Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 18863Sbill 18963Sbill /* major part of a device */ 19063Sbill #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 19163Sbill 19263Sbill /* minor part of a device */ 19363Sbill #define minor(x) ((int)((x)&0377)) 19463Sbill 19563Sbill /* make a device number */ 19663Sbill #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) 19763Sbill 19863Sbill typedef struct { int r[1]; } * physadr; 19963Sbill typedef int daddr_t; 20063Sbill typedef char * caddr_t; 20163Sbill typedef unsigned short ino_t; 20263Sbill typedef int swblk_t; 20363Sbill typedef int size_t; 20463Sbill typedef int time_t; 20563Sbill typedef int label_t[14]; 20663Sbill typedef short dev_t; 20763Sbill typedef int off_t; 20863Sbill 209582Sbill typedef unsigned char u_char; 210582Sbill typedef unsigned short u_short; 211582Sbill typedef unsigned int u_int; 212582Sbill typedef unsigned long u_long; 213582Sbill 21463Sbill /* 21563Sbill * Machine-dependent bits and macros 21663Sbill */ 21763Sbill #define UMODE PSL_CURMOD /* usermode bits */ 21863Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 21963Sbill 22063Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 221