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