1*97Sbill /* param.h 3.2 10/14/12 */ 263Sbill 363Sbill /* 463Sbill * tunable variables 563Sbill * 663Sbill * NB: NBUF is well known in locore.s 763Sbill */ 863Sbill 963Sbill #define NBUF 48 /* size of buffer cache */ 1063Sbill #define NINODE 250 /* number of in core inodes */ 1163Sbill #define NFILE 225 /* number of in core file structures */ 1263Sbill #define NMOUNT 8 /* number of mountable file systems */ 1363Sbill #define MAXUPRC 25 /* max processes per user */ 1463Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 1563Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 1663Sbill #define NOFILE 20 /* max open files per process */ 1763Sbill #define CANBSIZ 256 /* max size of typewriter line */ 1863Sbill #define SMAPSIZ (4*NPROC) /* size of swap allocation area */ 1963Sbill #define NCALL 40 /* max simultaneous time callouts */ 2063Sbill #define NPROC 150 /* max number of processes */ 2163Sbill #define NTEXT 60 /* max number of pure texts */ 2263Sbill #define NCLIST 500 /* max total clist size */ 2363Sbill #define HZ 60 /* Ticks/second of the clock */ 2463Sbill #define TIMEZONE (8*60) /* Minutes westward from Greenwich */ 2563Sbill #define DSTFLAG 1 /* Daylight Saving Time applies in this locality */ 2663Sbill #define MSGBUFS 128 /* Characters saved from error messages */ 2763Sbill #define NCARGS 5120 /* # characters in exec arglist */ 2863Sbill /* 2963Sbill * priorities 3063Sbill * probably should not be 3163Sbill * altered too much 3263Sbill */ 3363Sbill 3463Sbill #define PSWP 0 3563Sbill #define PINOD 10 3663Sbill #define PRIBIO 20 3763Sbill #define PRIUBA 24 3863Sbill #define PZERO 25 3963Sbill #define PPIPE 26 4063Sbill #define PWAIT 30 4163Sbill #define PSLEP 40 4263Sbill #define PUSER 50 4363Sbill 4463Sbill #define NZERO 20 4563Sbill 4663Sbill /* 4763Sbill * signals 4863Sbill * dont change 4963Sbill */ 5063Sbill 5163Sbill #define NSIG 17 5263Sbill /* 5363Sbill * No more than 16 signals (1-16) because they are 5463Sbill * stored in bits in a word. 5563Sbill */ 5663Sbill #define SIGHUP 1 /* hangup */ 5763Sbill #define SIGINT 2 /* interrupt (rubout) */ 5863Sbill #define SIGQUIT 3 /* quit (FS) */ 5963Sbill #define SIGINS 4 /* illegal instruction */ 6063Sbill #define SIGTRC 5 /* trace or breakpoint */ 6163Sbill #define SIGIOT 6 /* iot */ 6263Sbill #define SIGEMT 7 /* emt */ 6363Sbill #define SIGFPT 8 /* floating exception */ 6463Sbill #define SIGKIL 9 /* kill, uncatchable termination */ 6563Sbill #define SIGBUS 10 /* bus error */ 6663Sbill #define SIGSEG 11 /* segmentation violation */ 6763Sbill #define SIGSYS 12 /* bad system call */ 6863Sbill #define SIGPIPE 13 /* end of pipe */ 6963Sbill #define SIGCLK 14 /* alarm clock */ 70*97Sbill #define SIGTRM 15 /* catchable termination */ 7163Sbill 7263Sbill /* 73*97Sbill * Return values from tsleep(). 74*97Sbill */ 75*97Sbill #define TS_OK 0 /* normal wakeup */ 76*97Sbill #define TS_TIME 1 /* timed-out wakeup */ 77*97Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 78*97Sbill 79*97Sbill /* 8063Sbill * fundamental constants of the implementation-- 8163Sbill * cannot be changed easily. 8263Sbill * note: UPAGES is well known in locore.s 8363Sbill */ 8463Sbill 8563Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 8663Sbill 8763Sbill #define UPAGES 6 /* pages of u-area */ 8863Sbill #define NULL 0 8963Sbill #define CMASK 0 /* default mask for file creation */ 9063Sbill #define NODEV (dev_t)(-1) 9163Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 9263Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 9363Sbill #define DIRSIZ 14 /* max characters per directory */ 9463Sbill 9563Sbill /* 9663Sbill * Clustering of hardware pages on machines with ridiculously small 9763Sbill * page sizes is done here. The paging subsystem deals with units of 9863Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 9963Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 10063Sbill * deals with the same size blocks that the file system uses. 10163Sbill * 10263Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 10363Sbill * 10463Sbill * NB: CLSIZE is well known in locore.s. 10563Sbill */ 10663Sbill #define CLSIZE 2 10763Sbill 10863Sbill /* give the base virtual address (first of CLSIZE) */ 10963Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 11063Sbill 11163Sbill /* round a number of clicks up to a whole cluster */ 11263Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 11363Sbill 11463Sbill #if CLSIZE==1 11563Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 11663Sbill #define INOPB 8 /* 8 inodes per block */ 11763Sbill #define BMASK 0777 /* BSIZE-1 */ 11863Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 11963Sbill #define NMASK 0177 /* NINDIR-1 */ 12063Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 12163Sbill #define NICINOD 100 /* number of superblock inodes */ 12263Sbill #define NICFREE 50 /* number of superblock free blocks */ 12363Sbill 12463Sbill #endif 12563Sbill 12663Sbill #if CLSIZE==2 12763Sbill #define BSIZE 1024 12863Sbill #define INOPB 16 12963Sbill #define BMASK 01777 13063Sbill #define BSHIFT 10 13163Sbill #define NMASK 0377 13263Sbill #define NSHIFT 8 13363Sbill #define NICINOD 100 13463Sbill #define NICFREE 178 13563Sbill #endif 13663Sbill 13763Sbill #if CLSIZE==4 13863Sbill #define BSIZE 2048 13963Sbill #define INOPB 32 14063Sbill #define BMASK 03777 14163Sbill #define BSHIFT 11 14263Sbill #define NMASK 0777 14363Sbill #define NSHIFT 9 14463Sbill #define NICINOD 100 14563Sbill #define NICFREE 434 14663Sbill #endif 14763Sbill 14863Sbill #ifndef INTRLVE 14963Sbill /* macros replacing interleaving functions */ 15063Sbill #define dkblock(bp) ((bp)->b_blkno) 15163Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 15263Sbill #endif 15363Sbill 15463Sbill /* inumber to disk address and inumber to disk offset */ 15563Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 15663Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 15763Sbill 15863Sbill /* file system blocks to disk blocks and back */ 15963Sbill #define fsbtodb(b) ((b)*CLSIZE) 16063Sbill #define dbtofsb(b) ((b)/CLSIZE) 16163Sbill 16263Sbill /* BSLOP can be 0 unless you have a TIU/Spider */ 16363Sbill #define BSLOP 0 /* In case some device needs bigger buffers */ 16463Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 16563Sbill 16663Sbill #define CBSIZE 28 /* number of chars in a clist block */ 16763Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 16863Sbill #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 16963Sbill 17063Sbill /* 17163Sbill * Macros for fast min/max 17263Sbill */ 17363Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 17463Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 17563Sbill 17663Sbill /* 17763Sbill * Some macros for units conversion 17863Sbill */ 17963Sbill /* Core clicks (512 bytes) to segments and vice versa */ 18063Sbill #define ctos(x) (x) 18163Sbill #define stoc(x) (x) 18263Sbill 18363Sbill /* Core clicks (512 bytes) to disk blocks */ 18463Sbill #define ctod(x) (x) 18563Sbill 18663Sbill /* clicks to bytes */ 18763Sbill #define ctob(x) ((x)<<9) 18863Sbill 18963Sbill /* bytes to clicks */ 19063Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 19163Sbill 19263Sbill /* major part of a device */ 19363Sbill #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 19463Sbill 19563Sbill /* minor part of a device */ 19663Sbill #define minor(x) ((int)((x)&0377)) 19763Sbill 19863Sbill /* make a device number */ 19963Sbill #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) 20063Sbill 20163Sbill typedef struct { int r[1]; } * physadr; 20263Sbill typedef int daddr_t; 20363Sbill typedef char * caddr_t; 20463Sbill typedef unsigned short ino_t; 20563Sbill typedef int swblk_t; 20663Sbill typedef int size_t; 20763Sbill typedef int time_t; 20863Sbill typedef int label_t[14]; 20963Sbill typedef short dev_t; 21063Sbill typedef int off_t; 21163Sbill 21263Sbill /* 21363Sbill * Machine-dependent bits and macros 21463Sbill */ 21563Sbill #define UMODE PSL_CURMOD /* usermode bits */ 21663Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 21763Sbill 21863Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 21963Sbill 22063Sbill #ifdef KERNEL 22163Sbill #ifdef lint 22263Sbill int __void__; 22363Sbill #define VOID __void__ = (int) 22463Sbill #else 22563Sbill #define VOID 22663Sbill #endif 22763Sbill #endif 228