date and time created 83/01/21 11:10:25 by dlw
[unix-history] / usr / src / sys / sys / param.h
CommitLineData
3e14e5ba 1/* param.h 4.27 83/01/17 */
eb401bce
BJ
2
3/*
557ae0ad 4 * Macine type dependent parameters.
eb401bce 5 */
961945a8
SL
6#ifdef KERNEL
7#include "../machine/param.h"
8#else
9#include <machine/param.h>
557ae0ad
BJ
10#endif
11
12#define NPTEPG (NBPG/(sizeof (struct pte)))
eb401bce 13
557ae0ad
BJ
14/*
15 * Machine-independent constants
16 */
40ed5066
BJ
17#define NMOUNT 15 /* number of mountable file systems */
18#define MSWAPX 15 /* pseudo mount table index for swapdev */
eb401bce 19#define MAXUPRC 25 /* max processes per user */
eb401bce 20#define NOFILE 20 /* max open files per process */
62d0f535 21/* NOFILE MUST NOT BE >= 31; SEE pte.h */
eb401bce 22#define CANBSIZ 256 /* max size of typewriter line */
488e2fab 23#define NCARGS 10240 /* # characters in exec arglist */
557ae0ad 24#define NGROUPS 8 /* max number groups */
62d0f535 25
eb401bce 26/*
557ae0ad 27 * Priorities
eb401bce 28 */
eb401bce
BJ
29#define PSWP 0
30#define PINOD 10
31#define PRIBIO 20
32#define PRIUBA 24
33#define PZERO 25
34#define PPIPE 26
35#define PWAIT 30
85e197bd 36#define PLOCK 35
eb401bce
BJ
37#define PSLEP 40
38#define PUSER 50
39
40#define NZERO 20
41
42/*
557ae0ad 43 * Signals
eb401bce 44 */
92808ee4
BJ
45#ifndef NSIG
46#include <signal.h>
47#endif
31037142 48
02dd5a44
BJ
49#define ISSIG(p) ((p)->p_sig && \
50 ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig())
51
31037142 52/*
557ae0ad 53 * Fundamental constants of the implementation.
31037142 54 */
7070df31
BJ
55#define NBBY 8 /* number of bits in a byte */
56#define NBPW sizeof(int) /* number of bytes in an integer */
eb401bce 57
eb401bce
BJ
58#define NULL 0
59#define CMASK 0 /* default mask for file creation */
60#define NODEV (dev_t)(-1)
eb401bce
BJ
61
62/*
63 * Clustering of hardware pages on machines with ridiculously small
64 * page sizes is done here. The paging subsystem deals with units of
65 * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
66 * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
67 * deals with the same size blocks that the file system uses.
68 *
69 * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
eb401bce 70 */
114cd253 71#define CLBYTES (CLSIZE*NBPG)
7070df31 72#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
114cd253
BJ
73#define claligned(x) ((((int)(x))&CLOFSET)==0)
74#define CLOFF CLOFSET
557ae0ad 75#define CLSHIFT (PGSHIFT+CLSIZELOG2)
eb401bce 76
557ae0ad
BJ
77#if CLSIZE==1
78#define clbase(i) (i)
79#define clrnd(i) (i)
80#else
eb401bce
BJ
81/* give the base virtual address (first of CLSIZE) */
82#define clbase(i) ((i) &~ (CLSIZE-1))
eb401bce
BJ
83/* round a number of clicks up to a whole cluster */
84#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
557ae0ad 85#endif
eb401bce 86
eb401bce
BJ
87#ifndef INTRLVE
88/* macros replacing interleaving functions */
89#define dkblock(bp) ((bp)->b_blkno)
90#define dkunit(bp) (minor((bp)->b_dev) >> 3)
91#endif
92
eb401bce
BJ
93#define CBSIZE 28 /* number of chars in a clist block */
94#define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/
eb401bce 95
d5d4a859
BJ
96#ifndef KERNEL
97#include <sys/types.h>
98#else
3e14e5ba 99#ifndef LOCORE
d5d4a859
BJ
100#include "../h/types.h"
101#endif
3e14e5ba 102#endif
591b0f1d 103
d5d4a859 104/*
ad30fb67
KM
105 * File system parameters and macros.
106 *
107 * The file system is made out of blocks of at most MAXBSIZE units,
108 * with smaller units (fragments) only in the last direct block.
109 * MAXBSIZE primarily determines the size of buffers in the buffer
110 * pool. It may be made larger without any effect on existing
111 * file systems; however making it smaller make make some file
112 * systems unmountable.
113 *
114 * Note that the blocked devices are assumed to have DEV_BSIZE
115 * "sectors" and that fragments must be some multiple of this size.
0f3b0b88
KM
116 * Block devices are read in BLKDEV_IOSIZE units. This number must
117 * be a power of two and in the range of
118 * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
119 * This size has no effect upon the file system, but is usually set
120 * to the block size of the root file system, so as to maximize the
121 * speed of ``fsck''.
ad30fb67
KM
122 */
123#define MAXBSIZE 8192
124#define DEV_BSIZE 512
0f3b0b88 125#define BLKDEV_IOSIZE 4096
ad30fb67
KM
126#define MAXFRAG 8
127
0048a91e
RE
128/*
129 * Map a ``block device block'' to a file system block.
130 * This should be device dependent, and will be after we
131 * add an entry to cdevsw for that purpose. For now though
132 * just use DEV_BSIZE.
133 */
557ae0ad 134#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
0048a91e 135
ad30fb67
KM
136/*
137 * MAXPATHLEN defines the longest permissable path length
138 * after expanding symbolic links. It is used to allocate
139 * a temporary buffer from the buffer pool in which to do the
140 * name expansion, hence should be a power of two, and must
141 * be less than or equal to MAXBSIZE.
142 * MAXSYMLINKS defines the maximum number of symbolic links
143 * that may be expanded in a path name. It should be set high
144 * enough to allow all legitimate uses, but halt infinite loops
145 * reasonably quickly.
146 */
147#define MAXPATHLEN 1024
148#define MAXSYMLINKS 8
149
150/*
151 * bit map related macros
152 */
153#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
154#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
155#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
156#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
157
158/*
159 * Macros for fast min/max.
160 */
161#define MIN(a,b) (((a)<(b))?(a):(b))
162#define MAX(a,b) (((a)>(b))?(a):(b))
163
164/*
165 * Macros for counting and rounding.
166 */
167#define howmany(x, y) (((x)+((y)-1))/(y))
168#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))