[BASESRV-CONSRV-WINSRV]
[reactos.git] / include / crt / limits.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #include <crtdefs.h>
7
8 #ifndef _INC_LIMITS
9 #define _INC_LIMITS
10
11 /*
12 * File system limits
13 *
14 * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
15 * same as FILENAME_MAX and FOPEN_MAX from stdio.h?
16 * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is
17 * required for the NUL. TODO: Test?
18 */
19 #define PATH_MAX (259)
20
21 #define CHAR_BIT 8
22 #define SCHAR_MIN (-128)
23 #define SCHAR_MAX 127
24 #define UCHAR_MAX 0xff
25
26 #define CHAR_MIN SCHAR_MIN
27 #define CHAR_MAX SCHAR_MAX
28
29 #define MB_LEN_MAX 5
30 #define SHRT_MIN (-32768)
31 #define SHRT_MAX 32767
32 #define USHRT_MAX 0xffff
33 #define INT_MIN (-2147483647 - 1)
34 #define INT_MAX 2147483647
35 #define UINT_MAX 0xffffffff
36 #define LONG_MIN (-2147483647L - 1)
37 #define LONG_MAX 2147483647L
38 #define ULONG_MAX 0xffffffffUL
39 #define LLONG_MAX 9223372036854775807ll
40 #define LLONG_MIN (-9223372036854775807ll - 1)
41 #define ULLONG_MAX 0xffffffffffffffffull
42
43 #if _INTEGRAL_MAX_BITS >= 8
44 #define _I8_MIN (-127 - 1)
45 #define _I8_MAX 127i8
46 #define _UI8_MAX 0xffu
47 #endif
48
49 #if _INTEGRAL_MAX_BITS >= 16
50 #define _I16_MIN (-32767 - 1)
51 #define _I16_MAX 32767i16
52 #define _UI16_MAX 0xffffu
53 #endif
54
55 #if _INTEGRAL_MAX_BITS >= 32
56 #define _I32_MIN (-2147483647 - 1)
57 #define _I32_MAX 2147483647
58 #define _UI32_MAX 0xffffffffu
59 #endif
60
61 #if defined(__GNUC__)
62 #undef LONG_LONG_MAX
63 #define LONG_LONG_MAX 9223372036854775807ll
64 #undef LONG_LONG_MIN
65 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
66 #undef ULONG_LONG_MAX
67 #define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull)
68 #endif
69
70 #if _INTEGRAL_MAX_BITS >= 64
71 #define _I64_MIN (-9223372036854775807ll - 1)
72 #define _I64_MAX 9223372036854775807ll
73 #define _UI64_MAX 0xffffffffffffffffull
74 #endif
75
76 #ifndef SIZE_MAX
77 #ifdef _WIN64
78 #define SIZE_MAX _UI64_MAX
79 #else
80 #define SIZE_MAX UINT_MAX
81 #endif
82 #endif
83
84 #ifdef _POSIX_
85 #define _POSIX_ARG_MAX 4096
86 #define _POSIX_CHILD_MAX 6
87 #define _POSIX_LINK_MAX 8
88 #define _POSIX_MAX_CANON 255
89 #define _POSIX_MAX_INPUT 255
90 #define _POSIX_NAME_MAX 14
91 #define _POSIX_NGROUPS_MAX 0
92 #define _POSIX_OPEN_MAX 16
93 #define _POSIX_PATH_MAX 255
94 #define _POSIX_PIPE_BUF 512
95 #define _POSIX_SSIZE_MAX 32767
96 #define _POSIX_STREAM_MAX 8
97 #define _POSIX_TZNAME_MAX 3
98 #define ARG_MAX 14500
99 #define LINK_MAX 1024
100 #define MAX_CANON _POSIX_MAX_CANON
101 #define MAX_INPUT _POSIX_MAX_INPUT
102 #define NAME_MAX 255
103 #define NGROUPS_MAX 16
104 #define OPEN_MAX 32
105 #define PATH_MAX 512
106 #define PIPE_BUF _POSIX_PIPE_BUF
107 #define SSIZE_MAX _POSIX_SSIZE_MAX
108 #define STREAM_MAX 20
109 #define TZNAME_MAX 10
110 #endif
111 #endif