Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/head/limits.h
+++ new/usr/src/head/limits.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2013 Gary Mills
24 24 *
25 25 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 * Copyright 2015 Joyent, Inc. All rights reserved.
28 28 */
29 29
30 30 /* Copyright (c) 1988 AT&T */
31 31 /* All Rights Reserved */
32 32
33 33
34 34 #ifndef _LIMITS_H
35 35 #define _LIMITS_H
36 36
37 37 #include <sys/feature_tests.h>
38 38 #include <sys/isa_defs.h>
39 39 #include <iso/limits_iso.h>
40 40 #include <sys/limits.h>
41 41
42 42 /*
43 43 * Include fixed width type limits as proposed by the ISO/JTC1/SC22/WG14 C
44 44 * committee's working draft for the revision of the current ISO C standard,
45 45 * ISO/IEC 9899:1990 Programming language - C. These are not currently
46 46 * required by any standard but constitute a useful, general purpose set
47 47 * of type definitions and limits which is namespace clean with respect to
48 48 * all standards.
49 49 */
50 50 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
51 51 defined(__XOPEN_OR_POSIX)
52 52 #include <sys/int_limits.h>
53 53 #endif
54 54
55 55 #ifdef __cplusplus
56 56 extern "C" {
57 57 #endif
58 58
59 59 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
60 60 defined(__XOPEN_OR_POSIX)
61 61
62 62 #define SSIZE_MAX LONG_MAX /* max value of an "ssize_t" */
63 63
64 64 /*
65 65 * ARG_MAX is calculated as follows:
66 66 * NCARGS - space for other stuff on initial stack
67 67 * like aux vectors, saved registers, etc..
68 68 */
69 69 #define _ARG_MAX32 1048320 /* max length of args to exec 32-bit program */
70 70 #define _ARG_MAX64 2096640 /* max length of args to exec 64-bit program */
71 71 #ifdef _LP64
72 72 #define ARG_MAX _ARG_MAX64 /* max length of arguments to exec */
73 73 #else /* _LP64 */
74 74 #define ARG_MAX _ARG_MAX32 /* max length of arguments to exec */
75 75 #endif /* _LP64 */
76 76
77 77 #ifndef MAX_CANON
78 78 #define MAX_CANON 256 /* max bytes in line for canonical processing */
79 79 #endif
80 80
81 81 #ifndef MAX_INPUT
82 82 #define MAX_INPUT 512 /* max size of a char input buffer */
83 83 #endif
84 84
85 85 #define NGROUPS_MAX 16 /* max number of groups for a user */
86 86
87 87 #ifndef PATH_MAX
88 88 #define PATH_MAX 1024 /* max # of characters in a path name */
89 89 #endif
90 90
91 91 #define SYMLINK_MAX 1024 /* max # of characters a symlink can contain */
92 92
93 93 #define PIPE_BUF 5120 /* max # bytes atomic in write to a pipe */
94 94
95 95 #ifndef TMP_MAX
96 96 #define TMP_MAX 17576 /* 26 * 26 * 26 */
97 97 #endif
98 98
99 99 /*
100 100 * POSIX conformant definitions - An implementation may define
101 101 * other symbols which reflect the actual implementation. Alternate
102 102 * definitions may not be as restrictive as the POSIX definitions.
103 103 */
104 104 #define _POSIX_AIO_LISTIO_MAX 2
105 105 #define _POSIX_AIO_MAX 1
106 106 #define _POSIX_ARG_MAX 4096
107 107 #ifdef _XPG6
108 108 #define _POSIX_CHILD_MAX 25
109 109 #else
110 110 #define _POSIX_CHILD_MAX 6 /* POSIX.1-1990 default */
111 111 #endif
112 112 #define _POSIX_CLOCKRES_MIN 20000000
113 113 #define _POSIX_DELAYTIMER_MAX 32
114 114 #define _POSIX_LINK_MAX 8
115 115 #define _POSIX_MAX_CANON 255
116 116 #define _POSIX_MAX_INPUT 255
117 117 #define _POSIX_MQ_OPEN_MAX 8
118 118 #define _POSIX_MQ_PRIO_MAX 32
119 119 #define _POSIX_NAME_MAX 14
120 120 #ifdef _XPG6
121 121 #define _POSIX_NGROUPS_MAX 8
122 122 #define _POSIX_OPEN_MAX 20
123 123 #define _POSIX_PATH_MAX 256
124 124 #else /* POSIX.1-1990 defaults */
125 125 #define _POSIX_NGROUPS_MAX 0
126 126 #define _POSIX_OPEN_MAX 16
127 127 #define _POSIX_PATH_MAX 255
128 128 #endif
129 129 #define _POSIX_PIPE_BUF 512
130 130 #define _POSIX_RTSIG_MAX 8
131 131 #define _POSIX_SEM_NSEMS_MAX 256
132 132 #define _POSIX_SEM_VALUE_MAX 32767
133 133 #define _POSIX_SIGQUEUE_MAX 32
134 134 #define _POSIX_SSIZE_MAX 32767
135 135 #define _POSIX_STREAM_MAX 8
136 136 #define _POSIX_TIMER_MAX 32
137 137 #ifdef _XPG6
138 138 #define _POSIX_TZNAME_MAX 6
139 139 #else
140 140 #define _POSIX_TZNAME_MAX 3 /* POSIX.1-1990 default */
141 141 #endif
142 142 /* POSIX.1c conformant */
143 143 #define _POSIX_LOGIN_NAME_MAX 9
144 144 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
145 145 #define _POSIX_THREAD_KEYS_MAX 128
146 146 #define _POSIX_THREAD_THREADS_MAX 64
147 147 #define _POSIX_TTY_NAME_MAX 9
148 148 /* UNIX 03 conformant */
149 149 #define _POSIX_HOST_NAME_MAX 255
150 150 #define _POSIX_RE_DUP_MAX 255
151 151 #define _POSIX_SYMLINK_MAX 255
152 152 #define _POSIX_SYMLOOP_MAX 8
153 153
154 154 /*
155 155 * POSIX.2 and XPG4-XSH4 conformant definitions
156 156 */
157 157
158 158 #define _POSIX2_BC_BASE_MAX 99
159 159 #define _POSIX2_BC_DIM_MAX 2048
160 160 #define _POSIX2_BC_SCALE_MAX 99
161 161 #define _POSIX2_BC_STRING_MAX 1000
162 162 #define _POSIX2_COLL_WEIGHTS_MAX 2
163 163 #define _POSIX2_EXPR_NEST_MAX 32
164 164 #define _POSIX2_LINE_MAX 2048
165 165 #define _POSIX2_RE_DUP_MAX 255
166 166 /* UNIX 03 conformant */
167 167 #define _POSIX2_CHARCLASS_NAME_MAX 14
168 168
169 169 #define BC_BASE_MAX _POSIX2_BC_BASE_MAX
170 170 #define BC_DIM_MAX _POSIX2_BC_DIM_MAX
171 171 #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX
172 172 #define BC_STRING_MAX _POSIX2_BC_STRING_MAX
173 173 #define COLL_WEIGHTS_MAX 10
174 174 #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX
175 175 #define LINE_MAX _POSIX2_LINE_MAX
176 176 #if !defined(_XPG6)
177 177 #define RE_DUP_MAX _POSIX2_RE_DUP_MAX
178 178 #else
179 179 #define RE_DUP_MAX _POSIX_RE_DUP_MAX
180 180 #endif /* !defined(_XPG6) */
181 181
182 182 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
183 183
184 184 #if defined(__EXTENSIONS__) || \
185 185 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
186 186 defined(_XOPEN_SOURCE)
187 187
188 188 /*
189 189 * For dual definitions for PASS_MAX and sysconf.c
190 190 */
191 191 #define _PASS_MAX_XPG 8 /* old standards PASS_MAX */
192 192 #define _PASS_MAX 256 /* modern Solaris PASS_MAX */
193 193
194 194 #if defined(_XPG3) && !defined(_XPG6)
195 195 #define PASS_MAX _PASS_MAX_XPG /* max # of characters in a password */
196 196 #else /* XPG6 or just Solaris */
197 197 #define PASS_MAX _PASS_MAX /* max # of characters in a password */
198 198 #endif /* defined(_XPG3) && !defined(_XPG6) */
199 199
200 200 #define CHARCLASS_NAME_MAX _POSIX2_CHARCLASS_NAME_MAX
201 201
202 202 #define NL_ARGMAX 9 /* max value of "digit" in calls to the */
203 203 /* NLS printf() and scanf() */
204 204 #define NL_LANGMAX 14 /* max # of bytes in a LANG name */
205 205 #define NL_MSGMAX 32767 /* max message number */
206 206 #define NL_NMAX 1 /* max # bytes in N-to-1 mapping characters */
207 207 #define NL_SETMAX 255 /* max set number */
208 208 #define NL_TEXTMAX 2048 /* max set number */
209 209 #define NZERO 20 /* default process priority */
210 210
211 211 #define WORD_BIT 32 /* # of bits in a "word" or "int" */
212 212 #if defined(_LP64)
213 213 #define LONG_BIT 64 /* # of bits in a "long" */
214 214 #else /* _ILP32 */
215 215 #define LONG_BIT 32 /* # of bits in a "long" */
216 216 #endif
217 217
218 218 /* Marked as LEGACY in SUSv2 and removed in UNIX 03 */
219 219 #ifndef _XPG6
220 220 #define DBL_DIG 15 /* digits of precision of a "double" */
221 221 #define DBL_MAX 1.7976931348623157081452E+308 /* max decimal value */
222 222 /* of a double */
223 223 #define FLT_DIG 6 /* digits of precision of a "float" */
224 224 #define FLT_MAX 3.4028234663852885981170E+38F /* max decimal value */
225 225 /* of a "float" */
226 226 #endif
227 227
228 228 /* Marked as LEGACY in SUSv1 and removed in SUSv2 */
229 229 #ifndef _XPG5
230 230 #define DBL_MIN 2.2250738585072013830903E-308 /* min decimal value */
231 231 /* of a double */
232 232 #define FLT_MIN 1.1754943508222875079688E-38F /* min decimal value */
233 233 /* of a float */
234 234 #endif
235 235
236 236 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
237 237
238 238 #define _XOPEN_IOV_MAX 16 /* max # iovec/process with readv()/writev() */
239 239 #define _XOPEN_NAME_MAX 255 /* max # bytes in filename excluding null */
240 240 #define _XOPEN_PATH_MAX 1024 /* max # bytes in a pathname */
241 241
242 242 #if defined(__EXTENSIONS__) || \
243 243 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
244 244
245 245 #define FCHR_MAX 1048576 /* max size of a file in bytes */
246 246 #define PID_MAX 999999 /* max value for a process ID */
247 247
248 248 /*
249 249 * POSIX 1003.1a, section 2.9.5, table 2-5 contains [NAME_MAX] and the
250 250 * related text states:
251 251 *
252 252 * A definition of one of the values from Table 2-5 shall be omitted from the
253 253 * <limits.h> on specific implementations where the corresponding value is
254 254 * equal to or greater than the stated minimum, but where the value can vary
255 255 * depending on the file to which it is applied. The actual value supported for
256 256 * a specific pathname shall be provided by the pathconf() (5.7.1) function.
257 257 *
258 258 * This is clear that any machine supporting multiple file system types
259 259 * and/or a network can not include this define, regardless of protection
260 260 * by the _POSIX_SOURCE and _POSIX_C_SOURCE flags.
261 261 *
262 262 * #define NAME_MAX 14
263 263 */
264 264
265 265 #define CHILD_MAX 25 /* max # of processes per user id */
266 266 #ifndef OPEN_MAX
267 267 #define OPEN_MAX 256 /* max # of files a process can have open */
268 268 #endif
269 269
270 270 #define PIPE_MAX 5120 /* max # bytes written to a pipe in a write */
271 271
272 272 #define STD_BLK 1024 /* # bytes in a physical I/O block */
273 273 #define UID_MAX 2147483647 /* max value for a user or group ID */
274 274 #define USI_MAX 4294967295 /* max decimal value of an "unsigned" */
275 275 #define SYSPID_MAX 1 /* max pid of system processes */
276 276
277 277 #ifndef SYS_NMLN /* also defined in sys/utsname.h */
278 278 #define SYS_NMLN 257 /* 4.0 size of utsname elements */
279 279 #endif
280 280
281 281 #ifndef CLK_TCK
282 282
283 283 #if !defined(_CLOCK_T) || __cplusplus >= 199711L
284 284 #define _CLOCK_T
285 285 typedef long clock_t;
286 286 #endif /* !_CLOCK_T */
287 287
288 288 extern long _sysconf(int); /* System Private interface to sysconf() */
289 289 #define CLK_TCK ((clock_t)_sysconf(3)) /* 3 is _SC_CLK_TCK */
290 290
291 291 #endif /* CLK_TCK */
292 292
293 293 #ifdef __USE_LEGACY_LOGNAME__
294 294 #define LOGNAME_MAX 8 /* max # of characters in a login name */
295 295 #else /* __USE_LEGACY_LOGNAME__ */
296 296 #define LOGNAME_MAX 32 /* max # of characters in a login name */
297 297 /* Increased for illumos */
298 298 #endif /* __USE_LEGACY_LOGNAME__ */
299 299 #define LOGIN_NAME_MAX (LOGNAME_MAX + 1) /* max buffer size */
300 300 #define LOGNAME_MAX_TRAD 8 /* traditional length */
301 301 #define LOGIN_NAME_MAX_TRAD (LOGNAME_MAX_TRAD + 1) /* and size */
302 302
303 303 #define TTYNAME_MAX 128 /* max # of characters in a tty name */
304 304
305 305 #endif /* if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
306 306
307 307 #if defined(__EXTENSIONS__) || (_POSIX_C_SOURCE >= 199506L)
308 308 #include <sys/unistd.h>
309 309
310 310 #if !defined(_SIZE_T) || __cplusplus >= 199711L
311 311 #define _SIZE_T
312 312 #if defined(_LP64) || defined(_I32LPx)
313 313 typedef unsigned long size_t; /* size of something in bytes */
314 314 #else
315 315 typedef unsigned int size_t; /* (historical version) */
316 316 #endif
317 317 #endif /* _SIZE_T */
318 318
319 319 extern long _sysconf(int); /* System Private interface to sysconf() */
320 320
321 321 #define PTHREAD_STACK_MIN ((size_t)_sysconf(_SC_THREAD_STACK_MIN))
322 322 /* Added for UNIX98 conformance */
323 323 #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
324 324 #define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
325 325 #define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
326 326 #endif /* defined(__EXTENSIONS__) || (_POSIX_C_SOURCE >= 199506L) */
327 327
328 328 #ifdef __cplusplus
329 329 }
330 330 #endif
331 331
332 332 #endif /* _LIMITS_H */
|
↓ open down ↓ |
332 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX