]> git.ipfire.org Git - thirdparty/glibc.git/blame - include/stdlib.h
Add per-thread cache to malloc
[thirdparty/glibc.git] / include / stdlib.h
CommitLineData
6796bc80 1#ifndef _STDLIB_H
7ef90c15 2
31341567
UD
3#ifndef _ISOMAC
4# include <stddef.h>
5#endif
28f540f4 6#include <stdlib/stdlib.h>
bdbf022d
UD
7
8/* Now define the internal interfaces. */
ae65d4f3 9#if !defined _ISOMAC
31341567 10# include <sys/stat.h>
37ba7d66 11
da4cfe38
RM
12extern __typeof (strtol_l) __strtol_l;
13extern __typeof (strtoul_l) __strtoul_l;
14extern __typeof (strtoll_l) __strtoll_l;
15extern __typeof (strtoull_l) __strtoull_l;
16extern __typeof (strtod_l) __strtod_l;
17extern __typeof (strtof_l) __strtof_l;
18extern __typeof (strtold_l) __strtold_l;
773e305e
RM
19libc_hidden_proto (__strtol_l)
20libc_hidden_proto (__strtoul_l)
21libc_hidden_proto (__strtoll_l)
22libc_hidden_proto (__strtoull_l)
23libc_hidden_proto (__strtod_l)
24libc_hidden_proto (__strtof_l)
25libc_hidden_proto (__strtold_l)
da4cfe38 26
a757607d 27libc_hidden_proto (exit)
509d1b68 28libc_hidden_proto (abort)
a757607d 29libc_hidden_proto (getenv)
84b3fd84
FW
30extern __typeof (secure_getenv) __libc_secure_getenv;
31libc_hidden_proto (__libc_secure_getenv)
a757607d 32libc_hidden_proto (bsearch)
284128f6 33libc_hidden_proto (qsort)
bef8fd60
JM
34extern __typeof (qsort_r) __qsort_r;
35libc_hidden_proto (__qsort_r)
c41f555e 36libc_hidden_proto (lrand48_r)
e2ec9b4d 37libc_hidden_proto (wctomb)
37ba7d66 38
344be96a 39extern long int __random (void);
c19559b0 40extern void __srandom (unsigned int __seed);
6484a17f 41extern char *__initstate (unsigned int __seed, char *__statebuf,
c19559b0 42 size_t __statelen);
6484a17f 43extern char *__setstate (char *__statebuf);
c19559b0
UD
44extern int __random_r (struct random_data *__buf, int32_t *__result);
45extern int __srandom_r (unsigned int __seed, struct random_data *__buf);
d653aacd 46extern int __initstate_r (unsigned int __seed, char *__statebuf,
c19559b0 47 size_t __statelen, struct random_data *__buf);
d653aacd 48extern int __setstate_r (char *__statebuf, struct random_data *__buf);
c19559b0 49extern int __rand_r (unsigned int *__seed);
fe559c5e 50extern int __erand48_r (unsigned short int __xsubi[3],
c19559b0 51 struct drand48_data *__buffer, double *__result);
fe559c5e
UD
52extern int __nrand48_r (unsigned short int __xsubi[3],
53 struct drand48_data *__buffer,
c19559b0 54 long int *__result);
fe559c5e
UD
55extern int __jrand48_r (unsigned short int __xsubi[3],
56 struct drand48_data *__buffer,
c19559b0 57 long int *__result);
fe559c5e 58extern int __srand48_r (long int __seedval,
c19559b0 59 struct drand48_data *__buffer);
fe559c5e 60extern int __seed48_r (unsigned short int __seed16v[3],
c19559b0 61 struct drand48_data *__buffer);
fe559c5e 62extern int __lcong48_r (unsigned short int __param[7],
c19559b0 63 struct drand48_data *__buffer);
bdbf022d
UD
64
65/* Internal function to compute next state of the generator. */
fe559c5e 66extern int __drand48_iterate (unsigned short int __xsubi[3],
c19559b0 67 struct drand48_data *__buffer);
bdbf022d 68
aa32f798
UD
69/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
70extern struct drand48_data __libc_drand48_data attribute_hidden;
71
a784e502
UD
72extern int __setenv (const char *__name, const char *__value, int __replace);
73extern int __unsetenv (const char *__name);
c19559b0 74extern int __clearenv (void);
cfa8054f 75extern char *__mktemp (char *__template) __THROW __nonnull ((1));
a784e502
UD
76extern char *__canonicalize_file_name (const char *__name);
77extern char *__realpath (const char *__name, char *__resolved);
c19559b0 78extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
63de5ef7 79# ifndef _ISOMAC
aa989023
UD
80extern int __ptsname_internal (int fd, char *buf, size_t buflen,
81 struct stat64 *stp);
63de5ef7 82# endif
c19559b0 83extern int __getpt (void);
0101a56f 84extern int __posix_openpt (int __oflag);
de4a40d0
UD
85
86extern int __add_to_environ (const char *name, const char *value,
87 const char *combines, int replace);
061d137b
UD
88
89extern void _quicksort (void *const pbase, size_t total_elems,
e458144c 90 size_t size, __compar_d_fn_t cmp, void *arg);
061d137b 91
bd7f30a9
AJ
92extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
93
a6a478e9 94extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
cb831245 95libc_hidden_proto (__cxa_atexit);
a6a478e9 96
ba384f6e
SP
97extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
98 void *d);
e57b0c61
RM
99extern void __call_tls_dtors (void)
100#ifndef SHARED
101 __attribute__ ((weak))
102#endif
103 ;
104libc_hidden_proto (__call_tls_dtors)
ba384f6e 105
03bac9ac
AJ
106extern void __cxa_finalize (void *d);
107
5bcbe69f
AJ
108extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
109
aed283dd
UD
110extern void *__libc_memalign (size_t alignment, size_t size)
111 __attribute_malloc__;
0758ea0c 112
2e0bbbfb
DW
113extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
114 __THROW __attribute_warn_unused_result__;
115libc_hidden_proto (__libc_reallocarray)
116
03bac9ac
AJ
117extern int __libc_system (const char *line);
118
9b2e9577 119
a784e502 120extern double __strtod_internal (const char *__restrict __nptr,
9b2e9577
UD
121 char **__restrict __endptr, int __group)
122 __THROW __nonnull ((1)) __wur;
a784e502 123extern float __strtof_internal (const char *__restrict __nptr,
9b2e9577
UD
124 char **__restrict __endptr, int __group)
125 __THROW __nonnull ((1)) __wur;
a784e502 126extern long double __strtold_internal (const char *__restrict __nptr,
9b2e9577
UD
127 char **__restrict __endptr,
128 int __group)
129 __THROW __nonnull ((1)) __wur;
a784e502 130extern long int __strtol_internal (const char *__restrict __nptr,
9b2e9577
UD
131 char **__restrict __endptr,
132 int __base, int __group)
133 __THROW __nonnull ((1)) __wur;
a784e502 134extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
9b2e9577
UD
135 char **__restrict __endptr,
136 int __base, int __group)
137 __THROW __nonnull ((1)) __wur;
138__extension__
a784e502 139extern long long int __strtoll_internal (const char *__restrict __nptr,
9b2e9577
UD
140 char **__restrict __endptr,
141 int __base, int __group)
142 __THROW __nonnull ((1)) __wur;
143__extension__
a784e502 144extern unsigned long long int __strtoull_internal (const char *
9b2e9577
UD
145 __restrict __nptr,
146 char **__restrict __endptr,
147 int __base, int __group)
148 __THROW __nonnull ((1)) __wur;
149libc_hidden_proto (__strtof_internal)
150libc_hidden_proto (__strtod_internal)
151libc_hidden_proto (__strtold_internal)
152libc_hidden_proto (__strtol_internal)
153libc_hidden_proto (__strtoll_internal)
154libc_hidden_proto (__strtoul_internal)
155libc_hidden_proto (__strtoull_internal)
156
a784e502 157extern double ____strtod_l_internal (const char *__restrict __nptr,
bf1fd594 158 char **__restrict __endptr, int __group,
af85385f 159 locale_t __loc);
a784e502 160extern float ____strtof_l_internal (const char *__restrict __nptr,
bf1fd594 161 char **__restrict __endptr, int __group,
af85385f 162 locale_t __loc);
a784e502 163extern long double ____strtold_l_internal (const char *__restrict __nptr,
bf1fd594 164 char **__restrict __endptr,
af85385f 165 int __group, locale_t __loc);
a784e502 166extern long int ____strtol_l_internal (const char *__restrict __nptr,
bf1fd594
UD
167 char **__restrict __endptr,
168 int __base, int __group,
af85385f 169 locale_t __loc);
a784e502 170extern unsigned long int ____strtoul_l_internal (const char *
bf1fd594
UD
171 __restrict __nptr,
172 char **__restrict __endptr,
173 int __base, int __group,
af85385f 174 locale_t __loc);
bf1fd594 175__extension__
a784e502 176extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
bf1fd594
UD
177 char **__restrict __endptr,
178 int __base, int __group,
af85385f 179 locale_t __loc);
bf1fd594 180__extension__
a784e502 181extern unsigned long long int ____strtoull_l_internal (const char *
bf1fd594
UD
182 __restrict __nptr,
183 char **
184 __restrict __endptr,
185 int __base, int __group,
af85385f 186 locale_t __loc);
bf1fd594 187
509d1b68
RM
188libc_hidden_proto (____strtof_l_internal)
189libc_hidden_proto (____strtod_l_internal)
190libc_hidden_proto (____strtold_l_internal)
191libc_hidden_proto (____strtol_l_internal)
192libc_hidden_proto (____strtoll_l_internal)
193libc_hidden_proto (____strtoul_l_internal)
194libc_hidden_proto (____strtoull_l_internal)
195
773e305e
RM
196libc_hidden_proto (strtof)
197libc_hidden_proto (strtod)
198libc_hidden_proto (strtold)
199libc_hidden_proto (strtol)
200libc_hidden_proto (strtoll)
201libc_hidden_proto (strtoul)
202libc_hidden_proto (strtoull)
bf1fd594 203
e02cabec
JM
204extern float __strtof_nan (const char *, char **, char) internal_function;
205extern double __strtod_nan (const char *, char **, char) internal_function;
206extern long double __strtold_nan (const char *, char **, char)
207 internal_function;
208extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t)
209 internal_function;
210extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t)
211 internal_function;
212extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t)
213 internal_function;
214
215libc_hidden_proto (__strtof_nan)
216libc_hidden_proto (__strtod_nan)
217libc_hidden_proto (__strtold_nan)
218libc_hidden_proto (__wcstof_nan)
219libc_hidden_proto (__wcstod_nan)
220libc_hidden_proto (__wcstold_nan)
221
45f39d45
PM
222/* Enable _FloatN bits as needed. */
223#include <bits/floatn.h>
224
225#if __HAVE_DISTINCT_FLOAT128
226extern __typeof (strtof128_l) __strtof128_l;
227
228libc_hidden_proto (__strtof128_l)
229libc_hidden_proto (strtof128)
230
231extern _Float128 __strtof128_nan (const char *, char **, char)
232 internal_function;
233extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t)
234 internal_function;
235
236libc_hidden_proto (__strtof128_nan)
237libc_hidden_proto (__wcstof128_nan)
238
239extern _Float128 __strtof128_internal (const char *__restrict __nptr,
240 char **__restrict __endptr,
241 int __group);
242libc_hidden_proto (__strtof128_internal)
243
244extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
245 char **__restrict __endptr,
af85385f 246 int __group, locale_t __loc);
45f39d45
PM
247
248libc_hidden_proto (____strtof128_l_internal)
249#endif
250
c6251f03
RM
251extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
252 int *__restrict __sign);
253extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
254 int *__restrict __sign);
255extern char *__gcvt (double __value, int __ndigit, char *__buf);
256extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
257 int *__restrict __sign, char *__restrict __buf,
258 size_t __len);
259extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
260 int *__restrict __sign, char *__restrict __buf,
261 size_t __len);
262extern char *__qecvt (long double __value, int __ndigit,
263 int *__restrict __decpt, int *__restrict __sign);
264extern char *__qfcvt (long double __value, int __ndigit,
265 int *__restrict __decpt, int *__restrict __sign);
266extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
267extern int __qecvt_r (long double __value, int __ndigit,
268 int *__restrict __decpt, int *__restrict __sign,
269 char *__restrict __buf, size_t __len);
270extern int __qfcvt_r (long double __value, int __ndigit,
271 int *__restrict __decpt, int *__restrict __sign,
272 char *__restrict __buf, size_t __len);
4c93a54c 273
4f41c682 274# if IS_IN (libc)
4c93a54c
UD
275# undef MB_CUR_MAX
276# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
277# endif
278
db59b28b 279extern void *__default_morecore (ptrdiff_t) __THROW;
230491f0
UD
280libc_hidden_proto (__default_morecore)
281
f8a3b5bf
UD
282struct abort_msg_s
283{
284 unsigned int size;
285 char msg[0];
286};
287extern struct abort_msg_s *__abort_msg;
48dcd0ba
UD
288libc_hidden_proto (__abort_msg)
289
f3fc94c0
L
290# if IS_IN (rtld)
291extern __typeof (unsetenv) unsetenv attribute_hidden;
292extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
293# endif
294
f8a3b5bf
UD
295#endif
296
7ef90c15 297#endif /* include/stdlib.h */