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