2
0

limits.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef _LIMITS_H
  2. #define _LIMITS_H
  3. #include <features.h>
  4. #include <bits/alltypes.h> /* __LONG_MAX */
  5. /* Support signed or unsigned plain-char */
  6. #if '\xff' > 0
  7. #define CHAR_MIN 0
  8. #define CHAR_MAX 255
  9. #else
  10. #define CHAR_MIN (-128)
  11. #define CHAR_MAX 127
  12. #endif
  13. #define CHAR_BIT 8
  14. #define SCHAR_MIN (-128)
  15. #define SCHAR_MAX 127
  16. #define UCHAR_MAX 255
  17. #define SHRT_MIN (-1-0x7fff)
  18. #define SHRT_MAX 0x7fff
  19. #define USHRT_MAX 0xffff
  20. #define INT_MIN (-1-0x7fffffff)
  21. #define INT_MAX 0x7fffffff
  22. #define UINT_MAX 0xffffffffU
  23. #define LONG_MIN (-LONG_MAX-1)
  24. #define LONG_MAX __LONG_MAX
  25. #define ULONG_MAX (2UL*LONG_MAX+1)
  26. #define LLONG_MIN (-LLONG_MAX-1)
  27. #define LLONG_MAX 0x7fffffffffffffffLL
  28. #define ULLONG_MAX (2ULL*LLONG_MAX+1)
  29. #define MB_LEN_MAX 4
  30. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  31. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  32. #include <bits/limits.h>
  33. #define PIPE_BUF 4096
  34. #define FILESIZEBITS 64
  35. #ifndef NAME_MAX
  36. #define NAME_MAX 255
  37. #endif
  38. #define PATH_MAX 4096
  39. #define NGROUPS_MAX 32
  40. #define ARG_MAX 131072
  41. #define IOV_MAX 1024
  42. #define SYMLOOP_MAX 40
  43. #define WORD_BIT 32
  44. #define SSIZE_MAX LONG_MAX
  45. #define TZNAME_MAX 6
  46. #define TTY_NAME_MAX 32
  47. #define HOST_NAME_MAX 255
  48. #if LONG_MAX == 0x7fffffffL
  49. #define LONG_BIT 32
  50. #else
  51. #define LONG_BIT 64
  52. #endif
  53. /* Implementation choices... */
  54. #define PTHREAD_KEYS_MAX 128
  55. #define PTHREAD_STACK_MIN 2048
  56. #define PTHREAD_DESTRUCTOR_ITERATIONS 4
  57. #define SEM_VALUE_MAX 0x7fffffff
  58. #define SEM_NSEMS_MAX 256
  59. #define DELAYTIMER_MAX 0x7fffffff
  60. #define MQ_PRIO_MAX 32768
  61. #define LOGIN_NAME_MAX 256
  62. /* Arbitrary numbers... */
  63. #define BC_BASE_MAX 99
  64. #define BC_DIM_MAX 2048
  65. #define BC_SCALE_MAX 99
  66. #define BC_STRING_MAX 1000
  67. #define CHARCLASS_NAME_MAX 14
  68. #define COLL_WEIGHTS_MAX 2
  69. #define EXPR_NEST_MAX 32
  70. #define LINE_MAX 4096
  71. #define RE_DUP_MAX 255
  72. #define NL_ARGMAX 9
  73. #define NL_MSGMAX 32767
  74. #define NL_SETMAX 255
  75. #define NL_TEXTMAX 2048
  76. #endif
  77. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
  78. #ifdef PAGESIZE
  79. #define PAGE_SIZE PAGESIZE
  80. #endif
  81. #define NZERO 20
  82. #define NL_LANGMAX 32
  83. #endif
  84. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
  85. || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
  86. #define NL_NMAX 16
  87. #endif
  88. /* POSIX/SUS requirements follow. These numbers come directly
  89. * from SUS and have nothing to do with the host system. */
  90. #define _POSIX_AIO_LISTIO_MAX 2
  91. #define _POSIX_AIO_MAX 1
  92. #define _POSIX_ARG_MAX 4096
  93. #define _POSIX_CHILD_MAX 25
  94. #define _POSIX_CLOCKRES_MIN 20000000
  95. #define _POSIX_DELAYTIMER_MAX 32
  96. #define _POSIX_HOST_NAME_MAX 255
  97. #define _POSIX_LINK_MAX 8
  98. #define _POSIX_LOGIN_NAME_MAX 9
  99. #define _POSIX_MAX_CANON 255
  100. #define _POSIX_MAX_INPUT 255
  101. #define _POSIX_MQ_OPEN_MAX 8
  102. #define _POSIX_MQ_PRIO_MAX 32
  103. #define _POSIX_NAME_MAX 14
  104. #define _POSIX_NGROUPS_MAX 8
  105. #define _POSIX_OPEN_MAX 20
  106. #define _POSIX_PATH_MAX 256
  107. #define _POSIX_PIPE_BUF 512
  108. #define _POSIX_RE_DUP_MAX 255
  109. #define _POSIX_RTSIG_MAX 8
  110. #define _POSIX_SEM_NSEMS_MAX 256
  111. #define _POSIX_SEM_VALUE_MAX 32767
  112. #define _POSIX_SIGQUEUE_MAX 32
  113. #define _POSIX_SSIZE_MAX 32767
  114. #define _POSIX_STREAM_MAX 8
  115. #define _POSIX_SS_REPL_MAX 4
  116. #define _POSIX_SYMLINK_MAX 255
  117. #define _POSIX_SYMLOOP_MAX 8
  118. #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
  119. #define _POSIX_THREAD_KEYS_MAX 128
  120. #define _POSIX_THREAD_THREADS_MAX 64
  121. #define _POSIX_TIMER_MAX 32
  122. #define _POSIX_TRACE_EVENT_NAME_MAX 30
  123. #define _POSIX_TRACE_NAME_MAX 8
  124. #define _POSIX_TRACE_SYS_MAX 8
  125. #define _POSIX_TRACE_USER_EVENT_MAX 32
  126. #define _POSIX_TTY_NAME_MAX 9
  127. #define _POSIX_TZNAME_MAX 6
  128. #define _POSIX2_BC_BASE_MAX 99
  129. #define _POSIX2_BC_DIM_MAX 2048
  130. #define _POSIX2_BC_SCALE_MAX 99
  131. #define _POSIX2_BC_STRING_MAX 1000
  132. #define _POSIX2_CHARCLASS_NAME_MAX 14
  133. #define _POSIX2_COLL_WEIGHTS_MAX 2
  134. #define _POSIX2_EXPR_NEST_MAX 32
  135. #define _POSIX2_LINE_MAX 2048
  136. #define _POSIX2_RE_DUP_MAX 255
  137. #define _XOPEN_IOV_MAX 16
  138. #define _XOPEN_NAME_MAX 255
  139. #define _XOPEN_PATH_MAX 1024
  140. #endif