kernel: some boottime sanitychecks
[minix.git] / include / sys / param.h
blobb750a3ecf215ba5502c3ca3aea51896762e4b654
1 #ifndef _SYS_PARAM_H_
2 #define _SYS_PARAM_H_
4 /*
5 * Historic BSD #defines -- probably will remain untouched for all time.
6 */
7 #define BSD 199506 /* System version (year & month). */
8 #define BSD4_3 1
9 #ifndef __minix
10 #define BSD4_4 1
11 #endif
14 * #define __NetBSD_Version__ MMmmrrpp00
16 * M = major version
17 * m = minor version; a minor number of 99 indicates current.
18 * r = 0 (*)
19 * p = patchlevel
21 * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local
22 * needs to be updated and the changes sent back to the groff maintainers.
24 * (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric
25 * e.g. NetBSD-1.2D = 102040000 ('D' == 4)
26 * NetBSD-2.0H (200080000) was changed on 20041001 to:
27 * 2.99.9 (299000900)
30 #define __NetBSD_Version__ 599002900 /* NetBSD 5.99.29 */
32 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
33 (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
36 * Historical NetBSD #define
38 * NetBSD 1.4 was the last release for which this value was incremented.
39 * The value is now permanently fixed at 199905. It will never be
40 * changed again.
42 * New code must use __NetBSD_Version__ instead, and should not even
43 * count on NetBSD being defined.
47 #define NetBSD 199905 /* NetBSD version (year & month). */
49 #include <sys/null.h>
51 #ifndef __ASSEMBLER__
52 #include <sys/inttypes.h>
53 #include <sys/types.h>
56 * Machine-independent constants (some used in following include files).
57 * Redefined constants are from POSIX 1003.1 limits file.
59 * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
60 * MAXHOSTNAMELEN should be >= (_POSIX_HOST_NAME_MAX + 1) (see <limits.h>)
61 * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
63 #include <sys/syslimits.h>
66 #define MAXCOMLEN 16 /* max command name remembered */
67 #define MAXINTERP PATH_MAX /* max interpreter file name length */
68 /* DEPRECATED: use LOGIN_NAME_MAX instead. */
69 #define MAXLOGNAME (LOGIN_NAME_MAX - 1) /* max login name length */
70 #ifndef __minix
71 #define NCARGS ARG_MAX /* max bytes for an exec function */
72 #endif
73 #define NGROUPS NGROUPS_MAX /* max number groups */
74 #define NOGROUP 65535 /* marker for empty group set member */
76 #define MAXHOSTNAMELEN 256 /* max hostname size */
78 #ifndef NOFILE
79 #define NOFILE OPEN_MAX /* max open files per process */
80 #endif
81 #ifndef MAXUPRC /* max simultaneous processes */
82 #define MAXUPRC CHILD_MAX /* POSIX 1003.1-compliant default */
83 #else
84 #if (MAXUPRC - 0) < CHILD_MAX
85 #error MAXUPRC less than CHILD_MAX. See options(4) for details.
86 #endif /* (MAXUPRC - 0) < CHILD_MAX */
87 #endif /* !defined(MAXUPRC) */
89 /* Signals. */
90 #include <sys/signal.h>
92 /* Machine type dependent parameters. */
93 #include <machine/param.h>
94 #include <machine/limits.h>
96 /* pages ("clicks") to disk blocks */
97 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
98 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
100 /* bytes to pages */
101 #define ctob(x) ((x) << PGSHIFT)
102 #define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
104 /* bytes to disk blocks */
105 #define dbtob(x) ((x) << DEV_BSHIFT)
106 #define btodb(x) ((x) >> DEV_BSHIFT)
108 #ifndef COHERENCY_UNIT
109 #define COHERENCY_UNIT 64
110 #endif
111 #ifndef CACHE_LINE_SIZE
112 #define CACHE_LINE_SIZE 64
113 #endif
114 #ifndef MAXCPUS
115 #define MAXCPUS 32
116 #endif
117 #ifndef MAX_LWP_PER_PROC
118 #define MAX_LWP_PER_PROC 8000
119 #endif
122 * Miscellaneous.
124 #define NBPW sizeof(int) /* number of bytes per word (integer) */
126 #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
127 #define NODEV (dev_t)(-1) /* non-existent device */
129 #define CBLOCK 64 /* Clist block size, must be a power of 2. */
130 #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
131 /* Data chars/clist. */
132 #define CBSIZE (CBLOCK - (int)sizeof(struct cblock *) - CBQSIZE)
133 #define CROUND (CBLOCK - 1) /* Clist rounding. */
136 * File system parameters and macros.
138 * The file system is made out of blocks of at most MAXBSIZE units, with
139 * smaller units (fragments) only in the last direct block. MAXBSIZE
140 * primarily determines the size of buffers in the buffer pool. It may be
141 * made larger without any effect on existing file systems; however making
142 * it smaller may make some file systems unmountable.
144 #ifndef MAXBSIZE /* XXX */
145 #define MAXBSIZE MAXPHYS
146 #endif
147 #define MAXFRAG 8
150 * MAXPATHLEN defines the longest permissible path length after expanding
151 * symbolic links. It is used to allocate a temporary buffer from the buffer
152 * pool in which to do the name expansion, hence should be a power of two,
153 * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
154 * maximum number of symbolic links that may be expanded in a path name.
155 * It should be set high enough to allow all legitimate uses, but halt
156 * infinite loops reasonably quickly.
158 * MAXSYMLINKS should be >= _POSIX_SYMLOOP_MAX (see <limits.h>)
160 #define MAXPATHLEN PATH_MAX
161 #define MAXSYMLINKS 32
163 /* Bit map related macros. */
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)
169 /* Macros for counting and rounding. */
170 #ifndef howmany
171 #define howmany(x, y) (((x)+((y)-1))/(y))
172 #endif
173 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
174 #define rounddown(x,y) (((x)/(y))*(y))
175 #define roundup2(x, m) (((x) + (m) - 1) & ~((m) - 1))
176 #define powerof2(x) ((((x)-1)&(x))==0)
178 /* Macros for min/max. */
179 #define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b))
180 #define MAX(a,b) ((/*CONSTCOND*/(a)>(b))?(a):(b))
182 #endif /* !__ASSEMBLER__ */
184 #endif /* !_SYS_PARAM_H_ */