home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsisode80_tar.Z / vmsisode80_tar / sockit / gccinclude / sys / param.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-30  |  8.1 KB  |  270 lines

  1. /*     @(#)param.h    3.3    (ULTRIX)    9/4/87     */
  2.  
  3. /************************************************************************
  4.  *                                    *
  5.  *            Copyright (c) 1986 by                *
  6.  *        Digital Equipment Corporation, Maynard, MA        *
  7.  *            All rights reserved.                *
  8.  *                                    *
  9.  *   This software is furnished under a license and may be used and    *
  10.  *   copied  only  in accordance with the terms of such license and    *
  11.  *   with the  inclusion  of  the  above  copyright  notice.   This    *
  12.  *   software  or  any  other copies thereof may not be provided or    *
  13.  *   otherwise made available to any other person.  No title to and    *
  14.  *   ownership of the software is hereby transferred.            *
  15.  *                                    *
  16.  *   This software is  derived  from  software  received  from  the    *
  17.  *   University    of   California,   Berkeley,   and   from   Bell    *
  18.  *   Laboratories.  Use, duplication, or disclosure is  subject  to    *
  19.  *   restrictions  under  license  agreements  with  University  of    *
  20.  *   California and with AT&T.                        *
  21.  *                                    *
  22.  *   The information in this software is subject to change  without    *
  23.  *   notice  and should not be construed as a commitment by Digital    *
  24.  *   Equipment Corporation.                        *
  25.  *                                    *
  26.  *   Digital assumes no responsibility for the use  or  reliability    *
  27.  *   of its software on equipment which is not supplied by Digital.    *
  28.  *                                    *
  29.  ************************************************************************/
  30.  
  31. /************************************************************************
  32.  *            Modification History
  33.  *
  34.  * 11 Sep 86 -- koehler
  35.  *    added a constant so that everyone may always tell what the
  36.  *    units returned are from getmnt
  37.  *
  38.  * 29 Apr 86 -- depp
  39.  *    Moved System IPC constants to either /sys/h: msg.h, sem.h
  40.  *
  41.  * 14 Aug 85 -- depp
  42.  *    Removed SEMUND definition as this should be NPROC
  43.  *
  44.  * 03 May 85 -- Larry Cohen                        *
  45.  *    Increase size of CBSIZE to 60 from 28                *
  46.  *                                    *
  47.  * 25 Apr 85 -- depp
  48.  *    Removed SHMEM ifdefs
  49.  *
  50.  * 24 Apr 85 -- depp
  51.  *    Increased SMBRK (delta between end of data and beginning of
  52.  *    shared memory) to 32K (64 pages).
  53.  *
  54.  *    Stephen Reilly, 18-Apr-1985
  55.  * 004- Increased the number mounted devices from 15 to 64.
  56.  *
  57.  *     David L Ballenger, 16-Apr-1985
  58.  * 003-    Remove definition of HZ.
  59.  *
  60.  *  9 Apr 85 -- depp
  61.  *    Define System V IPC constants
  62.  *
  63.  *    David L Ballenger, 31-Mar-1985                    *
  64.  * 0002 Define HZ for System V routines.                *
  65.  *                                    *
  66.  *    001 - March 11 1985 - Larry Cohen                *
  67.  *         increase NOFILE from 20 to 64                *
  68.  *                                    *
  69.  ************************************************************************/
  70.  
  71. /*    param.h    6.1    83/07/29    */
  72.  
  73. /*
  74.  * Machine type dependent parameters.
  75.  */
  76. #ifdef KERNEL
  77. #include "../machine/param.h"
  78. #else
  79. #include <machine/param.h>
  80. #endif
  81.  
  82. #define    NPTEPG        (NBPG/(sizeof (struct pte)))
  83.  
  84. /*
  85.  * Shared memory -- number of segments per process
  86.  */
  87.  
  88. #define    SMSEG    6
  89.  
  90. /*
  91.  * Machine-independent constants
  92.  */
  93. #define    NMOUNT    254        /* 004 number of mountable file systems */
  94. #define    MSWAPX    254        /* 004 pseudo mount table index for swapdev */
  95. #define NUM_FS  0xff        /* maximum number of file system types */
  96. #define MINPGTHRESH 8192    /* size of file where we demand page it in */
  97.                 /* files > this size are demand paged */
  98.                 /* files < this size are entirely read in */
  99.                 /* settable at mount time */
  100.                 /* default set by each file system */
  101.  
  102. /*
  103.  * MAXUPRC is now a global variable: maxuprc whose value is assigned
  104.  * in param.c
  105.  */
  106. #define    NOFILE    64        /* max open files per process */ /*LSC001*/
  107. /* NOFILE MUST NOT BE >= 31; SEE pte.h */
  108. #define    CANBSIZ    256        /* max size of typewriter line */
  109. #define    NCARGS    10240        /* # characters in exec arglist */
  110. #define    NGROUPS    32        /* max number groups */
  111.  
  112. #define    NOGROUP    -1        /* marker for empty group set member */
  113.  
  114. /*
  115.  * Priorities
  116.  */
  117. #define PCATCH  0400
  118. #define PMASK   0177
  119. #define    PSWP    0
  120. #define    PINOD    10
  121. #define    PRIBIO    20
  122. #define    PRIUBA    24
  123. #define    PZERO    25
  124. #define    PPIPE    26
  125. #define    PWAIT    30
  126. #define    PLOCK    35
  127. #define    PSLEP    40
  128. #define    PUSER    50
  129.  
  130. #define    NZERO    20
  131.  
  132. /*
  133.  * Signals
  134.  */
  135. #ifdef KERNEL
  136. #include "../h/signal.h"
  137. #else
  138. #include <signal.h>
  139. #endif
  140.  
  141. #define    ISSIG(p) \
  142.     ((p)->p_sig && ((p)->p_flag&STRC || \
  143.      ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
  144.  
  145. /*
  146.  * Fundamental constants of the implementation.
  147.  */
  148. #define    NBBY    8        /* number of bits in a byte */
  149. #define    NBPW    sizeof(int)    /* number of bytes in an integer */
  150.  
  151. #define    NULL    0
  152. #define    CMASK    0        /* default mask for file creation */
  153. #define    NODEV    (dev_t)(-1)
  154.  
  155. /*
  156.  * Clustering of hardware pages on machines with ridiculously small
  157.  * page sizes is done here.  The paging subsystem deals with units of
  158.  * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
  159.  * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
  160.  * deals with the same size blocks that the file system uses.
  161.  *
  162.  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
  163.  */
  164. #define    CLBYTES        (CLSIZE*NBPG)
  165. #define    CLOFSET        (CLSIZE*NBPG-1)    /* for clusters, like PGOFSET */
  166. #define    claligned(x)    ((((int)(x))&CLOFSET)==0)
  167. #define    CLOFF        CLOFSET
  168. #define    CLSHIFT        (PGSHIFT+CLSIZELOG2)
  169.  
  170. #if CLSIZE==1
  171. #define    clbase(i)    (i)
  172. #define    clrnd(i)    (i)
  173. #else
  174. /* give the base virtual address (first of CLSIZE) */
  175. #define    clbase(i)    ((i) &~ (CLSIZE-1))
  176. /* round a number of clicks up to a whole cluster */
  177. #define    clrnd(i)    (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
  178. #endif
  179.  
  180. #ifndef INTRLVE
  181. /* macros replacing interleaving functions */
  182. #define    dkblock(bp)    ((bp)->b_blkno)
  183. #define    dkunit(bp)    (minor((bp)->b_dev) >> 3)
  184. #endif
  185.  
  186. #define    CBSIZE    60        /* number of chars in a clist block */
  187. #define    CROUND    0x3F        /* clist rounding; sizeof(int *) + CBSIZE -1*/
  188.  
  189. #ifndef KERNEL
  190. #include    <sys/types.h>
  191. #else
  192. #ifndef LOCORE
  193. #include    "../h/types.h"
  194. #endif
  195. #endif
  196.  
  197. /*
  198.  * File system parameters and macros.
  199.  *
  200.  * The file system is made out of blocks of at most MAXBSIZE units,
  201.  * with smaller units (fragments) only in the last direct block.
  202.  * MAXBSIZE primarily determines the size of buffers in the buffer
  203.  * pool. It may be made larger without any effect on existing
  204.  * file systems; however making it smaller make make some file
  205.  * systems unmountable.
  206.  *
  207.  * Note that the blocked devices are assumed to have DEV_BSIZE
  208.  * "sectors" and that fragments must be some multiple of this size.
  209.  * Block devices are read in BLKDEV_IOSIZE units. This number must
  210.  * be a power of two and in the range of
  211.  *    DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
  212.  * This size has no effect upon the file system, but is usually set
  213.  * to the block size of the root file system, so as to maximize the
  214.  * speed of ``fsck''.
  215.  */
  216. /*#define    MAXBSIZE    8192 */ /*pkay isode doesn't like this*/
  217. #define    DEV_BSIZE    512
  218. #define    DEV_BSHIFT    9        /* log2(DEV_BSIZE) */
  219. #define BLKDEV_IOSIZE    2048
  220. #define MAXFRAG     8
  221. #define FSDUNIT        1024        /* used by getmnt */
  222.  
  223. #define    btodb(bytes)             /* calculates (bytes / DEV_BSIZE) */ \
  224.     ((unsigned)(bytes) >> DEV_BSHIFT)
  225. #define    dbtob(db)            /* calculates (db * DEV_BSIZE) */ \
  226.     ((unsigned)(db) << DEV_BSHIFT)
  227.  
  228. /*
  229.  * Map a ``block device block'' to a file system block.
  230.  * This should be device dependent, and will be after we
  231.  * add an entry to cdevsw for that purpose.  For now though
  232.  * just use DEV_BSIZE.
  233.  */
  234. #define    bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
  235.  
  236. /*
  237.  * MAXPATHLEN defines the longest permissable path length
  238.  * after expanding symbolic links. It is used to allocate
  239.  * a temporary buffer from the buffer pool in which to do the
  240.  * name expansion, hence should be a power of two, and must
  241.  * be less than or equal to MAXBSIZE.
  242.  * MAXSYMLINKS defines the maximum number of symbolic links
  243.  * that may be expanded in a path name. It should be set high
  244.  * enough to allow all legitimate uses, but halt infinite loops
  245.  * reasonably quickly.
  246.  */
  247. #define MAXPATHLEN    1024
  248. #define MAXSYMLINKS    8
  249.  
  250. /*
  251.  * bit map related macros
  252.  */
  253. #define    setbit(a,i)    ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  254. #define    clrbit(a,i)    ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  255. #define    isset(a,i)    ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  256. #define    isclr(a,i)    (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  257.  
  258. /*
  259.  * Macros for fast min/max.
  260.  */
  261. #define    MIN(a,b) (((a)<(b))?(a):(b))
  262. #define    MAX(a,b) (((a)>(b))?(a):(b))
  263.  
  264. /*
  265.  * Macros for counting and rounding.
  266.  */
  267. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  268. #define    roundup(x, y)    ((((x)+((y)-1))/(y))*(y))
  269.  
  270.