00001 /* The <limits.h> header defines some basic sizes, both of the language types 00002 * (e.g., the number of bits in an integer), and of the operating system (e.g. 00003 * the number of characters in a file name. 00004 */ 00005 00006 #ifndef _LIMITS_H 00007 #define _LIMITS_H 00008 00009 /* Definitions about chars (8 bits in MINIX, and signed). */ 00010 #define CHAR_BIT 8 /* # bits in a char */ 00011 #define CHAR_MIN -128 /* minimum value of a char */ 00012 #define CHAR_MAX 127 /* maximum value of a char */ 00013 #define SCHAR_MIN -128 /* minimum value of a signed char */ 00014 #define SCHAR_MAX 127 /* maximum value of a signed char */ 00015 #define UCHAR_MAX 255 /* maximum value of an unsigned char */ 00016 #define MB_LEN_MAX 1 /* maximum length of a multibyte char */ 00017 00018 /* Definitions about shorts (16 bits in MINIX). */ 00019 #define SHRT_MIN (-32767-1) /* minimum value of a short */ 00020 #define SHRT_MAX 32767 /* maximum value of a short */ 00021 #define USHRT_MAX 0xFFFF /* maximum value of unsigned short */ 00022 00023 /* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */ 00024 #if _EM_WSIZE == 2 00025 #define INT_MIN (-32767-1) /* minimum value of a 16-bit int */ 00026 #define INT_MAX 32767 /* maximum value of a 16-bit int */ 00027 #define UINT_MAX 0xFFFF /* maximum value of an unsigned 16-bit int */ 00028 #endif 00029 00030 #if _EM_WSIZE == 4 00031 #define INT_MIN (-2147483647-1) /* minimum value of a 32-bit int */ 00032 #define INT_MAX 2147483647 /* maximum value of a 32-bit int */ 00033 #define UINT_MAX 0xFFFFFFFF /* maximum value of an unsigned 32-bit int */ 00034 #endif 00035 00036 /*Definitions about longs (32 bits in MINIX). */ 00037 #define LONG_MIN (-2147483647L-1)/* minimum value of a long */ 00038 #define LONG_MAX 2147483647L /* maximum value of a long */ 00039 #define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */ 00040 00041 #include <sys/dir.h> 00042 00043 /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */ 00044 #ifdef _POSIX_SOURCE /* these are only visible for POSIX */ 00045 #define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */ 00046 #define _POSIX_CHILD_MAX 6 /* a process may have 6 children */ 00047 #define _POSIX_LINK_MAX 8 /* a file may have 8 links */ 00048 #define _POSIX_MAX_CANON 255 /* size of the canonical input queue */ 00049 #define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */ 00050 #define _POSIX_NAME_MAX DIRSIZ /* max. file name length */ 00051 #define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */ 00052 #define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */ 00053 #define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */ 00054 #define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes must be atomic */ 00055 #define _POSIX_STREAM_MAX 8 /* at least 8 FILEs can be open at once */ 00056 #define _POSIX_TZNAME_MAX 3 /* time zone names can be at least 3 chars */ 00057 #define _POSIX_SSIZE_MAX 32767 /* read() must support 32767 byte reads */ 00058 00059 /* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */ 00060 /* Some of these old names had better be defined when not POSIX. */ 00061 #define _NO_LIMIT 100 /* arbitrary number; limit not enforced */ 00062 00063 #define NGROUPS_MAX 0 /* supplemental group IDs not available */ 00064 #if _EM_WSIZE > 2 00065 #define ARG_MAX 16384 /* # bytes of args + environ for exec() */ 00066 #else 00067 #define ARG_MAX 4096 /* args + environ on small machines */ 00068 #endif 00069 #define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */ 00070 #define OPEN_MAX 30 /* # open files a process may have */ 00071 #if 0 /* V1 file system */ 00072 #define LINK_MAX CHAR_MAX /* # links a file may have */ 00073 #else /* V2 or better file system */ 00074 #define LINK_MAX SHRT_MAX /* # links a file may have */ 00075 #endif 00076 #define MAX_CANON 255 /* size of the canonical input queue */ 00077 #define MAX_INPUT 255 /* size of the type-ahead buffer */ 00078 #define NAME_MAX DIRSIZ /* # chars in a file name */ 00079 #define PATH_MAX 255 /* # chars in a path name */ 00080 #define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */ 00081 #define STREAM_MAX 20 /* must be the same as FOPEN_MAX in stdio.h */ 00082 #define TZNAME_MAX 3 /* maximum bytes in a time zone name is 3 */ 00083 #define SSIZE_MAX 32767 /* max defined byte count for read() */ 00084 00085 #endif /* _POSIX_SOURCE */ 00086 00087 #endif /* _LIMITS_H */
1.4.6