limits.h 3.9 KB

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