[1] | 1 | #ifndef _LIMITS_H |
---|
| 2 | #define _LIMITS_H |
---|
| 3 | |
---|
| 4 | #include <endian.h> |
---|
| 5 | |
---|
| 6 | #ifndef __SCHAR_MAX__ |
---|
| 7 | #define __SCHAR_MAX__ 127 |
---|
| 8 | #endif |
---|
| 9 | #ifndef __SHRT_MAX__ |
---|
| 10 | #define __SHRT_MAX__ 32767 |
---|
| 11 | #endif |
---|
| 12 | #ifndef __INT_MAX__ |
---|
| 13 | #define __INT_MAX__ 2147483647 |
---|
| 14 | #endif |
---|
| 15 | #ifndef __LONG_MAX__ |
---|
| 16 | #if __WORDSIZE == 64 |
---|
| 17 | #define __LONG_MAX__ 9223372036854775807L |
---|
| 18 | #else |
---|
| 19 | #define __LONG_MAX__ 2147483647L |
---|
| 20 | #endif |
---|
| 21 | #endif |
---|
| 22 | |
---|
| 23 | #define CHAR_BIT 8 |
---|
| 24 | |
---|
| 25 | #define SCHAR_MIN (-1 - SCHAR_MAX) |
---|
| 26 | #define SCHAR_MAX (__SCHAR_MAX__) |
---|
| 27 | #define UCHAR_MAX (SCHAR_MAX * 2 + 1) |
---|
| 28 | |
---|
| 29 | #ifdef __CHAR_UNSIGNED__ |
---|
| 30 | #undef CHAR_MIN |
---|
| 31 | #define CHAR_MIN 0 |
---|
| 32 | #undef CHAR_MAX |
---|
| 33 | #define CHAR_MAX UCHAR_MAX |
---|
| 34 | #else |
---|
| 35 | #undef CHAR_MIN |
---|
| 36 | #define CHAR_MIN SCHAR_MIN |
---|
| 37 | #undef CHAR_MAX |
---|
| 38 | #define CHAR_MAX SCHAR_MAX |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | #define SHRT_MIN (-1 - SHRT_MAX) |
---|
| 42 | #define SHRT_MAX (__SHRT_MAX__) |
---|
| 43 | #if ((__INT_MAX__) == (__SHRT_MAX__)) |
---|
| 44 | #define USHRT_MAX (SHRT_MAX * 2U + 1U) |
---|
| 45 | #else |
---|
| 46 | #define USHRT_MAX (SHRT_MAX * 2 + 1) |
---|
| 47 | #endif |
---|
| 48 | |
---|
| 49 | #define INT_MIN (-1 - INT_MAX) |
---|
| 50 | #define INT_MAX (__INT_MAX__) |
---|
| 51 | #define UINT_MAX (INT_MAX * 2U + 1U) |
---|
| 52 | |
---|
| 53 | #define LONG_MIN (-1L - LONG_MAX) |
---|
| 54 | #define LONG_MAX ((__LONG_MAX__) + 0L) |
---|
| 55 | #define ULONG_MAX (LONG_MAX * 2UL + 1UL) |
---|
| 56 | |
---|
| 57 | #define LLONG_MAX 9223372036854775807LL |
---|
| 58 | #define LLONG_MIN (-LLONG_MAX - 1LL) |
---|
| 59 | |
---|
| 60 | /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ |
---|
| 61 | #define ULLONG_MAX 18446744073709551615ULL |
---|
| 62 | |
---|
| 63 | #define SSIZE_MIN LONG_MIN |
---|
| 64 | #define SSIZE_MAX LONG_MAX |
---|
| 65 | |
---|
| 66 | #define PASS_MAX 256 |
---|
| 67 | |
---|
| 68 | #define NR_OPEN 1024 |
---|
| 69 | |
---|
| 70 | #define NGROUPS_MAX 32 /* supplemental group IDs are available */ |
---|
| 71 | #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ |
---|
| 72 | #define CHILD_MAX 999 /* no limit :-) */ |
---|
| 73 | /*#define OPEN_MAX 256 # open files a process may have */ |
---|
| 74 | #define OPEN_MAX 60 /* SEE VFS PARAMS */ |
---|
| 75 | #define LINK_MAX 127 /* # links a file may have */ |
---|
| 76 | #define MAX_CANON 255 /* size of the canonical input queue */ |
---|
| 77 | #define MAX_INPUT 255 /* size of the type-ahead buffer */ |
---|
| 78 | #define NAME_MAX 255 /* chars in a file name */ |
---|
| 79 | #define PATH_MAX NAME_MAX*12+1 /* SEE VFS PARAMS */ |
---|
| 80 | #define PIPE_BUF 4096 # bytes in atomic write to a pipe */ |
---|
| 81 | //#define PIPE_BUF 512 /* SEE BUFFER CACHE BLOCK SIZE */ |
---|
| 82 | |
---|
| 83 | #define RTSIG_MAX 32 |
---|
| 84 | |
---|
| 85 | #define LINE_MAX 2048 |
---|
| 86 | #define ATEXIT_MAX 32 |
---|
| 87 | |
---|
| 88 | /* mutt demanded these */ |
---|
| 89 | #define _POSIX_PATH_MAX PATH_MAX |
---|
| 90 | #define MB_LEN_MAX 16 |
---|
| 91 | |
---|
| 92 | #ifdef _XOPEN_SOURCE |
---|
| 93 | #define IOV_MAX 1024 |
---|
| 94 | #endif |
---|
| 95 | |
---|
| 96 | #endif |
---|