limits.h 3.8 KB

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