limits.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __LIMITS
  2. #define __LIMITS
  3. /* 8 bit chars (signed), 16 bit shorts, 32 bit ints/longs */
  4. #define CHAR_BIT 8
  5. #define MB_LEN_MAX 3
  6. #define UCHAR_MAX 0xff
  7. #define USHRT_MAX 0xffff
  8. #define UINT_MAX 0xffffffffU
  9. #define ULONG_MAX 0xffffffffUL
  10. #define CHAR_MAX SCHAR_MAX
  11. #define SCHAR_MAX 0x7f
  12. #define SHRT_MAX 0x7fff
  13. #define INT_MAX 0x7fffffff
  14. #define LONG_MAX 0x7fffffffL
  15. #define CHAR_MIN SCHAR_MIN
  16. #define SCHAR_MIN (-SCHAR_MAX-1)
  17. #define SHRT_MIN (-SHRT_MAX-1)
  18. #define INT_MIN (-INT_MAX-1)
  19. #define LONG_MIN (-LONG_MAX-1)
  20. #ifdef _POSIX_SOURCE
  21. #define _POSIX_AIO_LISTIO_MAX 2
  22. #define _POSIX_AIO_MAX 1
  23. #define _POSIX_ARG_MAX 4096
  24. #define _POSIX_CHILD_MAX 6
  25. #define _POSIX_CLOCKRES_MIN 20000000
  26. #define _POSIX_DELAYTIMER_MAX 32
  27. #define _POSIX_LINK_MAX 8
  28. #define _POSIX_MAX_CANON 255
  29. #define _POSIX_MAX_INPUT 255
  30. #define _POSIX_MQ_OPEN_MAX 8
  31. #define _POSIX_MQ_PRIO_MAX 32
  32. #define _POSIX_NAME_MAX 14
  33. #define _POSIX_NGROUPS_MAX 0
  34. #define _POSIX_OPEN_MAX 16
  35. #define _POSIX_PATH_MAX 255
  36. #define _POSIX_PIPE_BUF 512
  37. #define _POSIX_RTSIG_MAX 8
  38. #define _POSIX_SEM_NSEMS_MAX 256
  39. #define _POSIX_SEM_VALUE_MAX 32767
  40. #define _POSIX_SIGQUEUE_MAX 32
  41. #define _POSIX_SSIZE_MAX 32767
  42. #define _POSIX_STREAM_MAX 8
  43. #define _POSIX_TIMER_MAX 32
  44. #define _POSIX_TZNAME_MAX 3
  45. /* pedagogy: those that standard allows omitting are commented out */
  46. /*#define AIO_LIST_MAX _POSIX_AIO_LIST_MAX */
  47. /*#define AIO_MAX _POSIX_AIO_MAX */
  48. /*#define AIO_PRIO_DELTA_MAX 0 */
  49. /*#define ARG_MAX _POSIX_ARG_MAX */
  50. /*#define CHILD_MAX _POSIX_CHILD_MAX */
  51. /*#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX */
  52. /*#define LINK_MAX _POSIX_LINK_MAX */
  53. /*#define MAX_CANON _POSIX_MAX_CANON */
  54. /*#define MAX_INPUT _POSIX_MAX_INPUT */
  55. /*#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX */
  56. /*#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX */
  57. /*#define NAME_MAX _POSIX_NAME_MAX */
  58. #define NGROUPS_MAX 10
  59. /*#define OPEN_MAX _POSIX_OPEN_MAX */
  60. /*#define PAGESIZE 1 */
  61. /*#define PATH_MAX _POSIX_PATH_MAX */
  62. /*#define PIPE_BUF _POSIX_PIPE_BUF */
  63. /*#define RTSIG_MAX _POSIX_RTSIG_MAX */
  64. /*#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX */
  65. /*#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX */
  66. /*#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX */
  67. #define SSIZE_MAX LONG_MAX
  68. /*#define STREAM_MAX _POSIX_STREAM_MAX */
  69. /*#define TIMER_MAX _POSIX_TIMER_MAX */
  70. #define TZNAME_MAX _POSIX_TZNAME_MAX
  71. #ifdef _LIMITS_EXTENSION
  72. /* some things are just too big for pedagogy (X!) */
  73. #include <sys/limits.h>
  74. #endif
  75. #endif /* _POSIX_SOURCE */
  76. #endif /* __LIMITS */