limits.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* The <limits.h> header defines some basic sizes, both of the language types
  2. * (e.g., the number of bits in an integer), and of the operating system (e.g.
  3. * the number of characters in a file name.
  4. */
  5. #ifndef _LIMITS_H
  6. #define _LIMITS_H
  7. /* Definitions about chars (8 bits in MINIX, and signed). */
  8. #define CHAR_BIT 8 /* # bits in a char */
  9. #define CHAR_MIN -128 /* minimum value of a char */
  10. #define CHAR_MAX 127 /* maximum value of a char */
  11. #define SCHAR_MIN -128 /* minimum value of a signed char */
  12. #define SCHAR_MAX 127 /* maximum value of a signed char */
  13. #define UCHAR_MAX 255 /* maximum value of an unsigned char */
  14. #define MB_LEN_MAX 1 /* maximum length of a multibyte char */
  15. /* Definitions about shorts (16 bits in MINIX). */
  16. #define SHRT_MIN (-32767-1) /* minimum value of a short */
  17. #define SHRT_MAX 32767 /* maximum value of a short */
  18. #define USHRT_MAX 0xFFFF /* maximum value of unsigned short */
  19. #if _EM_WSIZE == 4
  20. #define INT_MIN (-2147483647-1)
  21. #define INT_MAX 2147483647
  22. #define UINT_MAX 0xFFFFFFFF
  23. #else /* _EM_WSIZE == 2 */
  24. /* Definitions about ints (16 bits in MINIX for 8088, 80286, Atari etc) */
  25. #define INT_MIN (-32767-1) /* minimum value of an int */
  26. #define INT_MAX 32767 /* maximum value of an int */
  27. #define UINT_MAX 0xFFFF /* maximum value of an unsigned int */
  28. #endif
  29. /*Definitions about longs (32 bits in MINIX). */
  30. #define LONG_MIN (-2147483647L-1)/* minimum value of a long */
  31. #define LONG_MAX 2147483647L /* maximum value of a long */
  32. #define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */
  33. /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-2). */
  34. #ifdef _POSIX_SOURCE /* these are only visible for POSIX */
  35. #define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */
  36. #define _POSIX_CHILD_MAX 6 /* a process may have 6 children */
  37. #define _POSIX_LINK_MAX 8 /* a file may have 8 links */
  38. #define _POSIX_MAX_CANON 255 /* size of the canonical input queue */
  39. #define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */
  40. #define _POSIX_NAME_MAX 14 /* a file name may have 14 chars */
  41. #define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */
  42. #define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */
  43. #define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */
  44. #define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes must be atomic */
  45. /* Values actually implemented by MINIX (Tables 2-3, 2-4, and 2-5). */
  46. /* Some of these old names had better be defined when not POSIX. */
  47. #define _NO_LIMIT 100 /* arbitrary number; limit not enforced */
  48. #define NGROUPS_MAX 0 /* supplemental group IDs not available */
  49. #define ARG_MAX 4096 /* # bytes of args + environ for exec() */
  50. #define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */
  51. #define OPEN_MAX 20 /* # open files a process may have */
  52. #define LINK_MAX 127 /* # links a file may have */
  53. #define MAX_CANON 255 /* size of the canonical input queue */
  54. #define MAX_INPUT 255 /* size of the type-ahead buffer */
  55. #define NAME_MAX 14 /* # chars in a file name */
  56. #define PATH_MAX 255 /* # chars in a path name */
  57. #define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */
  58. #endif /* _POSIX_SOURCE */
  59. #endif /* _LIMITS_H */