1 #ifndef _LIMITS_H 2 #define _LIMITS_H 3 4 #include "los_config.h" 5 6 #ifdef __ICCARM__ /* for iar */ 7 #define PATH_MAX 256 8 #define NAME_MAX 255 9 #define MQ_PRIO_MAX 1 10 #define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE 11 #define IOV_MAX 1024 12 #define SSIZE_MAX LONG_MAX 13 #define PTHREAD_KEYS_MAX 128 14 #include_next <limits.h> 15 #else 16 17 #include <features.h> 18 19 #include <bits/alltypes.h> /* __LONG_MAX */ 20 21 /* Support signed or unsigned plain-char */ 22 23 #if '\xff' > 0 24 #define CHAR_MIN 0 25 #define CHAR_MAX 255 26 #else 27 #define CHAR_MIN (-128) 28 #define CHAR_MAX 127 29 #endif 30 31 #define CHAR_BIT 8 32 #define SCHAR_MIN (-128) 33 #define SCHAR_MAX 127 34 #define UCHAR_MAX 255 35 #define SHRT_MIN (-1-0x7fff) 36 #define SHRT_MAX 0x7fff 37 #define USHRT_MAX 0xffff 38 #define INT_MIN (-1-0x7fffffff) 39 #define INT_MAX 0x7fffffff 40 #define UINT_MAX 0xffffffffU 41 #define LONG_MIN (-LONG_MAX-1) 42 #define LONG_MAX __LONG_MAX 43 #define ULONG_MAX (2UL*LONG_MAX+1) 44 #define LLONG_MIN (-LLONG_MAX-1) 45 #define LLONG_MAX 0x7fffffffffffffffLL 46 #define ULLONG_MAX (2ULL*LLONG_MAX+1) 47 48 #define MB_LEN_MAX 4 49 50 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 51 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 52 53 #include <bits/limits.h> 54 55 #define PIPE_BUF 4096 56 #define FILESIZEBITS 64 57 #ifndef NAME_MAX 58 #define NAME_MAX 255 59 #endif 60 #define PATH_MAX 256 61 #define NGROUPS_MAX 32 62 #define ARG_MAX 131072 63 #define IOV_MAX 1024 64 #define SYMLOOP_MAX 40 65 #define WORD_BIT 32 66 #define SSIZE_MAX LONG_MAX 67 #define TZNAME_MAX 6 68 #define TTY_NAME_MAX 32 69 #define HOST_NAME_MAX 255 70 71 #if LONG_MAX == 0x7fffffffL 72 #define LONG_BIT 32 73 #else 74 #define LONG_BIT 64 75 #endif 76 77 /* Implementation choices... */ 78 79 #define PTHREAD_KEYS_MAX 128 80 #define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE 81 #define PTHREAD_DESTRUCTOR_ITERATIONS 4 82 #define SEM_VALUE_MAX OS_SEM_COUNTING_MAX_COUNT 83 #define SEM_NSEMS_MAX LOSCFG_BASE_IPC_SEM_LIMIT 84 #define DELAYTIMER_MAX 32 85 #define MQ_PRIO_MAX 1 86 #define LOGIN_NAME_MAX 256 87 88 /* Arbitrary numbers... */ 89 90 #define BC_BASE_MAX 99 91 #define BC_DIM_MAX 2048 92 #define BC_SCALE_MAX 99 93 #define BC_STRING_MAX 1000 94 #define CHARCLASS_NAME_MAX 14 95 #define COLL_WEIGHTS_MAX 2 96 #define EXPR_NEST_MAX 32 97 #define LINE_MAX 4096 98 #define RE_DUP_MAX 255 99 100 #define NL_ARGMAX 9 101 #define NL_MSGMAX 32767 102 #define NL_SETMAX 255 103 #define NL_TEXTMAX 2048 104 105 #endif 106 107 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) 108 109 #ifdef PAGESIZE 110 #define PAGE_SIZE PAGESIZE 111 #endif 112 #define NZERO 20 113 #define NL_LANGMAX 32 114 115 #endif 116 117 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \ 118 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) 119 120 #define NL_NMAX 16 121 122 #endif 123 124 /* POSIX/SUS requirements follow. These numbers come directly 125 * from SUS and have nothing to do with the host system. */ 126 127 #define _POSIX_AIO_LISTIO_MAX 2 128 #define _POSIX_AIO_MAX 1 129 #define _POSIX_ARG_MAX 4096 130 #define _POSIX_CHILD_MAX 25 131 #define _POSIX_CLOCKRES_MIN 20000000 132 #define _POSIX_DELAYTIMER_MAX 32 133 #define _POSIX_HOST_NAME_MAX 255 134 #define _POSIX_LINK_MAX 8 135 #define _POSIX_LOGIN_NAME_MAX 9 136 #define _POSIX_MAX_CANON 255 137 #define _POSIX_MAX_INPUT 255 138 #define _POSIX_MQ_OPEN_MAX 8 139 #define _POSIX_MQ_PRIO_MAX 32 140 #define _POSIX_NAME_MAX 14 141 #define _POSIX_NGROUPS_MAX 8 142 #define _POSIX_OPEN_MAX 20 143 #define _POSIX_PATH_MAX 256 144 #define _POSIX_PIPE_BUF 512 145 #define _POSIX_RE_DUP_MAX 255 146 #define _POSIX_RTSIG_MAX 8 147 #define _POSIX_SEM_NSEMS_MAX 256 148 #define _POSIX_SEM_VALUE_MAX 32767 149 #define _POSIX_SIGQUEUE_MAX 32 150 #define _POSIX_SSIZE_MAX 32767 151 #define _POSIX_STREAM_MAX 8 152 #define _POSIX_SS_REPL_MAX 4 153 #define _POSIX_SYMLINK_MAX 255 154 #define _POSIX_SYMLOOP_MAX 8 155 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 156 #define _POSIX_THREAD_KEYS_MAX 128 157 #define _POSIX_THREAD_THREADS_MAX 64 158 #define _POSIX_TIMER_MAX 32 159 #define _POSIX_TRACE_EVENT_NAME_MAX 30 160 #define _POSIX_TRACE_NAME_MAX 8 161 #define _POSIX_TRACE_SYS_MAX 8 162 #define _POSIX_TRACE_USER_EVENT_MAX 32 163 #define _POSIX_TTY_NAME_MAX 9 164 #define _POSIX_TZNAME_MAX 6 165 #define _POSIX2_BC_BASE_MAX 99 166 #define _POSIX2_BC_DIM_MAX 2048 167 #define _POSIX2_BC_SCALE_MAX 99 168 #define _POSIX2_BC_STRING_MAX 1000 169 #define _POSIX2_CHARCLASS_NAME_MAX 14 170 #define _POSIX2_COLL_WEIGHTS_MAX 2 171 #define _POSIX2_EXPR_NEST_MAX 32 172 #define _POSIX2_LINE_MAX 2048 173 #define _POSIX2_RE_DUP_MAX 255 174 175 #define _XOPEN_IOV_MAX 16 176 #define _XOPEN_NAME_MAX 255 177 #define _XOPEN_PATH_MAX 1024 178 179 #endif /* __ICCARM__ */ 180 #endif 181