Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _LIMITS_H |
| 2 | #define _LIMITS_H |
| 3 | |
Rich Felker | c1a9658 | 2012-09-07 23:13:55 -0400 | [diff] [blame] | 4 | #include <features.h> |
| 5 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 6 | /* Most limits are system-specific */ |
| 7 | |
| 8 | #include <bits/limits.h> |
| 9 | |
Rich Felker | 80949cc | 2012-03-20 21:10:06 -0400 | [diff] [blame] | 10 | /* Support signed or unsigned plain-char */ |
| 11 | |
Rich Felker | 201995f | 2013-04-04 19:50:55 -0400 | [diff] [blame] | 12 | #if '\0'-1 > 0 |
Rich Felker | 80949cc | 2012-03-20 21:10:06 -0400 | [diff] [blame] | 13 | #define CHAR_MIN 0 |
| 14 | #define CHAR_MAX 255 |
| 15 | #else |
| 16 | #define CHAR_MIN (-128) |
| 17 | #define CHAR_MAX 127 |
| 18 | #endif |
| 19 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 20 | /* Some universal constants... */ |
| 21 | |
| 22 | #define CHAR_BIT 8 |
| 23 | #define SCHAR_MIN (-128) |
| 24 | #define SCHAR_MAX 127 |
| 25 | #define UCHAR_MAX 255 |
Rich Felker | e8b8f3c | 2011-06-25 15:38:00 -0400 | [diff] [blame] | 26 | #define SHRT_MIN (-1-0x7fff) |
| 27 | #define SHRT_MAX 0x7fff |
| 28 | #define USHRT_MAX 0xffff |
| 29 | #define INT_MIN (-1-0x7fffffff) |
| 30 | #define INT_MAX 0x7fffffff |
| 31 | #define UINT_MAX 0xffffffffU |
| 32 | #define LONG_MIN (-LONG_MAX-1) |
| 33 | #define ULONG_MAX (2UL*LONG_MAX+1) |
| 34 | #define LLONG_MIN (-LLONG_MAX-1) |
| 35 | #define ULLONG_MAX (2ULL*LLONG_MAX+1) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 36 | |
| 37 | #define MB_LEN_MAX 4 |
Rich Felker | 80695b1 | 2011-02-14 05:10:10 -0500 | [diff] [blame] | 38 | |
| 39 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
Rich Felker | 56c6943 | 2012-11-26 12:05:33 -0500 | [diff] [blame] | 40 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
Rich Felker | 80695b1 | 2011-02-14 05:10:10 -0500 | [diff] [blame] | 41 | |
Rich Felker | e8b8f3c | 2011-06-25 15:38:00 -0400 | [diff] [blame] | 42 | #define PIPE_BUF 4096 |
Szabolcs Nagy | b20760c | 2013-09-15 02:00:32 +0000 | [diff] [blame] | 43 | #ifdef PAGE_SIZE |
Rich Felker | e8b8f3c | 2011-06-25 15:38:00 -0400 | [diff] [blame] | 44 | #define PAGESIZE PAGE_SIZE |
Szabolcs Nagy | b20760c | 2013-09-15 02:00:32 +0000 | [diff] [blame] | 45 | #endif |
Rich Felker | e8b8f3c | 2011-06-25 15:38:00 -0400 | [diff] [blame] | 46 | #define FILESIZEBITS 64 |
| 47 | #define NAME_MAX 255 |
| 48 | #define SYMLINK_MAX 255 |
| 49 | #define PATH_MAX 4096 |
| 50 | #define NZERO 20 |
| 51 | #define NGROUPS_MAX 32 |
| 52 | #define ARG_MAX 131072 |
| 53 | #define IOV_MAX 1024 |
| 54 | #define SYMLOOP_MAX 40 |
| 55 | #define WORD_BIT 32 |
Rich Felker | 80695b1 | 2011-02-14 05:10:10 -0500 | [diff] [blame] | 56 | #define SSIZE_MAX LONG_MAX |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 57 | #define TZNAME_MAX 6 |
Rich Felker | 8c8cf4b | 2013-11-29 12:45:09 -0500 | [diff] [blame] | 58 | #define TTY_NAME_MAX 32 |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 59 | #define HOST_NAME_MAX 255 |
| 60 | |
| 61 | /* Implementation choices... */ |
| 62 | |
Rich Felker | d514264 | 2013-02-01 22:10:40 -0500 | [diff] [blame] | 63 | #define PTHREAD_KEYS_MAX 128 |
| 64 | #define PTHREAD_STACK_MIN 2048 |
Rich Felker | 1a9a2ff | 2011-02-13 19:58:30 -0500 | [diff] [blame] | 65 | #define PTHREAD_DESTRUCTOR_ITERATIONS 4 |
Rich Felker | 03dcc34 | 2011-03-03 18:32:26 -0500 | [diff] [blame] | 66 | #define SEM_VALUE_MAX 0x7fffffff |
Rich Felker | 81af503 | 2011-03-10 21:34:19 -0500 | [diff] [blame] | 67 | #define SEM_NSEMS_MAX 256 |
Rich Felker | 80c4dcd | 2011-03-29 13:01:25 -0400 | [diff] [blame] | 68 | #define DELAYTIMER_MAX 0x7fffffff |
Rich Felker | 2b0ceda | 2011-06-07 15:05:04 -0400 | [diff] [blame] | 69 | #define MQ_PRIO_MAX 32768 |
Rich Felker | f8ac555 | 2012-05-14 00:01:48 -0400 | [diff] [blame] | 70 | #define LOGIN_NAME_MAX 256 |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 71 | |
| 72 | /* Arbitrary numbers... */ |
| 73 | |
| 74 | #define BC_BASE_MAX 99 |
| 75 | #define BC_DIM_MAX 2048 |
| 76 | #define BC_SCALE_MAX 99 |
| 77 | #define BC_STRING_MAX 1000 |
| 78 | #define CHARCLASS_NAME_MAX 14 |
| 79 | #define COLL_WEIGHTS_MAX 2 |
| 80 | #define EXPR_NEST_MAX 32 |
| 81 | #define LINE_MAX 4096 |
| 82 | #define RE_DUP_MAX 255 |
| 83 | |
| 84 | #define NL_ARGMAX 9 |
| 85 | #define NL_LANGMAX 32 |
| 86 | #define NL_MSGMAX 32767 |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 87 | #define NL_SETMAX 255 |
| 88 | #define NL_TEXTMAX 2048 |
| 89 | |
Rich Felker | 74eea62 | 2011-02-14 18:41:25 -0500 | [diff] [blame] | 90 | #endif |
| 91 | |
Rich Felker | 8f03596 | 2013-10-20 22:01:51 -0400 | [diff] [blame] | 92 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \ |
| 93 | || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) |
| 94 | |
| 95 | #define NL_NMAX 16 |
| 96 | |
| 97 | #endif |
| 98 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 99 | /* POSIX/SUS requirements follow. These numbers come directly |
| 100 | * from SUS and have nothing to do with the host system. */ |
| 101 | |
| 102 | #define _POSIX_AIO_LISTIO_MAX 2 |
| 103 | #define _POSIX_AIO_MAX 1 |
| 104 | #define _POSIX_ARG_MAX 4096 |
| 105 | #define _POSIX_CHILD_MAX 25 |
Rich Felker | 74eea62 | 2011-02-14 18:41:25 -0500 | [diff] [blame] | 106 | #define _POSIX_CLOCKRES_MIN 20000000 |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 107 | #define _POSIX_DELAYTIMER_MAX 32 |
| 108 | #define _POSIX_HOST_NAME_MAX 255 |
| 109 | #define _POSIX_LINK_MAX 8 |
| 110 | #define _POSIX_LOGIN_NAME_MAX 9 |
| 111 | #define _POSIX_MAX_CANON 255 |
| 112 | #define _POSIX_MAX_INPUT 255 |
| 113 | #define _POSIX_MQ_OPEN_MAX 8 |
| 114 | #define _POSIX_MQ_PRIO_MAX 32 |
| 115 | #define _POSIX_NAME_MAX 14 |
| 116 | #define _POSIX_NGROUPS_MAX 8 |
| 117 | #define _POSIX_OPEN_MAX 20 |
| 118 | #define _POSIX_PATH_MAX 256 |
| 119 | #define _POSIX_PIPE_BUF 512 |
| 120 | #define _POSIX_RE_DUP_MAX 255 |
| 121 | #define _POSIX_RTSIG_MAX 8 |
| 122 | #define _POSIX_SEM_NSEMS_MAX 256 |
| 123 | #define _POSIX_SEM_VALUE_MAX 32767 |
| 124 | #define _POSIX_SIGQUEUE_MAX 32 |
| 125 | #define _POSIX_SSIZE_MAX 32767 |
| 126 | #define _POSIX_STREAM_MAX 8 |
| 127 | #define _POSIX_SS_REPL_MAX 4 |
| 128 | #define _POSIX_SYMLINK_MAX 255 |
| 129 | #define _POSIX_SYMLOOP_MAX 8 |
| 130 | #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 |
| 131 | #define _POSIX_THREAD_KEYS_MAX 128 |
| 132 | #define _POSIX_THREAD_THREADS_MAX 64 |
| 133 | #define _POSIX_TIMER_MAX 32 |
| 134 | #define _POSIX_TRACE_EVENT_NAME_MAX 30 |
| 135 | #define _POSIX_TRACE_NAME_MAX 8 |
| 136 | #define _POSIX_TRACE_SYS_MAX 8 |
| 137 | #define _POSIX_TRACE_USER_EVENT_MAX 32 |
| 138 | #define _POSIX_TTY_NAME_MAX 9 |
| 139 | #define _POSIX_TZNAME_MAX 6 |
| 140 | #define _POSIX2_BC_BASE_MAX 99 |
| 141 | #define _POSIX2_BC_DIM_MAX 2048 |
| 142 | #define _POSIX2_BC_SCALE_MAX 99 |
| 143 | #define _POSIX2_BC_STRING_MAX 1000 |
| 144 | #define _POSIX2_CHARCLASS_NAME_MAX 14 |
| 145 | #define _POSIX2_COLL_WEIGHTS_MAX 2 |
| 146 | #define _POSIX2_EXPR_NEST_MAX 32 |
| 147 | #define _POSIX2_LINE_MAX 2048 |
| 148 | #define _POSIX2_RE_DUP_MAX 255 |
| 149 | |
| 150 | #define _XOPEN_IOV_MAX 16 |
| 151 | #define _XOPEN_NAME_MAX 255 |
| 152 | #define _XOPEN_PATH_MAX 1024 |
| 153 | |
| 154 | #endif |