1 /* Copyright (c) 2002 Jeff Johnston <jjohnstn@redhat.com> */ 2 #ifndef _LIBC_LIMITS_H_ 3 # define _LIBC_LIMITS_H_ 1 4 5 #include <newlib.h> 6 #include <sys/cdefs.h> 7 #include <sys/syslimits.h> 8 9 # ifdef _MB_LEN_MAX 10 # define MB_LEN_MAX _MB_LEN_MAX 11 # else 12 # define MB_LEN_MAX 1 13 # endif 14 15 /* Maximum number of positional arguments, if _WANT_IO_POS_ARGS. */ 16 # ifndef NL_ARGMAX 17 # define NL_ARGMAX 32 18 # endif 19 20 /* if do not have #include_next support, then we 21 have to define the limits here. */ 22 # if !defined __GNUC__ || __GNUC__ < 2 23 24 # ifndef _LIMITS_H 25 # define _LIMITS_H 1 26 27 # include <sys/config.h> 28 29 /* Number of bits in a `char'. */ 30 # undef CHAR_BIT 31 # define CHAR_BIT 8 32 33 /* Minimum and maximum values a `signed char' can hold. */ 34 # undef SCHAR_MIN 35 # define SCHAR_MIN (-128) 36 # undef SCHAR_MAX 37 # define SCHAR_MAX 127 38 39 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */ 40 # undef UCHAR_MAX 41 # define UCHAR_MAX 255 42 43 /* Minimum and maximum values a `char' can hold. */ 44 # ifdef __CHAR_UNSIGNED__ 45 # undef CHAR_MIN 46 # define CHAR_MIN 0 47 # undef CHAR_MAX 48 # define CHAR_MAX 255 49 # else 50 # undef CHAR_MIN 51 # define CHAR_MIN (-128) 52 # undef CHAR_MAX 53 # define CHAR_MAX 127 54 # endif 55 56 /* Minimum and maximum values a `signed short int' can hold. */ 57 # undef SHRT_MIN 58 /* For the sake of 16 bit hosts, we may not use -32768 */ 59 # define SHRT_MIN (-32767-1) 60 # undef SHRT_MAX 61 # define SHRT_MAX 32767 62 63 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ 64 # undef USHRT_MAX 65 # define USHRT_MAX 65535 66 67 /* Minimum and maximum values a `signed int' can hold. */ 68 # ifndef __INT_MAX__ 69 # define __INT_MAX__ 2147483647 70 # endif 71 # undef INT_MIN 72 # define INT_MIN (-INT_MAX-1) 73 # undef INT_MAX 74 # define INT_MAX __INT_MAX__ 75 76 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */ 77 # undef UINT_MAX 78 # define UINT_MAX (INT_MAX * 2U + 1) 79 80 /* Minimum and maximum values a `signed long int' can hold. 81 (Same as `int'). */ 82 # ifndef __LONG_MAX__ 83 # if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9) 84 # define __LONG_MAX__ 9223372036854775807L 85 # else 86 # define __LONG_MAX__ 2147483647L 87 # endif /* __alpha__ || sparc64 */ 88 # endif 89 # undef LONG_MIN 90 # define LONG_MIN (-LONG_MAX-1) 91 # undef LONG_MAX 92 # define LONG_MAX __LONG_MAX__ 93 94 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ 95 # undef ULONG_MAX 96 # define ULONG_MAX (LONG_MAX * 2UL + 1) 97 98 # ifndef __LONG_LONG_MAX__ 99 # define __LONG_LONG_MAX__ 9223372036854775807LL 100 # endif 101 102 # if __ISO_C_VISIBLE >= 1999 103 /* Minimum and maximum values a `signed long long int' can hold. */ 104 # undef LLONG_MIN 105 # define LLONG_MIN (-LLONG_MAX-1) 106 # undef LLONG_MAX 107 # define LLONG_MAX __LONG_LONG_MAX__ 108 109 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 110 # undef ULLONG_MAX 111 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1) 112 # endif 113 114 # if __GNU_VISIBLE 115 /* Minimum and maximum values a `signed long long int' can hold. */ 116 # undef LONG_LONG_MIN 117 # define LONG_LONG_MIN (-LONG_LONG_MAX-1) 118 # undef LONG_LONG_MAX 119 # define LONG_LONG_MAX __LONG_LONG_MAX__ 120 121 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 122 # undef ULONG_LONG_MAX 123 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) 124 # endif 125 126 # endif /* _LIMITS_H */ 127 # endif /* GCC 2. */ 128 129 #endif /* !_LIBC_LIMITS_H_ */ 130 131 #if defined __GNUC__ && !defined _GCC_LIMITS_H_ 132 /* `_GCC_LIMITS_H_' is what GCC's file defines. */ 133 #ifdef __clang__ 134 #ifndef __GLIBC_USE 135 #define __GLIBC_USE(x) 1 136 #endif 137 #endif 138 # include_next <limits.h> 139 #endif /* __GNUC__ && !_GCC_LIMITS_H_ */ 140 141 #ifndef _POSIX2_RE_DUP_MAX 142 /* The maximum number of repeated occurrences of a regular expression 143 * permitted when using the interval notation `\{M,N\}'. */ 144 #define _POSIX2_RE_DUP_MAX 255 145 #endif /* _POSIX2_RE_DUP_MAX */ 146 147 #ifndef ARG_MAX 148 #define ARG_MAX 4096 149 #endif 150 151 #ifndef PATH_MAX 152 #define PATH_MAX 4096 153 #endif 154