1 /*
2 * Copyright (C) 2017 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #include <limits.h>
30
31 #include "header_checks.h"
32
limits_h()33 static void limits_h() {
34 // These are only defined if they're constants.
35 #if !defined(__BIONIC__) && !defined(__GLIBC__)
36 MACRO(AIO_LISTIO_MAX);
37 MACRO(AIO_MAX);
38 #endif
39 #if !defined(__BIONIC__)
40 MACRO(AIO_PRIO_DELTA_MAX);
41 #endif
42 #if !defined(__BIONIC__) && !defined(__GLIBC__)
43 MACRO(ARG_MAX);
44 MACRO(ATEXIT_MAX);
45 MACRO(CHILD_MAX);
46 #endif
47 #if !defined(__BIONIC__)
48 MACRO(DELAYTIMER_MAX);
49 #endif
50 MACRO(HOST_NAME_MAX);
51 MACRO(IOV_MAX);
52 MACRO(LOGIN_NAME_MAX);
53 #if !defined(__BIONIC__) && !defined(__GLIBC__)
54 MACRO(MQ_OPEN_MAX);
55 #endif
56 #if !defined(__BIONIC__)
57 MACRO(MQ_PRIO_MAX);
58 #endif
59 #if !defined(__BIONIC__) && !defined(__GLIBC__)
60 MACRO(OPEN_MAX);
61 MACRO(PAGESIZE);
62 MACRO(PAGE_SIZE);
63 #endif
64 MACRO(PTHREAD_DESTRUCTOR_ITERATIONS);
65 MACRO(PTHREAD_KEYS_MAX);
66 #if !defined(__BIONIC__)
67 MACRO(PTHREAD_STACK_MIN);
68 #endif
69 #if !defined(__BIONIC__) && !defined(__GLIBC__)
70 MACRO(PTHREAD_THREADS_MAX);
71 #endif
72 MACRO(RTSIG_MAX);
73 #if !defined(__BIONIC__) && !defined(__GLIBC__)
74 MACRO(SEM_NSEMS_MAX);
75 #endif
76 MACRO(SEM_VALUE_MAX);
77 #if !defined(__BIONIC__) && !defined(__GLIBC__)
78 MACRO(SIGQUEUE_MAX);
79 MACRO(SS_REPL_MAX);
80 MACRO(STREAM_MAX);
81 MACRO(SYMLOOP_MAX);
82 MACRO(TIMER_MAX);
83 #endif
84 #if !defined(__BIONIC__)
85 MACRO(TTY_NAME_MAX);
86 #endif
87 #if !defined(__BIONIC__) && !defined(__GLIBC__)
88 MACRO(TZNAME_MAX);
89 #endif
90
91 #if !defined(__BIONIC__) && !defined(__GLIBC__)
92 MACRO(FILESIZEBITS);
93 MACRO(LINK_MAX);
94 #endif
95 MACRO(MAX_CANON);
96 MACRO(MAX_INPUT);
97 MACRO(NAME_MAX);
98 MACRO(PATH_MAX);
99 MACRO(PIPE_BUF);
100 #if 0 // No libc has these.
101 MACRO(POSIX_ALLOC_SIZE_MIN);
102 MACRO(POSIX_REC_INCR_XFER_SIZE);
103 MACRO(POSIX_REC_MAX_XFER_SIZE);
104 MACRO(POSIX_REC_MIN_XFER_SIZE);
105 MACRO(POSIX_REC_XFER_ALIGN);
106 #endif
107 #if !defined(__BIONIC__) && !defined(__GLIBC__)
108 MACRO(SYMLINK_MAX);
109 #endif
110
111 #if !defined(__BIONIC__)
112 MACRO(BC_BASE_MAX);
113 MACRO(BC_DIM_MAX);
114 MACRO(BC_SCALE_MAX);
115 MACRO(BC_STRING_MAX);
116 MACRO(CHARCLASS_NAME_MAX);
117 MACRO(COLL_WEIGHTS_MAX);
118 MACRO(EXPR_NEST_MAX);
119 MACRO(LINE_MAX);
120 MACRO(NGROUPS_MAX);
121 MACRO(RE_DUP_MAX);
122 #endif
123
124 MACRO_VALUE(_POSIX_CLOCKRES_MIN, 20000000);
125
126 MACRO_VALUE(_POSIX_AIO_LISTIO_MAX, 2);
127 MACRO_VALUE(_POSIX_AIO_MAX, 1);
128 MACRO_VALUE(_POSIX_ARG_MAX, 4096);
129 MACRO_VALUE(_POSIX_CHILD_MAX, 25);
130 MACRO_VALUE(_POSIX_DELAYTIMER_MAX, 32);
131 MACRO_VALUE(_POSIX_HOST_NAME_MAX, 255);
132 MACRO_VALUE(_POSIX_LINK_MAX, 8);
133 MACRO_VALUE(_POSIX_LOGIN_NAME_MAX, 9);
134 MACRO_VALUE(_POSIX_MAX_CANON, 255);
135 MACRO_VALUE(_POSIX_MAX_INPUT, 255);
136 MACRO_VALUE(_POSIX_MQ_OPEN_MAX, 8);
137 MACRO_VALUE(_POSIX_MQ_PRIO_MAX, 32);
138 MACRO_VALUE(_POSIX_NAME_MAX, 14);
139 MACRO_VALUE(_POSIX_NGROUPS_MAX, 8);
140 MACRO_VALUE(_POSIX_OPEN_MAX, 20);
141 MACRO_VALUE(_POSIX_PATH_MAX, 256);
142 MACRO_VALUE(_POSIX_PIPE_BUF, 512);
143 MACRO_VALUE(_POSIX_RE_DUP_MAX, 255);
144 MACRO_VALUE(_POSIX_RTSIG_MAX, 8);
145 MACRO_VALUE(_POSIX_SEM_NSEMS_MAX, 256);
146 MACRO_VALUE(_POSIX_SEM_VALUE_MAX, 32767);
147 MACRO_VALUE(_POSIX_SIGQUEUE_MAX, 32);
148 MACRO_VALUE(_POSIX_SSIZE_MAX, 32767);
149 #if !defined(__GLIBC__)
150 MACRO_VALUE(_POSIX_SS_REPL_MAX, 4);
151 #endif
152 MACRO_VALUE(_POSIX_STREAM_MAX, 8);
153 MACRO_VALUE(_POSIX_SYMLINK_MAX, 255);
154 MACRO_VALUE(_POSIX_SYMLOOP_MAX, 8);
155 MACRO_VALUE(_POSIX_THREAD_DESTRUCTOR_ITERATIONS, 4);
156 MACRO_VALUE(_POSIX_THREAD_KEYS_MAX, 128);
157 MACRO_VALUE(_POSIX_THREAD_THREADS_MAX, 64);
158 MACRO_VALUE(_POSIX_TIMER_MAX, 32);
159 #if !defined(__GLIBC__)
160 MACRO_VALUE(_POSIX_TRACE_EVENT_NAME_MAX, 30);
161 MACRO_VALUE(_POSIX_TRACE_NAME_MAX, 8);
162 MACRO_VALUE(_POSIX_TRACE_SYS_MAX, 8);
163 MACRO_VALUE(_POSIX_TRACE_USER_EVENT_MAX, 32);
164 #endif
165 MACRO_VALUE(_POSIX_TTY_NAME_MAX, 9);
166 MACRO_VALUE(_POSIX_TZNAME_MAX, 6);
167 MACRO_VALUE(_POSIX2_BC_BASE_MAX, 99);
168 MACRO_VALUE(_POSIX2_BC_DIM_MAX, 2048);
169 MACRO_VALUE(_POSIX2_BC_SCALE_MAX, 99);
170 MACRO_VALUE(_POSIX2_BC_STRING_MAX, 1000);
171 MACRO_VALUE(_POSIX2_CHARCLASS_NAME_MAX, 14);
172 MACRO_VALUE(_POSIX2_COLL_WEIGHTS_MAX, 2);
173 MACRO_VALUE(_POSIX2_EXPR_NEST_MAX, 32);
174 MACRO_VALUE(_POSIX2_LINE_MAX, 2048);
175 MACRO_VALUE(_POSIX2_RE_DUP_MAX, 255);
176 #if !defined(__GLIBC__)
177 MACRO_VALUE(_XOPEN_IOV_MAX, 16);
178 MACRO_VALUE(_XOPEN_NAME_MAX, 255);
179 MACRO_VALUE(_XOPEN_PATH_MAX, 1024);
180 #endif
181
182 MACRO_VALUE(CHAR_BIT, 8);
183 MACRO(CHAR_MAX);
184 MACRO(CHAR_MIN);
185 MACRO(INT_MAX);
186 MACRO(INT_MIN);
187 MACRO(LLONG_MAX);
188 MACRO(LLONG_MIN);
189 MACRO(LONG_BIT);
190 MACRO(LONG_MAX);
191 MACRO(LONG_MIN);
192 MACRO(MB_LEN_MAX);
193 MACRO_VALUE(SCHAR_MAX, 127);
194 MACRO_VALUE(SCHAR_MIN, -128);
195 MACRO(SHRT_MAX);
196 MACRO(SHRT_MIN);
197 MACRO(SSIZE_MAX);
198 MACRO_VALUE(UCHAR_MAX, 255);
199 MACRO(UINT_MAX);
200 MACRO(ULLONG_MAX);
201 MACRO(ULONG_MAX);
202 MACRO(USHRT_MAX);
203 MACRO(WORD_BIT);
204
205 MACRO(NL_ARGMAX);
206 MACRO(NL_LANGMAX);
207 MACRO(NL_MSGMAX);
208 MACRO(NL_SETMAX);
209 MACRO(NL_TEXTMAX);
210 MACRO(NZERO);
211 }
212