|
|
1.1 root 1: /*
2: * Tunable parameters which do not usually vary per system
3: */
4:
5: #define MAXUPRC 75 /* max processes per user */
6: #define SSIZE 4 /* initial stack size (*512 bytes) */
7: #define SINCR 4 /* increment of stack (*512 bytes) */
8: #define NOFILE 128 /* max open files per process */
9: #define NSYSFILE 4 /* stdin, stdout, stderr, /dev/tty */
10: #define NCARGS (16*1024) /* # characters in exec arglist */
11: #define CMASK 0 /* default mask for file creation */
12: #define NGROUPS 32 /* number of simultaneous groups */
13:
14: /*
15: * priorities
16: * probably should not be
17: * altered too much
18: */
19:
20: #define PSWP 0
21: #define PINOD 10
22: #define PRIBIO 20
23: #define PZERO 25
24: #define PPIPE 26
25: #define PWAIT 30
26: #define PSLEP 40
27: #define PUSER 50
28: #define PRIMAX 127
29:
30: #define NZERO 20
31:
32: /*
33: * signals
34: * dont change
35: */
36:
37: #ifndef NSIG
38: #include <signal.h>
39: #endif
40:
41: /*
42: * Return values from tsleep().
43: */
44: #define TS_OK 0 /* normal wakeup */
45: #define TS_TIME 1 /* timed-out wakeup */
46: #define TS_SIG 2 /* asynchronous signal wakeup */
47:
48: #define UPAGES 10 /* pages of u-area */
49: #define NULL 0
50: #define NODEV (dev_t)(-1)
51: #define ROOTINO ((ino_t)2) /* i number of all roots */
52: #define SUPERB ((daddr_t)1) /* block number of the super block */
53: #define DIRSIZ 14 /* max characters per directory */
54: #define MAXPID 30000 /* largest process id */
55:
56: /*
57: * clustering of small hardware pages to larger software pages
58: * this should be in a separate file, one might guess
59: *
60: * bugs: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
61: * BSIZE must bear some relation to CLSIZE*NBPG (but what?)
62: */
63: #define CLSIZE 2
64: #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
65:
66: /* give the base virtual address (first of CLSIZE) */
67: #define clbase(i) ((i) &~ (CLSIZE-1))
68:
69: /* round a number of clicks up to a whole cluster */
70: #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
71:
72: /*
73: * the following tend to assume that CLSIZE == 2
74: */
75: #define BITFS(dev) ((dev) & 64)
76: #define BUFSIZE 4096 /* real buffer size */
77: #define BSIZE(dev) (BITFS(dev)? 4096: 1024)
78: #define INOPB(dev) (BITFS(dev)? 64: 16) /* inodes per block */
79: #define BMASK(dev) (BITFS(dev)? 07777: 01777) /* BSIZE-1 */
80: #define BSHIFT(dev) (BITFS(dev)? 12: 10) /* LOG2(BSIZE) */
81: #define NINDIR(dev) (BSIZE(dev)/sizeof(daddr_t))
82: #define NMASK(dev) (BITFS(dev)? 01777: 0377) /* NINDIR-1 */
83: #define NSHIFT(dev) (BITFS(dev)? 10: 8) /* LOG2(NINDIR) */
84: #define NICINOD 100 /* free inodes stored in super block */
85: #define NICFREE 178 /* free blocks in (old) super block */
86: #define itod(dev, x) ((daddr_t)((((unsigned)(x)+2*INOPB(dev)-1)/INOPB(dev))))
87: #define itoo(dev, x) ((int)(((x)+2*INOPB(dev)-1)%INOPB(dev)))
88: #define fsbtodb(dev, b) (BITFS(dev)? (b)*8: (b)*CLSIZE)
89: #define dbtofsb(dev, b) (BITFS(dev)? (b)/8: (b)/CLSIZE)
90:
91: #ifndef INTRLVE
92: /* macros replacing interleaving functions */
93: #define dkblock(bp) ((bp)->b_blkno)
94: #define dkunit(bp) (minor((bp)->b_dev & 077) >> 3)
95: /* that means 8 units with at most 8 pieces each */
96: #endif
97:
98: /*
99: * Macros for fast min/max
100: */
101: #define MIN(a,b) (((a)<(b))?(a):(b))
102: #define MAX(a,b) (((a)>(b))?(a):(b))
103:
104: /*
105: * Machine-dependent bits and macros
106: */
107: #define UMODE PSL_CURMOD /* usermode bits */
108: #define USERMODE(ps) (((ps) & UMODE) == UMODE)
109:
110: #define BASEPRI(ps) (((ps) & PSL_IPL) != 0)
111:
112: /*
113: * Provide about n microseconds of delay
114: */
115: #define DELAY(n) {extern int delayfact;register int N = (n)*delayfact;while (--N > 0);}
116:
117: /*
118: * hardware definitions
119: * some are (stupidly) in types.h
120: */
121: #define USRSTACK (0x80000000-UPAGES*NBPG)
122: /* Start of user stack */
123: #define P1TOP 0x200000 /* boundary between P0 and P1 regions */
124: #define KSTART 0x80000000 /* beginning of system space */
125:
126: #define HZ 60 /* software clock ticks per second */
127:
128: /*
129: * user-accessible types and macros
130: */
131: #include "sys/types.h"
132:
133: /*
134: * very long stuff
135: */
136: #define Ltol(x) (x).lo
137: Long ltoL();
138: Long Lladd();
139: Long Luadd();
140: Long LLadd();
141: #define Lsign(x) (x).hi
142: unsigned Lshift();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.