home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / sys / param.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  8.5 KB  |  313 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/sys/param.h.sl 1.1 4.0 12/08/90 52525 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35. #ifndef _SYS_PARAM_H
  36. #define _SYS_PARAM_H
  37.  
  38. /*
  39.  * Fundamental variables; don't change too often.
  40.  * 
  41.  * This file is included here for compatibility with
  42.  * SunOS, but it does *not* include all the values
  43.  * define in the SunOS version of this file.
  44.  */
  45.  
  46. #include <limits.h>
  47.  
  48. #ifndef _POSIX_VERSION
  49. #define _POSIX_VERSION    198808L
  50. #endif
  51.  
  52. #define UID_NOBODY    60001
  53. #define GID_NOBODY    60001
  54.  
  55. #define    MAXPID    30000        /* max process id */
  56. #define    MAXUID    60000        /* max user id */
  57. #define    MAXLINK    1000        /* max links */
  58.  
  59. /* The values below are defined in limits.h */
  60. #define NOFILE    OPEN_MAX    /* max open files per process */
  61.  
  62. #define    SSIZE    1        /* initial stack size (*2048 bytes) */
  63. #define    SINCR    1        /* increment of stack (*2048 bytes) */
  64. #define    USIZE    3        /* size of user block (*2048 bytes) */
  65. #ifdef i386
  66. #define    MAXUSIZE 18        /* max size of user block (*4096 bytes) */
  67. #endif
  68.  
  69. #define    CANBSIZ    256        /* max size of typewriter line    */
  70. #define    HZ    100        /* 100 ticks/second of the clock */
  71.  
  72. #define    NCARGS    5120        /* # characters in exec arglist */
  73.                 /*   must be multiple of NBPW.  */
  74. /*
  75.  * These define the maximum and minimum allowable values of the
  76.  * configurable parameter NGROUPS_MAX.
  77.  */
  78. #define    NGROUPS_UMAX    32
  79. #define    NGROUPS_UMIN    8
  80.  
  81. #define NGROUPS        NGROUPS_MAX    /* max number groups, from limits.h */
  82. #define NOGROUP        -1    /* marker for empty group set member */
  83.  
  84. /*
  85.  * The following defines apply to the kernel virtual address space.
  86.  */
  87.  
  88. /*
  89.  * The size of the kernel segment table in pages.  The starting address
  90.  * comes from the vuifile.
  91.  */
  92. #define    SYSSEGSZ 1024
  93.  
  94. #define    NS0SDE    0x120    /* number of kernel segments in section 0. */
  95. #define    NS1SDE    0x60    /* number of kernel segments in section 1. */
  96. #define    NS2SDE    0x0    /* number of kernel segments in section 2. */
  97. #define    NS3SDE    0x1    /* number of kernel segments in section 3. */
  98.  
  99. /*
  100.  * To avoid prefetch errors at the end of a region, it must
  101.  * be padded with the following number of bytes.
  102.  */
  103.     
  104. #define    PREFETCH    12
  105.  
  106. /*
  107.  * Priorities.  Should not be altered too much.
  108.  */
  109.  
  110. #define    PMASK    0177
  111. #define    PCATCH    0400
  112. #define    PNOSTOP    01000
  113. #define    PSWP    0
  114. #define    PINOD    10
  115. #define    PSNDD    PINOD
  116. #define    PRIBIO    20
  117. #define    PZERO    25
  118. #define PMEM    0
  119. #define    NZERO    20
  120. #define    PPIPE    26
  121. #define    PVFS    27
  122. #define    PWAIT    30
  123. #define    PSLEP    39
  124. #define    PUSER    60
  125. #define    PIDLE    127
  126.  
  127. /*
  128.  * Fundamental constants of the implementation--cannot be changed easily.
  129.  */
  130.  
  131. #define NBPS    0x20000        /* Number of bytes per segment */
  132. #define    NBPW    sizeof(int)    /* number of bytes in an integer */
  133. #define    NCPS    64        /* Number of clicks per segment */
  134. #define    CPSSHIFT    6    /* LOG2(NCPS) if exact */
  135. #define    NBPC    2048        /* Number of bytes per click */
  136. #define    BPCSHIFT    11    /* LOG2(NBPC) if exact */
  137. #define    NULL    0
  138. #define    CMASK    0        /* default mask for file creation */
  139. #define    CDLIMIT    (1L<<11)    /* default max write address */
  140. #define    NODEV    (dev_t)(-1)
  141. #define    NBPSCTR        512    /* Bytes per disk sector.    */
  142. #define    UBSIZE        512    /* unix block size.        */
  143. #define SCTRSHFT    9    /* Shift for BPSECT.        */
  144.  
  145. #define    UMODE    3        /* current Xlevel == user */
  146. #define    USERMODE(psw)    ((psw).CM == UMODE)
  147. #define    BASEPRI(psw)    ((psw).IPL > 8)
  148.  
  149. #define    lobyte(X)    (((unsigned char *)&(X))[1])
  150. #define    hibyte(X)    (((unsigned char *)&(X))[0])
  151. #define    loword(X)    (((ushort *)&(X))[1])
  152. #define    hiword(X)    (((ushort *)&(X))[0])
  153.  
  154. /*
  155.  *  Interrupt stack size in STKENT units
  156.  */
  157. #define QSTKSZ    1000
  158. #define ISTKSZ    1000
  159.  
  160. #define    MAXSUSE    255
  161.  
  162. /* REMOTE -- whether machine is primary, secondary, or regular */
  163. #define SYSNAME 9        /* # chars in system name */
  164. #define PREMOTE 39
  165.  
  166. /*
  167.  * MAXPATHLEN defines the longest permissible path length,
  168.  * including the terminating null, after expanding symbolic links.
  169.  * MAXSYMLINKS defines the maximum number of symbolic links
  170.  * that may be expanded in a path name. It should be set high
  171.  * enough to allow all legitimate uses, but halt infinite loops
  172.  * reasonably quickly.
  173.  * MAXNAMELEN is the length (including the terminating null) of
  174.  * the longest permissible file (component) name.
  175.  */
  176. #define    MAXPATHLEN    1024
  177. #define    MAXSYMLINKS    20
  178. #define    MAXNAMELEN    256
  179.  
  180. #ifndef NADDR
  181. #define NADDR 13
  182. #endif
  183.  
  184. /*
  185.  * The following are defined to be the same as
  186.  * defined in /usr/include/limits.h.  They are
  187.  * needed for pipe and FIFO compatibility.
  188.  */
  189. #ifndef PIPE_BUF    /* max # bytes atomic in write to a pipe */
  190. #ifdef u3b15
  191. #define PIPE_BUF    4096
  192. #else
  193. #define PIPE_BUF    5120
  194. #endif    /* u3b15 */
  195. #endif    /* PIPE_BUF */
  196.  
  197. #ifndef PIPE_MAX    /* max # bytes written to a pipe in a write */
  198. #ifdef u3b15
  199. #define PIPE_MAX    4096
  200. #else
  201. #define PIPE_MAX    5120
  202. #endif    /* u3b15 */
  203. #endif    /* PIPE_MAX */
  204.  
  205. #define PIPEBUF PIPE_BUF    /* pipe buffer size */
  206.  
  207. #define NBBY    8            /* number of bits per byte */
  208.  
  209. /*
  210.  * File system parameters and macros.
  211.  *
  212.  * The file system is made out of blocks of at most MAXBSIZE units,
  213.  * with smaller units (fragments) only in the last direct block.
  214.  * MAXBSIZE primarily determines the size of buffers in the buffer
  215.  * pool. It may be made larger without any effect on existing
  216.  * file systems; however making it smaller make make some file
  217.  * systems unmountable.
  218.  *
  219.  * Note that the blocked devices are assumed to have DEV_BSIZE
  220.  * "sectors" and that fragments must be some multiple of this size.
  221.  */
  222. #define    MAXBSIZE    8192
  223. #define    DEV_BSIZE    512
  224. #define    DEV_BSHIFT    9        /* log2(DEV_BSIZE) */
  225. #define    MAXFRAG     4
  226.  
  227. #define    btodb(bytes)             /* calculates (bytes / DEV_BSIZE) */ \
  228.     ((unsigned)(bytes) >> DEV_BSHIFT)
  229. #define    dbtob(db)            /* calculates (db * DEV_BSIZE) */ \
  230.     ((unsigned)(db) << DEV_BSHIFT)
  231.  
  232. /*
  233.  * MMU_PAGES* describes the physical page size used by the mapping hardware.
  234.  * PAGES* describes the logical page size used by the system.
  235.  */
  236.  
  237. #define    MMU_PAGESIZE    0x800        /* 2048 bytes */
  238. #define    MMU_PAGESHIFT    11        /* log2(MMU_PAGESIZE) */
  239. #define    MMU_PAGEOFFSET    (MMU_PAGESIZE-1)/* Mask of address bits in page */
  240. #define    MMU_PAGEMASK    (~MMU_PAGEOFFSET)
  241.  
  242. #define    PAGESIZE    0x800        /* All of the above, for logical */
  243. #define    PAGESHIFT    11
  244. #define    PAGEOFFSET    (PAGESIZE - 1)
  245. #define    PAGEMASK    (~PAGEOFFSET)
  246.  
  247. /*
  248.  * Some random macros for units conversion.
  249.  */
  250.  
  251. /*
  252.  * MMU pages to bytes, and back (with and without rounding)
  253.  */
  254. #define    mmu_ptob(x)    ((x) << MMU_PAGESHIFT)
  255. #define    mmu_btop(x)    (((unsigned)(x)) >> MMU_PAGESHIFT)
  256. #define    mmu_btopr(x)    ((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT))
  257.  
  258. /*
  259.  * pages to bytes, and back (with and without rounding)
  260.  */
  261. #define    ptob(x)        ((x) << PAGESHIFT)
  262. #define    btop(x)        (((unsigned)(x)) >> PAGESHIFT)
  263. #define    btopr(x)    ((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT))
  264.  
  265. #define shm_alignment    stob(1)        /* segment size */
  266.  
  267.  
  268. /*
  269.  * Signals 
  270.  */
  271. #include <sys/signal.h>
  272.  
  273.  
  274. #include <sys/types.h>
  275.  
  276. /*
  277.  * bit map related macros
  278.  */
  279. #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  280. #define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  281. #define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  282. #define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  283.  
  284. /*
  285.  * Macros for fast min/max.
  286.  */
  287. #ifndef MIN
  288. #define MIN(a,b) (((a)<(b))?(a):(b))
  289. #endif
  290. #ifndef MAX
  291. #define MAX(a,b) (((a)>(b))?(a):(b))
  292. #endif
  293.  
  294. #define howmany(x, y)   (((x)+((y)-1))/(y))
  295. #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
  296.  
  297. /*
  298.  * Scale factor for scaled integers used to count
  299.  * %cpu time and load averages.
  300.  */
  301. #define FSHIFT  8               /* bits to right of fixed binary point */
  302. #define FSCALE  (1<<FSHIFT)
  303.  
  304. /*
  305.  * Maximum size of hostname recognized and stored in the kernel.
  306.  * Same as in /usr/include/netdb.h
  307.  */
  308. #ifndef MAXHOSTNAMELEN
  309. #define MAXHOSTNAMELEN  64
  310. #endif
  311.  
  312. #endif    /* _SYS_PARAM_H */
  313.