|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)param.h 7.5 (Berkeley) 6/5/87 ! 7: */ ! 8: ! 9: #define BSD 43 /* 4.3 * 10, as cpp doesn't do floats */ ! 10: #define BSD4_3 1 ! 11: ! 12: /* ! 13: * Machine-independent constants ! 14: */ ! 15: #define NMOUNT 20 /* number of mountable file systems */ ! 16: /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ ! 17: #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ ! 18: #define MAXUPRC 40 /* max processes per user */ ! 19: #define NOFILE 64 /* max open files per process */ ! 20: #define CANBSIZ 256 /* max size of typewriter line */ ! 21: #define NCARGS 20480 /* # characters in exec arglist */ ! 22: #define MAXINTERP 32 /* maximum interpreter file name length */ ! 23: #define NGROUPS 16 /* max number groups */ ! 24: #define MAXHOSTNAMELEN 64 /* maximum hostname size */ ! 25: ! 26: #define NOGROUP 65535 /* marker for empty group set member */ ! 27: ! 28: /* ! 29: * Priorities ! 30: */ ! 31: #define PSWP 0 ! 32: #define PINOD 10 ! 33: #define PRIBIO 20 ! 34: #define PRIUBA 24 ! 35: #define PZERO 25 ! 36: #define PPIPE 26 ! 37: #define PWAIT 30 ! 38: #define PLOCK 35 ! 39: #define PSLEP 40 ! 40: #define PUSER 50 ! 41: ! 42: #define NZERO 0 ! 43: ! 44: #ifndef KERNEL ! 45: #include <sys/types.h> ! 46: #else ! 47: #ifndef LOCORE ! 48: #include "types.h" ! 49: #endif ! 50: #endif ! 51: ! 52: /* ! 53: * Signals ! 54: */ ! 55: #ifdef KERNEL ! 56: #include "signal.h" ! 57: #else ! 58: #include <signal.h> ! 59: #endif ! 60: ! 61: #define ISSIG(p) \ ! 62: ((p)->p_sig && ((p)->p_flag&STRC || \ ! 63: ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) ! 64: ! 65: /* ! 66: * Machine type dependent parameters. ! 67: */ ! 68: #ifdef KERNEL ! 69: #include "../machine/machparam.h" ! 70: #else ! 71: #include <machine/machparam.h> ! 72: #endif ! 73: ! 74: #define NBPW sizeof(int) /* number of bytes in an integer */ ! 75: ! 76: #define NULL 0 ! 77: #define CMASK 022 /* default mask for file creation */ ! 78: #define NODEV (dev_t)(-1) ! 79: ! 80: /* ! 81: * Clustering of hardware pages on machines with ridiculously small ! 82: * page sizes is done here. The paging subsystem deals with units of ! 83: * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. ! 84: * ! 85: * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE ! 86: */ ! 87: #define CLBYTES (CLSIZE*NBPG) ! 88: #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ ! 89: #define claligned(x) ((((int)(x))&CLOFSET)==0) ! 90: #define CLOFF CLOFSET ! 91: #define CLSHIFT (PGSHIFT+CLSIZELOG2) ! 92: ! 93: #if CLSIZE==1 ! 94: #define clbase(i) (i) ! 95: #define clrnd(i) (i) ! 96: #else ! 97: /* give the base virtual address (first of CLSIZE) */ ! 98: #define clbase(i) ((i) &~ (CLSIZE-1)) ! 99: /* round a number of clicks up to a whole cluster */ ! 100: #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) ! 101: #endif ! 102: ! 103: /* CBLOCK is the size of a clist block, must be power of 2 */ ! 104: #define CBLOCK 64 ! 105: #define CBSIZE (CBLOCK - sizeof(struct cblock *)) /* data chars/clist */ ! 106: #define CROUND (CBLOCK - 1) /* clist rounding */ ! 107: ! 108: /* ! 109: * File system parameters and macros. ! 110: * ! 111: * The file system is made out of blocks of at most MAXBSIZE units, ! 112: * with smaller units (fragments) only in the last direct block. ! 113: * MAXBSIZE primarily determines the size of buffers in the buffer ! 114: * pool. It may be made larger without any effect on existing ! 115: * file systems; however making it smaller make make some file ! 116: * systems unmountable. ! 117: * ! 118: * Note that the blocked devices are assumed to have DEV_BSIZE ! 119: * "sectors" and that fragments must be some multiple of this size. ! 120: * Block devices are read in BLKDEV_IOSIZE units. This number must ! 121: * be a power of two and in the range of ! 122: * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE ! 123: * This size has no effect upon the file system, but is usually set ! 124: * to the block size of the root file system, so as to maximize the ! 125: * speed of ``fsck''. ! 126: */ ! 127: #define MAXBSIZE 8192 ! 128: #define MAXFRAG 8 ! 129: ! 130: /* ! 131: * MAXPATHLEN defines the longest permissable path length ! 132: * after expanding symbolic links. It is used to allocate ! 133: * a temporary buffer from the buffer pool in which to do the ! 134: * name expansion, hence should be a power of two, and must ! 135: * be less than or equal to MAXBSIZE. ! 136: * MAXSYMLINKS defines the maximum number of symbolic links ! 137: * that may be expanded in a path name. It should be set high ! 138: * enough to allow all legitimate uses, but halt infinite loops ! 139: * reasonably quickly. ! 140: */ ! 141: #define MAXPATHLEN 1024 ! 142: #define MAXSYMLINKS 8 ! 143: ! 144: /* ! 145: * Constants for setting the parameters of the kernel memory allocator. ! 146: * ! 147: * 2 ** MINBUCKET is the smallest unit of memory that will be ! 148: * allocated. It must be at least large enough to hold a pointer. ! 149: * ! 150: * Units of memory less or equal to MAXALLOCSAVE will permanently ! 151: * allocate physical memory; requests for these size pieces of ! 152: * memory are quite fast. Allocations greater than MAXALLOCSAVE must ! 153: * always allocate and free physical memory; requests for these ! 154: * size allocations should be done infrequently as they will be slow. ! 155: * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14) ! 156: * and MAXALLOCSIZE must be a power of two. ! 157: */ ! 158: #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ ! 159: #define MAXALLOCSAVE (2 * CLBYTES) ! 160: ! 161: /* ! 162: * bit map related macros ! 163: */ ! 164: #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) ! 165: #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) ! 166: #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) ! 167: #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) ! 168: ! 169: /* ! 170: * Macros for fast min/max. ! 171: */ ! 172: #define MIN(a,b) (((a)<(b))?(a):(b)) ! 173: #define MAX(a,b) (((a)>(b))?(a):(b)) ! 174: ! 175: /* ! 176: * Macros for counting and rounding. ! 177: */ ! 178: #ifndef howmany ! 179: #define howmany(x, y) (((x)+((y)-1))/(y)) ! 180: #endif ! 181: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) ! 182: #define powerof2(x) ((((x)-1)&(x))==0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.