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