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