| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD 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 | * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is |
| 15 | * required for the NUL. TODO: Test? |
| 16 | * NOTE: PATH_MAX is the POSIX equivalent for Microsoft's MAX_PATH; the two |
| 17 | * are semantically identical, with a limit of 259 characters for the |
| 18 | * path name, plus one for a terminating NUL, for a total of 260. |
| 19 | */ |
| 20 | #define PATH_MAX	260 |
| 21 | |
| 22 | #define CHAR_BIT 8 |
| 23 | #define SCHAR_MIN (-128) |
| 24 | #define SCHAR_MAX 127 |
| 25 | #define UCHAR_MAX 0xff |
| 26 | |
| 27 | #ifdef __CHAR_UNSIGNED__ |
| 28 | #define CHAR_MIN 0 |
| 29 | #define CHAR_MAX UCHAR_MAX |
| 30 | #else |
| 31 | #define CHAR_MIN SCHAR_MIN |
| 32 | #define CHAR_MAX SCHAR_MAX |
| 33 | #endif |
| 34 | |
| 35 | #define MB_LEN_MAX 5 |
| 36 | #define SHRT_MIN (-32768) |
| 37 | #define SHRT_MAX 32767 |
| 38 | #define USHRT_MAX 0xffffU |
| 39 | #define INT_MIN (-2147483647 - 1) |
| 40 | #define INT_MAX 2147483647 |
| 41 | #define UINT_MAX 0xffffffffU |
| 42 | #define LONG_MIN (-2147483647L - 1) |
| 43 | #define LONG_MAX 2147483647L |
| 44 | #define ULONG_MAX 0xffffffffUL |
| 45 | #define LLONG_MAX 9223372036854775807ll |
| 46 | #define LLONG_MIN (-9223372036854775807ll - 1) |
| 47 | #define ULLONG_MAX 0xffffffffffffffffull |
| 48 | |
| 49 | #define _I8_MIN (-127 - 1) |
| 50 | #define _I8_MAX 127 |
| 51 | #define _UI8_MAX 0xffu |
| 52 | |
| 53 | #define _I16_MIN (-32767 - 1) |
| 54 | #define _I16_MAX 32767 |
| 55 | #define _UI16_MAX 0xffffu |
| 56 | |
| 57 | #define _I32_MIN (-2147483647 - 1) |
| 58 | #define _I32_MAX 2147483647 |
| 59 | #define _UI32_MAX 0xffffffffu |
| 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 | #define _I64_MIN (-9223372036854775807ll - 1) |
| 71 | #define _I64_MAX 9223372036854775807ll |
| 72 | #define _UI64_MAX 0xffffffffffffffffull |
| 73 | |
| 74 | #ifndef SIZE_MAX |
| 75 | #ifdef _WIN64 |
| 76 | #define SIZE_MAX _UI64_MAX |
| 77 | #else |
| 78 | #define SIZE_MAX UINT_MAX |
| 79 | #endif |
| 80 | #endif |
| 81 | |
| 82 | #ifndef SSIZE_MAX |
| 83 | #ifdef _WIN64 |
| 84 | #define SSIZE_MAX _I64_MAX |
| 85 | #else |
| 86 | #define SSIZE_MAX INT_MAX |
| 87 | #endif |
| 88 | #endif |
| 89 | |
| 90 | #ifdef _POSIX_ |
| 91 | #define _POSIX_ARG_MAX 4096 |
| 92 | #define _POSIX_CHILD_MAX 6 |
| 93 | #define _POSIX_LINK_MAX 8 |
| 94 | #define _POSIX_MAX_CANON 255 |
| 95 | #define _POSIX_MAX_INPUT 255 |
| 96 | #define _POSIX_NAME_MAX 14 |
| 97 | #define _POSIX_NGROUPS_MAX 0 |
| 98 | #define _POSIX_OPEN_MAX 16 |
| 99 | #define _POSIX_PATH_MAX 255 |
| 100 | #define _POSIX_PIPE_BUF 512 |
| 101 | #define _POSIX_SSIZE_MAX 32767 |
| 102 | #define _POSIX_STREAM_MAX 8 |
| 103 | #define _POSIX_TZNAME_MAX 3 |
| 104 | #define ARG_MAX 14500 |
| 105 | #define LINK_MAX 1024 |
| 106 | #define MAX_CANON _POSIX_MAX_CANON |
| 107 | #define MAX_INPUT _POSIX_MAX_INPUT |
| 108 | #define NAME_MAX 255 |
| 109 | #define NGROUPS_MAX 16 |
| 110 | #define OPEN_MAX 32 |
| 111 | #undef PATH_MAX |
| 112 | #define PATH_MAX 512 |
| 113 | #define PIPE_BUF _POSIX_PIPE_BUF |
| 114 | /*#define SSIZE_MAX _POSIX_SSIZE_MAX*/ |
| 115 | #define STREAM_MAX 20 |
| 116 | #define TZNAME_MAX 10 |
| 117 | #endif |
| 118 | |
| 119 | #endif /* _INC_LIMITS */ |