Annotation of 42BSD/sys/h/param.h, revision 1.1.1.1

1.1       root        1: /*     param.h 6.1     83/07/29        */
                      2: 
                      3: /*
                      4:  * Machine type dependent parameters.
                      5:  */
                      6: #ifdef KERNEL
                      7: #include "../machine/param.h"
                      8: #else
                      9: #include <machine/param.h>
                     10: #endif
                     11: 
                     12: #define        NPTEPG          (NBPG/(sizeof (struct pte)))
                     13: 
                     14: /*
                     15:  * Machine-independent constants
                     16:  */
                     17: #define        NMOUNT  15              /* number of mountable file systems */
                     18: #define        MSWAPX  15              /* pseudo mount table index for swapdev */
                     19: #define        MAXUPRC 25              /* max processes per user */
                     20: #define        NOFILE  20              /* max open files per process */
                     21: /* NOFILE MUST NOT BE >= 31; SEE pte.h */
                     22: #define        CANBSIZ 256             /* max size of typewriter line */
                     23: #define        NCARGS  10240           /* # characters in exec arglist */
                     24: #define        NGROUPS 8               /* max number groups */
                     25: 
                     26: #define        NOGROUP -1              /* 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   20
                     43: 
                     44: /*
                     45:  * Signals
                     46:  */
                     47: #ifdef KERNEL
                     48: #include "../h/signal.h"
                     49: #else
                     50: #include <signal.h>
                     51: #endif
                     52: 
                     53: #define        ISSIG(p) \
                     54:        ((p)->p_sig && ((p)->p_flag&STRC || \
                     55:         ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
                     56: 
                     57: /*
                     58:  * Fundamental constants of the implementation.
                     59:  */
                     60: #define        NBBY    8               /* number of bits in a byte */
                     61: #define        NBPW    sizeof(int)     /* number of bytes in an integer */
                     62: 
                     63: #define        NULL    0
                     64: #define        CMASK   0               /* default mask for file creation */
                     65: #define        NODEV   (dev_t)(-1)
                     66: 
                     67: /*
                     68:  * Clustering of hardware pages on machines with ridiculously small
                     69:  * page sizes is done here.  The paging subsystem deals with units of
                     70:  * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
                     71:  * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
                     72:  * deals with the same size blocks that the file system uses.
                     73:  *
                     74:  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
                     75:  */
                     76: #define        CLBYTES         (CLSIZE*NBPG)
                     77: #define        CLOFSET         (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
                     78: #define        claligned(x)    ((((int)(x))&CLOFSET)==0)
                     79: #define        CLOFF           CLOFSET
                     80: #define        CLSHIFT         (PGSHIFT+CLSIZELOG2)
                     81: 
                     82: #if CLSIZE==1
                     83: #define        clbase(i)       (i)
                     84: #define        clrnd(i)        (i)
                     85: #else
                     86: /* give the base virtual address (first of CLSIZE) */
                     87: #define        clbase(i)       ((i) &~ (CLSIZE-1))
                     88: /* round a number of clicks up to a whole cluster */
                     89: #define        clrnd(i)        (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
                     90: #endif
                     91: 
                     92: #ifndef INTRLVE
                     93: /* macros replacing interleaving functions */
                     94: #define        dkblock(bp)     ((bp)->b_blkno)
                     95: #define        dkunit(bp)      (minor((bp)->b_dev) >> 3)
                     96: #endif
                     97: 
                     98: #define        CBSIZE  28              /* number of chars in a clist block */
                     99: #define        CROUND  0x1F            /* clist rounding; sizeof(int *) + CBSIZE -1*/
                    100: 
                    101: #ifndef KERNEL
                    102: #include       <sys/types.h>
                    103: #else
                    104: #ifndef LOCORE
                    105: #include       "../h/types.h"
                    106: #endif
                    107: #endif
                    108: 
                    109: /*
                    110:  * File system parameters and macros.
                    111:  *
                    112:  * The file system is made out of blocks of at most MAXBSIZE units,
                    113:  * with smaller units (fragments) only in the last direct block.
                    114:  * MAXBSIZE primarily determines the size of buffers in the buffer
                    115:  * pool. It may be made larger without any effect on existing
                    116:  * file systems; however making it smaller make make some file
                    117:  * systems unmountable.
                    118:  *
                    119:  * Note that the blocked devices are assumed to have DEV_BSIZE
                    120:  * "sectors" and that fragments must be some multiple of this size.
                    121:  * Block devices are read in BLKDEV_IOSIZE units. This number must
                    122:  * be a power of two and in the range of
                    123:  *     DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
                    124:  * This size has no effect upon the file system, but is usually set
                    125:  * to the block size of the root file system, so as to maximize the
                    126:  * speed of ``fsck''.
                    127:  */
                    128: #define        MAXBSIZE        8192
                    129: #define        DEV_BSIZE       512
                    130: #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
                    131: #define BLKDEV_IOSIZE  2048
                    132: #define MAXFRAG        8
                    133: 
                    134: #define        btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
                    135:        ((unsigned)(bytes) >> DEV_BSHIFT)
                    136: #define        dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
                    137:        ((unsigned)(db) << DEV_BSHIFT)
                    138: 
                    139: /*
                    140:  * Map a ``block device block'' to a file system block.
                    141:  * This should be device dependent, and will be after we
                    142:  * add an entry to cdevsw for that purpose.  For now though
                    143:  * just use DEV_BSIZE.
                    144:  */
                    145: #define        bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
                    146: 
                    147: /*
                    148:  * MAXPATHLEN defines the longest permissable path length
                    149:  * after expanding symbolic links. It is used to allocate
                    150:  * a temporary buffer from the buffer pool in which to do the
                    151:  * name expansion, hence should be a power of two, and must
                    152:  * be less than or equal to MAXBSIZE.
                    153:  * MAXSYMLINKS defines the maximum number of symbolic links
                    154:  * that may be expanded in a path name. It should be set high
                    155:  * enough to allow all legitimate uses, but halt infinite loops
                    156:  * reasonably quickly.
                    157:  */
                    158: #define MAXPATHLEN     1024
                    159: #define MAXSYMLINKS    8
                    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: #define        howmany(x, y)   (((x)+((y)-1))/(y))
                    179: #define        roundup(x, y)   ((((x)+((y)-1))/(y))*(y))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.