1*874Sbill /* param.h 3.11 09/14/80 */ 263Sbill 363Sbill /* 463Sbill * tunable variables 563Sbill * 663Sbill * NB: NBUF is well known in locore.s 763Sbill */ 863Sbill 9388Sbill #define NBUF 62 /* size of buffer cache */ 10379Sbill #define NINODE 400 /* number of in core inodes */ 11379Sbill #define NFILE 350 /* number of in core file structures */ 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 */ 1863Sbill #define CANBSIZ 256 /* max size of typewriter line */ 1963Sbill #define SMAPSIZ (4*NPROC) /* size of swap allocation area */ 2063Sbill #define NCALL 40 /* max simultaneous time callouts */ 21379Sbill #define NPROC 250 /* max number of processes */ 2263Sbill #define NTEXT 60 /* max number of pure texts */ 2363Sbill #define NCLIST 500 /* max total clist size */ 2463Sbill #define HZ 60 /* Ticks/second of the clock */ 2563Sbill #define TIMEZONE (8*60) /* Minutes westward from Greenwich */ 2663Sbill #define DSTFLAG 1 /* Daylight Saving Time applies in this locality */ 2763Sbill #define MSGBUFS 128 /* Characters saved from error messages */ 28*874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 2963Sbill /* 3063Sbill * priorities 3163Sbill * probably should not be 3263Sbill * altered too much 3363Sbill */ 3463Sbill 3563Sbill #define PSWP 0 3663Sbill #define PINOD 10 3763Sbill #define PRIBIO 20 3863Sbill #define PRIUBA 24 3963Sbill #define PZERO 25 4063Sbill #define PPIPE 26 4163Sbill #define PWAIT 30 4263Sbill #define PSLEP 40 4363Sbill #define PUSER 50 4463Sbill 4563Sbill #define NZERO 20 4663Sbill 4763Sbill /* 4863Sbill * signals 4963Sbill * dont change 5063Sbill */ 5163Sbill 52176Sbill #ifndef NSIG 53176Sbill #include <signal.h> 54176Sbill #endif 5563Sbill 5663Sbill /* 5797Sbill * Return values from tsleep(). 5897Sbill */ 5997Sbill #define TS_OK 0 /* normal wakeup */ 6097Sbill #define TS_TIME 1 /* timed-out wakeup */ 6197Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 6297Sbill 6397Sbill /* 6463Sbill * fundamental constants of the implementation-- 6563Sbill * cannot be changed easily. 6663Sbill * note: UPAGES is well known in locore.s 6763Sbill */ 6863Sbill 6963Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 7063Sbill 7163Sbill #define UPAGES 6 /* pages of u-area */ 7263Sbill #define NULL 0 7363Sbill #define CMASK 0 /* default mask for file creation */ 7463Sbill #define NODEV (dev_t)(-1) 7563Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 7663Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 7763Sbill #define DIRSIZ 14 /* max characters per directory */ 7863Sbill 7963Sbill /* 8063Sbill * Clustering of hardware pages on machines with ridiculously small 8163Sbill * page sizes is done here. The paging subsystem deals with units of 8263Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 8363Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 8463Sbill * deals with the same size blocks that the file system uses. 8563Sbill * 8663Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8763Sbill * 8863Sbill * NB: CLSIZE is well known in locore.s. 8963Sbill */ 9063Sbill #define CLSIZE 2 9163Sbill 9263Sbill /* give the base virtual address (first of CLSIZE) */ 9363Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 9463Sbill 9563Sbill /* round a number of clicks up to a whole cluster */ 9663Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 9763Sbill 9863Sbill #if CLSIZE==1 9963Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 10063Sbill #define INOPB 8 /* 8 inodes per block */ 10163Sbill #define BMASK 0777 /* BSIZE-1 */ 10263Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 10363Sbill #define NMASK 0177 /* NINDIR-1 */ 10463Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 10563Sbill #define NICINOD 100 /* number of superblock inodes */ 10663Sbill #define NICFREE 50 /* number of superblock free blocks */ 10763Sbill 10863Sbill #endif 10963Sbill 11063Sbill #if CLSIZE==2 11163Sbill #define BSIZE 1024 11263Sbill #define INOPB 16 11363Sbill #define BMASK 01777 11463Sbill #define BSHIFT 10 11563Sbill #define NMASK 0377 11663Sbill #define NSHIFT 8 11763Sbill #define NICINOD 100 11863Sbill #define NICFREE 178 11963Sbill #endif 12063Sbill 12163Sbill #if CLSIZE==4 12263Sbill #define BSIZE 2048 12363Sbill #define INOPB 32 12463Sbill #define BMASK 03777 12563Sbill #define BSHIFT 11 12663Sbill #define NMASK 0777 12763Sbill #define NSHIFT 9 12863Sbill #define NICINOD 100 12963Sbill #define NICFREE 434 13063Sbill #endif 13163Sbill 13263Sbill #ifndef INTRLVE 13363Sbill /* macros replacing interleaving functions */ 13463Sbill #define dkblock(bp) ((bp)->b_blkno) 13563Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 13663Sbill #endif 13763Sbill 13863Sbill /* inumber to disk address and inumber to disk offset */ 13963Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 14063Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 14163Sbill 14263Sbill /* file system blocks to disk blocks and back */ 14363Sbill #define fsbtodb(b) ((b)*CLSIZE) 14463Sbill #define dbtofsb(b) ((b)/CLSIZE) 14563Sbill 14663Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 14763Sbill 14863Sbill #define CBSIZE 28 /* number of chars in a clist block */ 14963Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 15063Sbill #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 15163Sbill 15263Sbill /* 15363Sbill * Macros for fast min/max 15463Sbill */ 15563Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 15663Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 15763Sbill 15863Sbill /* 15963Sbill * Some macros for units conversion 16063Sbill */ 16163Sbill /* Core clicks (512 bytes) to segments and vice versa */ 16263Sbill #define ctos(x) (x) 16363Sbill #define stoc(x) (x) 16463Sbill 16563Sbill /* Core clicks (512 bytes) to disk blocks */ 16663Sbill #define ctod(x) (x) 16763Sbill 16863Sbill /* clicks to bytes */ 16963Sbill #define ctob(x) ((x)<<9) 17063Sbill 17163Sbill /* bytes to clicks */ 17263Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 17363Sbill 17463Sbill /* major part of a device */ 17563Sbill #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 17663Sbill 17763Sbill /* minor part of a device */ 17863Sbill #define minor(x) ((int)((x)&0377)) 17963Sbill 18063Sbill /* make a device number */ 18163Sbill #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) 18263Sbill 18363Sbill typedef struct { int r[1]; } * physadr; 18463Sbill typedef int daddr_t; 18563Sbill typedef char * caddr_t; 18663Sbill typedef unsigned short ino_t; 18763Sbill typedef int swblk_t; 18863Sbill typedef int size_t; 18963Sbill typedef int time_t; 19063Sbill typedef int label_t[14]; 19163Sbill typedef short dev_t; 19263Sbill typedef int off_t; 19363Sbill 194582Sbill typedef unsigned char u_char; 195582Sbill typedef unsigned short u_short; 196582Sbill typedef unsigned int u_int; 197582Sbill typedef unsigned long u_long; 198582Sbill 19963Sbill /* 20063Sbill * Machine-dependent bits and macros 20163Sbill */ 20263Sbill #define UMODE PSL_CURMOD /* usermode bits */ 20363Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 20463Sbill 20563Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 206