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