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