malloc: Decorate malloc maps
[glibc.git] / include / stdlib.h
blob580da9be15adf0c1034986f62dd89aaaf6498c3f
1 #ifndef _STDLIB_H
3 #ifndef _ISOMAC
4 # include <stdbool.h>
5 # include <stddef.h>
6 #endif
8 /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
9 #include <bits/floatn.h>
10 #if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
11 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
12 # pragma GCC system_header
13 # endif
14 #endif
16 #include <stdlib/stdlib.h>
18 /* Now define the internal interfaces. */
19 #if !defined _ISOMAC
20 # include <sys/stat.h>
22 # include <rtld-malloc.h>
24 extern __typeof (strtol_l) __strtol_l;
25 extern __typeof (strtoul_l) __strtoul_l;
26 extern __typeof (strtoll_l) __strtoll_l;
27 extern __typeof (strtoull_l) __strtoull_l;
28 extern __typeof (strtod_l) __strtod_l;
29 extern __typeof (strtof_l) __strtof_l;
30 extern __typeof (strtold_l) __strtold_l;
31 libc_hidden_proto (__strtol_l)
32 libc_hidden_proto (__strtoul_l)
33 libc_hidden_proto (__strtoll_l)
34 libc_hidden_proto (__strtoull_l)
35 libc_hidden_proto (__strtod_l)
36 libc_hidden_proto (__strtof_l)
37 libc_hidden_proto (__strtold_l)
39 extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
40 extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
41 extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
42 extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
43 extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
44 extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
45 extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
46 extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
47 libc_hidden_proto (__isoc23_strtol)
48 libc_hidden_proto (__isoc23_strtoul)
49 libc_hidden_proto (__isoc23_strtoll)
50 libc_hidden_proto (__isoc23_strtoull)
51 libc_hidden_proto (__isoc23_strtol_l)
52 libc_hidden_proto (__isoc23_strtoul_l)
53 libc_hidden_proto (__isoc23_strtoll_l)
54 libc_hidden_proto (__isoc23_strtoull_l)
56 #if __GLIBC_USE (C2X_STRTOL)
57 /* Redirect internal uses of these functions to the C2X versions; the
58 redirection in the installed header does not work with
59 libc_hidden_proto. */
60 # undef strtol
61 # define strtol __isoc23_strtol
62 # undef atoi
63 # define atoi(nptr) __isoc23_strtol(nptr, NULL, 10)
64 # undef strtoul
65 # define strtoul __isoc23_strtoul
66 # undef strtoll
67 # define strtoll __isoc23_strtoll
68 # undef strtoull
69 # define strtoull __isoc23_strtoull
70 # undef strtol_l
71 # define strtol_l __isoc23_strtol_l
72 # undef strtoul_l
73 # define strtoul_l __isoc23_strtoul_l
74 # undef strtoll_l
75 # define strtoll_l __isoc23_strtoll_l
76 # undef strtoull_l
77 # define strtoull_l __isoc23_strtoull_l
78 #endif
80 libc_hidden_proto (exit)
81 libc_hidden_proto (abort)
82 libc_hidden_proto (getenv)
83 extern __typeof (secure_getenv) __libc_secure_getenv;
84 libc_hidden_proto (__libc_secure_getenv)
85 libc_hidden_proto (bsearch)
86 libc_hidden_proto (qsort)
87 extern __typeof (qsort_r) __qsort_r;
88 libc_hidden_proto (__qsort_r)
89 libc_hidden_proto (lrand48_r)
90 libc_hidden_proto (wctomb)
92 extern long int __random (void) attribute_hidden;
93 extern void __srandom (unsigned int __seed);
94 extern char *__initstate (unsigned int __seed, char *__statebuf,
95 size_t __statelen);
96 extern char *__setstate (char *__statebuf);
97 extern int __random_r (struct random_data *__buf, int32_t *__result)
98 attribute_hidden;
99 extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
100 attribute_hidden;
101 extern int __initstate_r (unsigned int __seed, char *__statebuf,
102 size_t __statelen, struct random_data *__buf)
103 attribute_hidden;
104 extern int __setstate_r (char *__statebuf, struct random_data *__buf)
105 attribute_hidden;
106 extern int __rand_r (unsigned int *__seed);
107 extern int __erand48_r (unsigned short int __xsubi[3],
108 struct drand48_data *__buffer, double *__result)
109 attribute_hidden;
110 extern int __nrand48_r (unsigned short int __xsubi[3],
111 struct drand48_data *__buffer,
112 long int *__result) attribute_hidden;
113 extern int __jrand48_r (unsigned short int __xsubi[3],
114 struct drand48_data *__buffer,
115 long int *__result) attribute_hidden;
116 extern int __srand48_r (long int __seedval,
117 struct drand48_data *__buffer) attribute_hidden;
118 extern int __seed48_r (unsigned short int __seed16v[3],
119 struct drand48_data *__buffer) attribute_hidden;
120 extern int __lcong48_r (unsigned short int __param[7],
121 struct drand48_data *__buffer) attribute_hidden;
123 /* Internal function to compute next state of the generator. */
124 extern int __drand48_iterate (unsigned short int __xsubi[3],
125 struct drand48_data *__buffer)
126 attribute_hidden;
128 /* Global state for non-reentrant functions. Defined in drand48-iter.c. */
129 extern struct drand48_data __libc_drand48_data attribute_hidden;
131 extern int __setenv (const char *__name, const char *__value, int __replace)
132 attribute_hidden;
133 extern int __unsetenv (const char *__name) attribute_hidden;
134 extern int __clearenv (void) attribute_hidden;
135 extern char *__mktemp (char *__template) __THROW __nonnull ((1));
136 libc_hidden_proto (__mktemp)
137 extern char *__canonicalize_file_name (const char *__name);
138 extern char *__realpath (const char *__name, char *__resolved);
139 libc_hidden_proto (__realpath)
140 extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
141 attribute_hidden;
142 # ifndef _ISOMAC
143 extern int __ptsname_internal (int fd, char *buf, size_t buflen,
144 struct stat64 *stp) attribute_hidden;
145 # endif
146 extern int __getpt (void);
147 extern int __posix_openpt (int __oflag) attribute_hidden;
149 extern int __add_to_environ (const char *name, const char *value,
150 const char *combines, int replace)
151 attribute_hidden;
153 extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
155 extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
156 libc_hidden_proto (__cxa_atexit);
158 extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
159 void *d);
160 extern void __call_tls_dtors (void);
161 libc_hidden_proto (__call_tls_dtors)
163 extern void __cxa_finalize (void *d);
165 extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
167 extern void *__libc_memalign (size_t alignment, size_t size)
168 __attribute_malloc__;
170 extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
171 __THROW __attribute_warn_unused_result__;
172 libc_hidden_proto (__libc_reallocarray)
174 extern int __libc_system (const char *line);
176 extern __typeof (getpt) __getpt;
177 extern __typeof (ptsname_r) __ptsname_r;
178 libc_hidden_proto (__getpt)
179 libc_hidden_proto (__ptsname_r)
180 libc_hidden_proto (grantpt)
181 libc_hidden_proto (unlockpt)
183 __typeof (arc4random) __arc4random;
184 libc_hidden_proto (__arc4random);
185 __typeof (arc4random_buf) __arc4random_buf;
186 libc_hidden_proto (__arc4random_buf);
187 __typeof (arc4random_uniform) __arc4random_uniform;
188 libc_hidden_proto (__arc4random_uniform);
189 extern void __arc4random_buf_internal (void *buffer, size_t len)
190 attribute_hidden;
192 extern double __strtod_internal (const char *__restrict __nptr,
193 char **__restrict __endptr, int __group)
194 __THROW __nonnull ((1)) __wur;
195 extern float __strtof_internal (const char *__restrict __nptr,
196 char **__restrict __endptr, int __group)
197 __THROW __nonnull ((1)) __wur;
198 extern long double __strtold_internal (const char *__restrict __nptr,
199 char **__restrict __endptr,
200 int __group)
201 __THROW __nonnull ((1)) __wur;
202 extern long int __strtol_internal (const char *__restrict __nptr,
203 char **__restrict __endptr,
204 int __base, int __group)
205 __THROW __nonnull ((1)) __wur;
206 extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
207 char **__restrict __endptr,
208 int __base, int __group)
209 __THROW __nonnull ((1)) __wur;
210 __extension__
211 extern long long int __strtoll_internal (const char *__restrict __nptr,
212 char **__restrict __endptr,
213 int __base, int __group)
214 __THROW __nonnull ((1)) __wur;
215 __extension__
216 extern unsigned long long int __strtoull_internal (const char *
217 __restrict __nptr,
218 char **__restrict __endptr,
219 int __base, int __group)
220 __THROW __nonnull ((1)) __wur;
221 libc_hidden_proto (__strtof_internal)
222 libc_hidden_proto (__strtod_internal)
223 libc_hidden_proto (__strtold_internal)
224 libc_hidden_proto (__strtol_internal)
225 libc_hidden_proto (__strtoll_internal)
226 libc_hidden_proto (__strtoul_internal)
227 libc_hidden_proto (__strtoull_internal)
229 extern double ____strtod_l_internal (const char *__restrict __nptr,
230 char **__restrict __endptr, int __group,
231 locale_t __loc);
232 extern float ____strtof_l_internal (const char *__restrict __nptr,
233 char **__restrict __endptr, int __group,
234 locale_t __loc);
235 extern long double ____strtold_l_internal (const char *__restrict __nptr,
236 char **__restrict __endptr,
237 int __group, locale_t __loc);
238 extern long int ____strtol_l_internal (const char *__restrict __nptr,
239 char **__restrict __endptr,
240 int __base, int __group,
241 bool __bin_cst, locale_t __loc);
242 extern unsigned long int ____strtoul_l_internal (const char *
243 __restrict __nptr,
244 char **__restrict __endptr,
245 int __base, int __group,
246 bool __bin_cst,
247 locale_t __loc);
248 __extension__
249 extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
250 char **__restrict __endptr,
251 int __base, int __group,
252 bool __bin_cst, locale_t __loc);
253 __extension__
254 extern unsigned long long int ____strtoull_l_internal (const char *
255 __restrict __nptr,
256 char **
257 __restrict __endptr,
258 int __base, int __group,
259 bool __bin_cst,
260 locale_t __loc);
262 libc_hidden_proto (____strtof_l_internal)
263 libc_hidden_proto (____strtod_l_internal)
264 libc_hidden_proto (____strtold_l_internal)
265 libc_hidden_proto (____strtol_l_internal)
266 libc_hidden_proto (____strtoll_l_internal)
267 libc_hidden_proto (____strtoul_l_internal)
268 libc_hidden_proto (____strtoull_l_internal)
270 #include <bits/floatn.h>
271 libc_hidden_proto (strtof)
272 libc_hidden_proto (strtod)
273 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
274 libc_hidden_proto (strtold)
275 #endif
276 libc_hidden_proto (strtol)
277 libc_hidden_proto (strtoll)
278 libc_hidden_proto (strtoul)
279 libc_hidden_proto (strtoull)
281 libc_hidden_proto (atoi)
283 extern float __strtof_nan (const char *, char **, char);
284 extern double __strtod_nan (const char *, char **, char);
285 extern long double __strtold_nan (const char *, char **, char);
286 extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
287 extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
288 extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
290 libc_hidden_proto (__strtof_nan)
291 libc_hidden_proto (__strtod_nan)
292 libc_hidden_proto (__strtold_nan)
293 libc_hidden_proto (__wcstof_nan)
294 libc_hidden_proto (__wcstod_nan)
295 libc_hidden_proto (__wcstold_nan)
297 /* Enable _FloatN bits as needed. */
298 #include <bits/floatn.h>
300 #if __HAVE_DISTINCT_FLOAT128
301 extern __typeof (strtof128_l) __strtof128_l;
303 libc_hidden_proto (__strtof128_l)
304 libc_hidden_proto (strtof128)
306 extern _Float128 __strtof128_nan (const char *, char **, char);
307 extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
309 libc_hidden_proto (__strtof128_nan)
310 libc_hidden_proto (__wcstof128_nan)
312 extern _Float128 __strtof128_internal (const char *__restrict __nptr,
313 char **__restrict __endptr,
314 int __group);
315 libc_hidden_proto (__strtof128_internal)
317 extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
318 char **__restrict __endptr,
319 int __group, locale_t __loc);
321 libc_hidden_proto (____strtof128_l_internal)
322 #endif
324 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
325 int *__restrict __sign);
326 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
327 int *__restrict __sign);
328 extern char *__gcvt (double __value, int __ndigit, char *__buf);
329 extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
330 int *__restrict __sign, char *__restrict __buf,
331 size_t __len);
332 libc_hidden_proto (__ecvt_r)
333 extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
334 int *__restrict __sign, char *__restrict __buf,
335 size_t __len);
336 libc_hidden_proto (__fcvt_r)
337 extern char *__qecvt (long double __value, int __ndigit,
338 int *__restrict __decpt, int *__restrict __sign);
339 extern char *__qfcvt (long double __value, int __ndigit,
340 int *__restrict __decpt, int *__restrict __sign);
341 extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
342 extern int __qecvt_r (long double __value, int __ndigit,
343 int *__restrict __decpt, int *__restrict __sign,
344 char *__restrict __buf, size_t __len);
345 libc_hidden_proto (__qecvt_r)
346 extern int __qfcvt_r (long double __value, int __ndigit,
347 int *__restrict __decpt, int *__restrict __sign,
348 char *__restrict __buf, size_t __len);
349 libc_hidden_proto (__qfcvt_r)
351 # if IS_IN (libc)
352 # undef MB_CUR_MAX
353 # define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
354 # endif
356 struct abort_msg_s
358 unsigned int size;
359 char msg[0];
361 extern struct abort_msg_s *__abort_msg;
362 libc_hidden_proto (__abort_msg)
364 # if IS_IN (rtld)
365 extern __typeof (unsetenv) unsetenv attribute_hidden;
366 extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
367 # endif
369 #endif
371 #endif /* include/stdlib.h */