OSDN Git Service

Merge branch 'master' of git://github.com/monaka/binutils
[pf3gnuchains/pf3gnuchains3x.git] / winsup / cygwin / include / limits.h
1 /* limits.h
2
3    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4    2008 Red Hat, Inc.
5
6 This file is part of Cygwin.
7
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
10 details. */
11
12 #ifndef _LIMITS_H___
13
14 #include <features.h>
15
16 #ifndef _MACH_MACHLIMITS_H_
17
18 /* _MACH_MACHLIMITS_H_ is used on OSF/1.  */
19 #define _LIMITS_H___
20 #define _MACH_MACHLIMITS_H_
21
22
23 /* Numerical limits */
24
25 /* Number of bits in a `char'.  */
26 #undef CHAR_BIT
27 #define CHAR_BIT 8
28
29 /* Maximum length of a multibyte character.  */
30 #ifndef MB_LEN_MAX
31 /* TODO: This is newlib's max value.  We should probably rather define our
32    own _mbtowc_r and _wctomb_r functions which are only codepage dependent. */
33 #define MB_LEN_MAX 8
34 #endif
35
36 /* Minimum and maximum values a `signed char' can hold.  */
37 #undef SCHAR_MIN
38 #define SCHAR_MIN (-128)
39 #undef SCHAR_MAX
40 #define SCHAR_MAX 127
41
42 /* Maximum value an `unsigned char' can hold.  (Minimum is 0).  */
43 #undef UCHAR_MAX
44 #define UCHAR_MAX 255
45
46 /* Minimum and maximum values a `char' can hold.  */
47 #ifdef __CHAR_UNSIGNED__
48 #undef CHAR_MIN
49 #define CHAR_MIN 0
50 #undef CHAR_MAX
51 #define CHAR_MAX 255
52 #else
53 #undef CHAR_MIN
54 #define CHAR_MIN (-128)
55 #undef CHAR_MAX
56 #define CHAR_MAX 127
57 #endif
58
59 /* Minimum and maximum values a `signed short int' can hold.  */
60 #undef SHRT_MIN
61 #define SHRT_MIN (-32768)
62 #undef SHRT_MAX
63 #define SHRT_MAX 32767
64
65 /* Maximum value an `unsigned short int' can hold.  (Minimum is 0).  */
66 #undef USHRT_MAX
67 #define USHRT_MAX 65535
68
69 /* Minimum and maximum values a `signed int' can hold.  */
70 #ifndef __INT_MAX__
71 #define __INT_MAX__ 2147483647
72 #endif
73 #undef INT_MIN
74 #define INT_MIN (-INT_MAX-1)
75 #undef INT_MAX
76 #define INT_MAX __INT_MAX__
77
78 /* Maximum value an `unsigned int' can hold.  (Minimum is 0).  */
79 #undef UINT_MAX
80 #define UINT_MAX (INT_MAX * 2U + 1)
81
82 /* Minimum and maximum values a `signed long int' can hold.
83    (Same as `int').  */
84 #ifndef __LONG_MAX__
85 #ifndef __alpha__
86 #define __LONG_MAX__ 2147483647L
87 #else
88 #define __LONG_MAX__ 9223372036854775807L
89 # endif /* __alpha__ */
90 #endif
91 #undef LONG_MIN
92 #define LONG_MIN (-LONG_MAX-1)
93 #undef LONG_MAX
94 #define LONG_MAX __LONG_MAX__
95
96 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0).  */
97 #undef ULONG_MAX
98 #define ULONG_MAX (LONG_MAX * 2UL + 1)
99
100 /* Minimum and maximum values a `signed long long int' can hold.  */
101 #ifndef __LONG_LONG_MAX__
102 #define __LONG_LONG_MAX__ 9223372036854775807LL
103 #endif
104
105 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
106 #undef LONG_LONG_MIN
107 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
108 #undef LONG_LONG_MAX
109 #define LONG_LONG_MAX __LONG_LONG_MAX__
110
111 /* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
112 #undef ULONG_LONG_MAX
113 #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
114 #endif
115
116 /* Minimum and maximum values a `signed long long int' can hold.  */
117 #undef LLONG_MIN
118 #define LLONG_MIN (-LLONG_MAX-1)
119 #undef LLONG_MAX
120 #define LLONG_MAX __LONG_LONG_MAX__
121
122 /* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
123 #undef ULLONG_MAX
124 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
125
126 /* Maximum size of ssize_t */
127 #undef SSIZE_MAX
128 #define SSIZE_MAX (__LONG_MAX__)
129
130
131 /* Runtime Invariant Values */
132
133 /* Please note that symbolic names shall be ommited, on specific
134    implementations where the corresponding value is equal to or greater
135    than the stated minimum, but is unspecified.  This indetermination
136    might depend on the amount of available memory space on a specific
137    instance of a specific implementation. The actual value supported by
138    a specific instance shall be provided by the sysconf() function. */
139
140 /* Maximum number of I/O operations in a single list I/O call supported by
141    the implementation.  Not yet implemented. */
142 #undef AIO_LISTIO_MAX
143 /* #define AIO_LISTIO_MAX >= _POSIX_AIO_LISTIO_MAX */
144
145 /* Maximum number of outstanding asynchronous I/O operations supported by
146    the implementation.  Not yet implemented. */
147 #undef AIO_MAX
148 /*  #define AIO_MAX >= _POSIX_AIO_MAX */
149
150 /* The maximum amount by which a process can decrease its asynchronous I/O
151    priority level from its own scheduling priority. */
152 #undef AIO_PRIO_DELTA_MAX
153 /* #define AIO_PRIO_DELTA_MAX >= 0 */
154
155 /* Maximum number of bytes in arguments and environment passed in an exec
156    call.  32000 is the safe value used for Windows processes when called
157    from Cygwin processes. */
158 #undef ARG_MAX
159 #define ARG_MAX 32000
160
161 /* Maximum number of functions that may be registered with atexit(). */
162 #undef ATEXIT_MAX
163 #define ATEXIT_MAX 32
164
165 /* Maximum number of simultaneous processes per real user ID. */
166 #undef CHILD_MAX
167 #define CHILD_MAX 256
168
169 /* Maximum number of timer expiration overruns.  Not yet implemented. */
170 #undef DELAYTIMER_MAX
171 /* #define DELAYTIMER_MAX >= _POSIX_DELAYTIMER_MAX */
172
173 /* Maximum length of a host name. */
174 #undef HOST_NAME_MAX
175 #define HOST_NAME_MAX 255
176
177 /* Maximum number of iovcnt in a writev (an arbitrary number) */
178 #undef IOV_MAX
179 #define IOV_MAX 1024
180
181 /* Maximum number of characters in a login name. */
182 #undef LOGIN_NAME_MAX
183 #define LOGIN_NAME_MAX 256      /* equal to UNLEN defined in w32api/lmcons.h */
184
185 /* The maximum number of open message queue descriptors a process may hold. */
186 #undef MQ_OPEN_MAX
187 #define MQ_OPEN_MAX OPEN_MAX
188
189 /* The maximum number of message priorities supported by the implementation. */
190 #undef MQ_PRIO_MAX
191 #define MQ_PRIO_MAX INT_MAX
192
193 /* # of open files per process. Actually it can be more since Cygwin
194    grows the dtable as necessary. We define a reasonable limit here
195    which is returned by getdtablesize(), sysconf(_SC_OPEN_MAX) and
196    getrlimit(RLIMIT_NOFILE). */
197 #undef OPEN_MAX
198 #define OPEN_MAX 256
199
200 /* Size in bytes of a page. */
201 #undef PAGESIZE
202 #undef PAGE_SIZE
203 #define PAGESIZE 65536
204 #define PAGE_SIZE PAGESIZE
205
206 /* Maximum number of attempts made to destroy a thread's thread-specific
207    data values on thread exit. */
208 /* FIXME: I really don't understand this value.  Why should multiple
209    attempts be necessary to destroy thread-specific data?!?  Anyway, the
210    current value here is 1, taken originally from our pthread.h file,
211    where it was mistakenly defined first.  Unfortunately this value is
212    lower than the POSIX defined minimum value, which is 4. */
213 #undef PTHREAD_DESTRUCTOR_ITERATIONS
214 #define PTHREAD_DESTRUCTOR_ITERATIONS 1
215
216 /* Maximum number of data keys that can be created by a process. */
217 /* Tls has 64 items for pre win2000 - and we don't want to use them all :] */
218 #undef PTHREAD_KEYS_MAX
219 #define PTHREAD_KEYS_MAX 32
220
221 /* Minimum size in bytes of thread stack storage. */
222 /* Actually the minimum stack size is somewhat of a split personality.
223    The size parameter in a CreateThread call is the size of the initially
224    commited stack size, which can be specified as low as 4K.  However, the
225    default *reserved* stack size is 1 Meg, unless the .def file specifies
226    another STACKSIZE value.  And even if you specify a stack size below 64K,
227    the allocation granularity is in the way.  You can never squeeze multiple
228    threads in the same allocation granularity slot.  Oh well. */
229 #undef PTHREAD_STACK_MIN
230 #define PTHREAD_STACK_MIN 65536
231
232 /* Maximum number of threads that can be created per process. */
233 /* Windows allows any arbitrary number of threads per process. */
234 #undef PTHREAD_THREADS_MAX
235 /* #define PTHREAD_THREADS_MAX unspecified */
236
237 /* Maximum number of realtime signals reserved for application use. */
238 /* FIXME: We only support one realtime signal but _POSIX_RTSIG_MAX is 8. */
239 #undef RTSIG_MAX
240 #define RTSIG_MAX 1
241
242 /* Maximum number of semaphores that a process may have. */
243 /* Windows allows any arbitrary number of semaphores per process. */
244 #undef SEM_NSEMS_MAX
245 /* #define SEM_NSEMS_MAX unspecified */
246
247 /* The maximum value a semaphore may have. */
248 #undef SEM_VALUE_MAX
249 #define SEM_VALUE_MAX 1147483648
250
251 /* Maximum number of queued signals that a process may send and have pending
252    at the receiver(s) at any time. */
253 #undef SIGQUEUE_MAX
254 #define SIGQUEUE_MAX 32
255
256 /* The maximum number of replenishment operations that may be simultaneously
257    pending for a particular sporadic server scheduler.  Not implemented. */
258 #undef SS_REPL_MAX
259 /* #define SS_REPL_MAX >= _POSIX_SS_REPL_MAX */
260
261 /* Number of streams that one process can have open at one time. */
262 #undef STREAM_MAX
263 #define STREAM_MAX 20
264
265 /* Maximum number of nested symbolic links. */
266 #undef SYMLOOP_MAX
267 #define SYMLOOP_MAX 10
268
269 /* Maximum number of timer expiration overruns. */
270 #undef TIMER_MAX
271 #define TIMER_MAX 32
272
273 /* Maximum length of the trace event name.  Not implemented. */
274 #undef TRACE_EVENT_NAME_MAX
275 /* #define TRACE_EVENT_NAME_MAX >= _POSIX_TRACE_EVENT_NAME_MAX */
276
277 /* Maximum length of the trace generation version string or of the trace
278    stream name.  Not implemented. */
279 #undef TRACE_NAME_MAX
280 /* #define TRACE_NAME_MAX >= _POSIX_TRACE_NAME_MAX */
281
282 /* Maximum number of trace streams that may simultaneously exist in the
283    system.  Not implemented. */
284 #undef TRACE_SYS_MAX
285 /* #define TRACE_SYS_MAX >= _POSIX_TRACE_SYS_MAX */
286
287 /* Maximum number of user trace event type identifiers that may simultaneously
288    exist in a traced process, including the predefined user trace event
289    POSIX_TRACE_UNNAMED_USER_EVENT.  Not implemented. */
290 #undef TRACE_USER_EVENT_MAX
291 /* #define TRACE_USER_EVENT_MAX >= _POSIX_TRACE_USER_EVENT_MAX */
292
293 /* Maximum number of characters in a tty name. */
294 #undef TTY_NAME_MAX
295 #define TTY_NAME_MAX 32
296
297 /* Maximum number of bytes supported for the name of a timezone (not of the TZ variable).  Not implemented. */
298 #undef TZNAME_MAX
299 /* #define TZNAME_MAX >= _POSIX_TZNAME_MAX */
300
301
302 /* Pathname Variable Values */
303
304 /* Minimum bits needed to represent the maximum size of a regular file. */
305 #undef FILESIZEBITS
306 #define FILESIZEBITS 64
307
308 /* Maximum number of hardlinks to a file. */
309 #undef LINK_MAX
310 #define LINK_MAX 1024
311
312 /* Maximum number of bytes in a terminal canonical input line. */
313 #undef MAX_CANON
314 #define MAX_CANON 255
315
316 /* Minimum number of bytes available in a terminal input queue. */
317 #undef MAX_INPUT
318 #define MAX_INPUT 255
319
320 /* Maximum length of a path component. */
321 #undef NAME_MAX
322 #define NAME_MAX 255
323
324 /* Maximum length of a path given to API functions including trailing NUL.
325    Deliberately set to the same default value as on Linux.  Internal paths
326    may be longer. */
327 /* Keep in sync with __PATHNAME_MAX__ in cygwin/config.h */
328 #undef PATH_MAX
329 #define PATH_MAX 4096
330
331 /* # of bytes in a pipe buf. This is the max # of bytes which can be
332    written to a pipe in one atomic operation. */
333 #undef PIPE_BUF
334 #define PIPE_BUF 4096
335
336 /* Minimum number of bytes of storage actually allocated for any portion
337    of a file.  Not implemented. */
338 #undef POSIX_ALLOC_SIZE_MIN
339 /* #define POSIX_ALLOC_SIZE_MIN unspecifed */
340
341 /* Recommended increment for file transfer sizes between the
342    {POSIX_REC_MIN_XFER_SIZE} and {POSIX_REC_MAX_XFER_SIZE} values.
343    Not implemented. */
344 #undef POSIX_REC_INCR_XFER_SIZE
345 /* #define POSIX_REC_INCR_XFER_SIZE unspecifed */
346
347 /* Maximum recommended file transfer size.  Not implemented. */
348 #undef POSIX_REC_MAX_XFER_SIZE
349 /* #define POSIX_REC_MAX_XFER_SIZE unspecifed */
350
351 /* Minimum recommended file transfer size.  Not implemented. */
352 #undef POSIX_REC_MIN_XFER_SIZE
353 /* #define POSIX_REC_MIN_XFER_SIZE unspecifed */
354
355 /* Recommended file transfer buffer alignment.  Not implemented. */
356 #undef POSIX_REC_XFER_ALIGN
357 /* #define POSIX_REC_XFER_ALIGN unspecifed */
358
359 /* Maximum number of bytes in a symbolic link. */
360 #undef SYMLINK_MAX
361 #define SYMLINK_MAX (PATH_MAX - 1)
362
363
364 /* Runtime Increasable Values */
365
366 /* Maximum obase values allowed by the bc utility. */
367 #undef BC_BASE_MAX
368 #define BC_BASE_MAX 99
369
370 /* Maximum number of elements permitted in an array by the bc utility. */
371 #undef BC_DIM_MAX
372 #define BC_DIM_MAX 2048
373
374 /* Maximum scale value allowed by the bc utility. */
375 #undef BC_SCALE_MAX
376 #define BC_SCALE_MAX 99
377
378 /* Maximum length of a string constant accepted by the bc utility. */
379 #undef BC_STRING_MAX
380 #define BC_STRING_MAX 1000
381
382 /* Maximum number of bytes in a character class name.  Not implemented. */
383 #undef CHARCLASS_NAME_MAX
384 /* #define CHARCLASS_NAME_MAX >= _POSIX2_CHARCLASS_NAME_MAX */
385
386 /* Maximum number of weights that can be assigned to an entry of the
387    LC_COLLATE order keyword in the locale definition file. */
388 /* FIXME: We don't support this at all right now, so this value is
389    misleading at best.  It's also lower than _POSIX2_COLL_WEIGHTS_MAX
390    which is not good.  So, for now we deliberately not define it even
391    though it was defined in the former syslimits.h file. */
392 #undef COLL_WEIGHTS_MAX
393 /* #define COLL_WEIGHTS_MAX >= _POSIX2_COLL_WEIGHTS_MAX */
394
395 /* Maximum number of expressions that can be nested within parentheses
396    by the expr utility. */
397 #undef EXPR_NEST_MAX
398 #define EXPR_NEST_MAX 32
399
400 /* Maximum bytes of a text utility's input line */
401 #undef LINE_MAX
402 #define LINE_MAX 2048
403
404 /* Max num groups for a user, value taken from NT documentation */
405 /* Must match <sys/param.h> NGROUPS */
406 #undef NGROUPS_MAX
407 #define NGROUPS_MAX 1024
408
409 /* Maximum number of repeated occurrences of a regular expression when
410    using the interval notation \{m,n\} */
411 #undef RE_DUP_MAX
412 #define RE_DUP_MAX 255
413
414
415 /* POSIX values */
416 /* These should never vary from one system type to another */
417 /* They represent the minimum values that POSIX systems must support.
418    POSIX-conforming apps must not require larger values. */
419
420 /* Maximum Values */
421
422 #define _POSIX_CLOCKRES_MIN                 20000000
423
424 /* Minimum Values */
425
426 #define _POSIX_AIO_LISTIO_MAX                      2
427 #define _POSIX_AIO_MAX                             1
428 #define _POSIX_ARG_MAX                          4096
429 #define _POSIX_CHILD_MAX                          25
430 #define _POSIX_DELAYTIMER_MAX                     32
431 #define _POSIX_HOST_NAME_MAX                     255
432 #define _POSIX_LINK_MAX                            8
433 #define _POSIX_LOGIN_NAME_MAX                      9
434 #define _POSIX_MAX_CANON                         255
435 #define _POSIX_MAX_INPUT                         255
436 #define _POSIX_MQ_OPEN_MAX                         8
437 #define _POSIX_MQ_PRIO_MAX                        32
438 #define _POSIX_NAME_MAX                           14
439 #define _POSIX_NGROUPS_MAX                         8
440 #define _POSIX_OPEN_MAX                           20
441 #define _POSIX_PATH_MAX                          256
442 #define _POSIX_PIPE_BUF                          512
443 #define _POSIX_RE_DUP_MAX                        255
444 #define _POSIX_RTSIG_MAX                           8
445 #define _POSIX_SEM_NSEMS_MAX                     256
446 #define _POSIX_SEM_VALUE_MAX                   32767
447 #define _POSIX_SIGQUEUE_MAX                       32
448 #define _POSIX_SSIZE_MAX                       32767
449 #define _POSIX_STREAM_MAX                          8
450 #define _POSIX_SS_REPL_MAX                         4
451 #define _POSIX_SYMLINK_MAX                       255
452 #define _POSIX_SYMLOOP_MAX                         8
453 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS        4
454 #define _POSIX_THREAD_KEYS_MAX                   128
455 #define _POSIX_THREAD_THREADS_MAX                 64
456 #define _POSIX_TIMER_MAX                          32
457 #define _POSIX_TRACE_EVENT_NAME_MAX               30
458 #define _POSIX_TRACE_NAME_MAX                      8
459 #define _POSIX_TRACE_SYS_MAX                       8
460 #define _POSIX_TRACE_USER_EVENT_MAX               32
461 #define _POSIX_TTY_NAME_MAX                        9
462 #define _POSIX_TZNAME_MAX                          6
463
464 #define _POSIX2_BC_BASE_MAX                       99
465 #define _POSIX2_BC_DIM_MAX                      2048
466 #define _POSIX2_BC_SCALE_MAX                      99
467 #define _POSIX2_BC_STRING_MAX                   1000
468 #define _POSIX2_COLL_WEIGHTS_MAX                   2
469 #define _POSIX2_EXPR_NEST_MAX                     32
470 #define _POSIX2_LINE_MAX                        2048
471 #define _POSIX2_RE_DUP_MAX                       255
472
473 #define _XOPEN_IOV_MAX                            16
474 #define _XOPEN_NAME_MAX                          255
475 #define _XOPEN_PATH_MAX                         1024
476
477 /* Other Invariant Values */
478
479 #define NL_ARGMAX                                  9
480 #define NL_LANGMAX                                14
481 #define NL_MSGMAX                              32767
482 #define NL_NMAX                              INT_MAX
483 #define NL_SETMAX                                255
484 #define NL_TEXTMAX                  _POSIX2_LINE_MAX
485
486 /* Default process priority. */
487 #undef NZERO
488 #define NZERO                                     20
489
490 #endif /* _MACH_MACHLIMITS_H_ */
491 #endif /* _LIMITS_H___ */