limits.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __LIMITS
  10. #define __LIMITS
  11. /* 8 bit chars (signed), 16 bit shorts, 32 bit ints/longs */
  12. #define CHAR_BIT 8
  13. #define MB_LEN_MAX 4
  14. #define UCHAR_MAX 0xff
  15. #define USHRT_MAX 0xffff
  16. #define UINT_MAX 0xffffffffU
  17. #define ULONG_MAX 0xffffffffUL
  18. #define CHAR_MAX SCHAR_MAX
  19. #define SCHAR_MAX 0x7f
  20. #define SHRT_MAX 0x7fff
  21. #define INT_MAX 0x7fffffff
  22. #define LONG_MAX 0x7fffffffL
  23. #define CHAR_MIN SCHAR_MIN
  24. #define SCHAR_MIN (-SCHAR_MAX-1)
  25. #define SHRT_MIN (-SHRT_MAX-1)
  26. #define INT_MIN (-INT_MAX-1)
  27. #define LONG_MIN (-LONG_MAX-1)
  28. #ifdef _POSIX_SOURCE
  29. #define _POSIX_AIO_LISTIO_MAX 2
  30. #define _POSIX_AIO_MAX 1
  31. #define _POSIX_ARG_MAX 4096
  32. #define _POSIX_CHILD_MAX 6
  33. #define _POSIX_CLOCKRES_MIN 20000000
  34. #define _POSIX_DELAYTIMER_MAX 32
  35. #define _POSIX_LINK_MAX 8
  36. #define _POSIX_MAX_CANON 255
  37. #define _POSIX_MAX_INPUT 255
  38. #define _POSIX_MQ_OPEN_MAX 8
  39. #define _POSIX_MQ_PRIO_MAX 32
  40. #define _POSIX_NAME_MAX 14
  41. #define _POSIX_NGROUPS_MAX 0
  42. #define _POSIX_OPEN_MAX 16
  43. #define _POSIX_PATH_MAX 255
  44. #define _POSIX_PIPE_BUF 512
  45. #define _POSIX_RTSIG_MAX 8
  46. #define _POSIX_SEM_NSEMS_MAX 256
  47. #define _POSIX_SEM_VALUE_MAX 32767
  48. #define _POSIX_SIGQUEUE_MAX 32
  49. #define _POSIX_SSIZE_MAX 32767
  50. #define _POSIX_STREAM_MAX 8
  51. #define _POSIX_TIMER_MAX 32
  52. #define _POSIX_TZNAME_MAX 3
  53. /* pedagogy: those that standard allows omitting are commented out */
  54. /*#define AIO_LIST_MAX _POSIX_AIO_LIST_MAX */
  55. /*#define AIO_MAX _POSIX_AIO_MAX */
  56. /*#define AIO_PRIO_DELTA_MAX 0 */
  57. /*#define ARG_MAX _POSIX_ARG_MAX */
  58. /*#define CHILD_MAX _POSIX_CHILD_MAX */
  59. /*#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX */
  60. /*#define LINK_MAX _POSIX_LINK_MAX */
  61. /*#define MAX_CANON _POSIX_MAX_CANON */
  62. /*#define MAX_INPUT _POSIX_MAX_INPUT */
  63. /*#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX */
  64. /*#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX */
  65. /*#define NAME_MAX _POSIX_NAME_MAX */
  66. #define NGROUPS_MAX 10
  67. /*#define OPEN_MAX _POSIX_OPEN_MAX */
  68. /*#define PAGESIZE 1 */
  69. #define PASS_MAX 64
  70. /*#define PATH_MAX _POSIX_PATH_MAX */
  71. /*#define PIPE_BUF _POSIX_PIPE_BUF */
  72. /*#define RTSIG_MAX _POSIX_RTSIG_MAX */
  73. /*#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX */
  74. /*#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX */
  75. /*#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX */
  76. #define SSIZE_MAX LONG_MAX
  77. /*#define STREAM_MAX _POSIX_STREAM_MAX */
  78. /*#define TIMER_MAX _POSIX_TIMER_MAX */
  79. #define TZNAME_MAX _POSIX_TZNAME_MAX
  80. #ifdef _LIMITS_EXTENSION
  81. /* some things are just too big for pedagogy (X!) */
  82. #include <sys/limits.h>
  83. #endif
  84. #endif /* _POSIX_SOURCE */
  85. #endif /* __LIMITS */