home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / param < prev    next >
Encoding:
Text File  |  1995-04-20  |  7.2 KB  |  253 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/param.h:networking  1.2  $
  3.  * $Source: /ax/networking:include/sys/param.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    param.h,v $
  8.  * Revision 1.2  95/04/20  16:39:55  kwelton
  9.  * Two main changes:
  10.  * 
  11.  * 1)  NBBY and NBPW now protected against multiple declarations.
  12.  * 
  13.  * 2)  #ifdef arm changed to correct form of #ifdef __arm
  14.  * 
  15.  * Revision 1.1  95/01/11  10:19:31  kwelton
  16.  * Initial revision
  17.  * 
  18.  * Revision 1.3  88/06/17  20:20:10  beta
  19.  * Acorn Unix initial beta version
  20.  * 
  21.  */
  22. /* @(#)param.h  1.5 87/09/03 3.2/4.3NFSSRC */
  23. /*
  24.  * Copyright (c) 1982, 1986 Regents of the University of California.
  25.  * All rights reserved.  The Berkeley software License Agreement
  26.  * specifies the terms and conditions for redistribution.
  27.  *
  28.  *      @(#)param.h     7.1 (Berkeley) 6/4/86
  29.  */
  30.  
  31. #define BSD     43              /* 4.3 * 10, as cpp doesn't do floats */
  32. #define BSD4_3  1
  33.  
  34. /*
  35.  * Machine type dependent parameters.
  36.  */
  37. #ifdef KERNEL
  38. # include "sysconf.h"
  39. # include "../machine/machparam.h"
  40. #else
  41. # include "sysconf.h"
  42. # include <machine/machparam.h>
  43. #endif
  44.  
  45. /* If you want to change this, talk to the CEGB */
  46.  
  47. #define HZ              100
  48.  
  49. #define NPTEPG          (NBPG/(sizeof (struct pte)))
  50. #define MAXPT           256     /* Maximum number of pages per process */
  51.  
  52. /*
  53.  * Machine-independent constants
  54.  */
  55. #define NMOUNT  20              /* number of mountable file systems */
  56. /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */
  57. #define MSWAPX  NMOUNT          /* pseudo mount table index for swapdev */
  58. #define MAXUPRC 40              /* max processes per user */
  59. #define NOFILE  64              /* max open files per process */
  60. #define MAXLINK 32767           /* max links */
  61. #define CANBSIZ 256             /* max size of typewriter line */
  62.  
  63. #ifdef  vax
  64. # define NCARGS  20480           /* # characters in exec arglist */
  65. #endif  vax
  66.  
  67. #define NGROUPS 16              /* max number groups */
  68.  
  69. #define NOGROUP 65535           /* marker for empty group set member */
  70.  
  71. /*
  72.  * Priorities
  73.  */
  74.         /*  PCATCH was added for use in the krpc routines  */
  75. #define PMASK   0177    /* mask for PCATCH */
  76. #define PCATCH  0400    /* return if sleep interrupted, don't longjmp */
  77.  
  78. #define PSWP    0
  79. #define PINOD   10
  80. #define PRIBIO  20
  81. #define PRIUBA  24
  82. #define PZERO   25
  83. #define PPIPE   26
  84. #define PVFS    27
  85. #define PWAIT   30
  86. #define PLOCK   35
  87. #define PSLEP   40
  88. #define PUSER   50
  89.  
  90. #define NZERO   0
  91.  
  92. /*
  93.  * Signals
  94.  */
  95. #ifdef KERNEL
  96. # include "sys/signal.h"
  97. #else
  98. # include "signal.h"
  99. #endif
  100.  
  101. #define ISSIG(p) \
  102.         ((p)->p_sig && ((p)->p_flag&STRC || \
  103.          ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
  104.  
  105. /*
  106.  * Fundamental constants of the implementation.
  107.  */
  108. #ifndef NBBY
  109. # define NBBY    8               /* number of bits in a byte */
  110. #endif
  111.  
  112. #ifndef NBPW
  113. # define NBPW    sizeof(int)     /* number of bytes in an integer */
  114. #endif
  115.  
  116. #ifndef NULL
  117. # define NULL    0
  118. #endif
  119.  
  120. #define CMASK   022             /* default mask for file creation */
  121. #define NODEV   (dev_t)(-1)
  122.  
  123. /*
  124.  * Clustering of hardware pages on machines with ridiculously small
  125.  * page sizes is done here.  The paging subsystem deals with units of
  126.  * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
  127.  * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
  128.  * deals with the same size blocks that the file system uses.
  129.  *
  130.  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
  131.  */
  132. #define CLBYTES         (CLSIZE*NBPG)
  133. #define CLOFSET         (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
  134. #define claligned(x)    ((((int)(x))&CLOFSET)==0)
  135. #define CLOFF           CLOFSET
  136. #define CLSHIFT         (PGSHIFT+CLSIZELOG2)
  137.  
  138. #if CLSIZE==1
  139. # define clbase(i)       (i)
  140. # define clrnd(i)        (i)
  141. #else
  142. /* give the base virtual address (first of CLSIZE) */
  143. # define clbase(i)       ((i) &~ (CLSIZE-1))
  144. /* round a number of clicks up to a whole cluster */
  145. # define clrnd(i)        (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
  146. #endif
  147.  
  148. /* CBLOCK is the size of a clist block, must be power of 2 */
  149. #define CBLOCK  64
  150. #define CBSIZE  (CBLOCK - sizeof(struct cblock *))      /* data chars/clist */
  151. #define CROUND  (CBLOCK - 1)                            /* clist rounding */
  152.  
  153. #ifndef KERNEL
  154. # include       "sys/types.h"
  155. #else
  156. # ifndef LOCORE
  157. #  include      "sys/types.h"
  158. # endif
  159. #endif
  160.  
  161. /*
  162.  * File system parameters and macros.
  163.  *
  164.  * The file system is made out of blocks of at most MAXBSIZE units,
  165.  * with smaller units (fragments) only in the last direct block.
  166.  * MAXBSIZE primarily determines the size of buffers in the buffer
  167.  * pool. It may be made larger without any effect on existing
  168.  * file systems; however making it smaller make make some file
  169.  * systems unmountable.
  170.  *
  171.  * Note that the blocked devices are assumed to have DEV_BSIZE
  172.  * "sectors" and that fragments must be some multiple of this size.
  173.  * Block devices are read in BLKDEV_IOSIZE units. This number must
  174.  * be a power of two and in the range of
  175.  *      DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
  176.  * This size has no effect upon the file system, but is usually set
  177.  * to the block size of the root file system, so as to maximize the
  178.  * speed of ``fsck''.
  179.  */
  180. #define MAXBSIZE        8192
  181. #ifdef  __arm
  182. # define NCBLKS          3
  183. # define NCARGS          (NCBLKS*MAXBSIZE)
  184. #endif  /* arm */
  185.  
  186. #define DEV_BSIZE       512
  187. #define DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
  188. #define BLKDEV_IOSIZE   2048
  189. #define MAXFRAG         8
  190.  
  191. #define btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
  192.         ((unsigned)(bytes) >> DEV_BSHIFT)
  193. #define dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
  194.         ((unsigned)(db) << DEV_BSHIFT)
  195.  
  196. /*
  197.  * Map a ``block device block'' to a file system block.
  198.  * This should be device dependent, and will be after we
  199.  * add an entry to cdevsw for that purpose.  For now though
  200.  * just use DEV_BSIZE.
  201.  */
  202. #define bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
  203.  
  204. /*
  205.  * MAXPATHLEN defines the longest permissable path length
  206.  * after expanding symbolic links. It is used to allocate
  207.  * a temporary buffer from the buffer pool in which to do the
  208.  * name expansion, hence should be a power of two, and must
  209.  * be less than or equal to MAXBSIZE.
  210.  * MAXSYMLINKS defines the maximum number of symbolic links
  211.  * that may be expanded in a path name. It should be set high
  212.  * enough to allow all legitimate uses, but halt infinite loops
  213.  * reasonably quickly.
  214.  */
  215. #define MAXPATHLEN      1024
  216. #define MAXSYMLINKS     20
  217.  
  218. /*
  219.  * bit map related macros
  220.  */
  221. #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  222. #define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  223. #define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  224. #define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  225.  
  226. /*
  227.  * Macros for fast min/max.
  228.  */
  229. #define MIN(a,b) (((a)<(b))?(a):(b))
  230. #define MAX(a,b) (((a)>(b))?(a):(b))
  231.  
  232. /*
  233.  * Macros for counting and rounding.
  234.  */
  235. #ifndef howmany
  236. #define howmany(x, y)   (((x)+((y)-1))/(y))
  237. #endif
  238. #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
  239.  
  240. /*
  241.  * Scale factor for scaled integers used to count
  242.  * %cpu time and load averages.
  243.  */
  244. #define FSHIFT  8       /* bits to right of fixed binary point */
  245. #define FSCALE  (1<<FSHIFT)
  246.  
  247. /*
  248.  * Maximum size of hostname recognized and stored in the kernel.
  249.  */
  250. #define MAXHOSTNAMELEN  64
  251.  
  252. /* EOF param.h */
  253.