]>
Commit | Line | Data |
---|---|---|
5b2abdfb | 1 | /* |
b5d655f7 | 2 | * Copyright (c) 2000, 2002 - 2008 Apple Inc. All rights reserved. |
5b2abdfb A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
734aad71 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
5b2abdfb A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
734aad71 A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
5b2abdfb A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /*- | |
24 | * Copyright (c) 1990, 1993 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * | |
27 | * Redistribution and use in source and binary forms, with or without | |
28 | * modification, are permitted provided that the following conditions | |
29 | * are met: | |
30 | * 1. Redistributions of source code must retain the above copyright | |
31 | * notice, this list of conditions and the following disclaimer. | |
32 | * 2. Redistributions in binary form must reproduce the above copyright | |
33 | * notice, this list of conditions and the following disclaimer in the | |
34 | * documentation and/or other materials provided with the distribution. | |
35 | * 3. All advertising materials mentioning features or use of this software | |
36 | * must display the following acknowledgement: | |
37 | * This product includes software developed by the University of | |
38 | * California, Berkeley and its contributors. | |
39 | * 4. Neither the name of the University nor the names of its contributors | |
40 | * may be used to endorse or promote products derived from this software | |
41 | * without specific prior written permission. | |
42 | * | |
43 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
44 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
46 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
49 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
52 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
53 | * SUCH DAMAGE. | |
54 | * | |
55 | * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 | |
56 | */ | |
57 | ||
58 | #ifndef _STDLIB_H_ | |
59 | #define _STDLIB_H_ | |
60 | ||
b5d655f7 | 61 | #include <Availability.h> |
224c7076 | 62 | |
3d9156a7 A |
63 | #include <_types.h> |
64 | #if !defined(_ANSI_SOURCE) | |
65 | #include <sys/wait.h> | |
224c7076 | 66 | #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
9385eb3d | 67 | #include <alloca.h> |
224c7076 | 68 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ |
3d9156a7 | 69 | #endif /* !_ANSI_SOURCE */ |
5b2abdfb | 70 | |
3d9156a7 A |
71 | /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: |
72 | * _GCC_SIZE_T */ | |
6465356a | 73 | #include <sys/_types/_size_t.h> |
5b2abdfb | 74 | |
224c7076 | 75 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
6465356a A |
76 | #include <sys/_types/_ct_rune_t.h> |
77 | #include <sys/_types/_rune_t.h> | |
224c7076 | 78 | #endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ |
5b2abdfb | 79 | |
6465356a | 80 | #include <sys/_types/_wchar_t.h> |
9385eb3d | 81 | |
5b2abdfb A |
82 | typedef struct { |
83 | int quot; /* quotient */ | |
84 | int rem; /* remainder */ | |
85 | } div_t; | |
86 | ||
87 | typedef struct { | |
88 | long quot; /* quotient */ | |
89 | long rem; /* remainder */ | |
90 | } ldiv_t; | |
91 | ||
3d9156a7 A |
92 | #if !__DARWIN_NO_LONG_LONG |
93 | typedef struct { | |
94 | long long quot; | |
95 | long long rem; | |
96 | } lldiv_t; | |
97 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
98 | ||
6465356a | 99 | #include <sys/_types/_null.h> |
5b2abdfb A |
100 | |
101 | #define EXIT_FAILURE 1 | |
102 | #define EXIT_SUCCESS 0 | |
103 | ||
104 | #define RAND_MAX 0x7fffffff | |
105 | ||
3d9156a7 A |
106 | #ifdef _USE_EXTENDED_LOCALES_ |
107 | #include <_xlocale.h> | |
108 | #endif /* _USE_EXTENDED_LOCALES_ */ | |
109 | ||
110 | #ifndef MB_CUR_MAX | |
111 | #ifdef _USE_EXTENDED_LOCALES_ | |
112 | #define MB_CUR_MAX (___mb_cur_max()) | |
113 | #ifndef MB_CUR_MAX_L | |
114 | #define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) | |
115 | #endif /* !MB_CUR_MAX_L */ | |
116 | #else /* !_USE_EXTENDED_LOCALES_ */ | |
5b2abdfb A |
117 | extern int __mb_cur_max; |
118 | #define MB_CUR_MAX __mb_cur_max | |
3d9156a7 A |
119 | #endif /* _USE_EXTENDED_LOCALES_ */ |
120 | #endif /* MB_CUR_MAX */ | |
5b2abdfb | 121 | |
224c7076 | 122 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) \ |
3d9156a7 A |
123 | && defined(_USE_EXTENDED_LOCALES_) && !defined(MB_CUR_MAX_L) |
124 | #define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) | |
125 | #endif | |
34e8f829 | 126 | //Begin-Libc |
5f125488 | 127 | #include "libc_private.h" |
34e8f829 A |
128 | /* f must be a literal string */ |
129 | #define LIBC_ABORT(f,...) abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__) | |
130 | //End-Libc | |
5b2abdfb | 131 | |
b061a43b A |
132 | #ifndef __alloc_size |
133 | #if __has_attribute(alloc_size) | |
134 | #define __alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) | |
135 | #else | |
136 | #define __alloc_size(...) | |
137 | #endif | |
138 | #endif // __alloc_size | |
139 | ||
5b2abdfb | 140 | __BEGIN_DECLS |
9385eb3d A |
141 | void abort(void) __dead2; |
142 | int abs(int) __pure2; | |
974e3884 | 143 | int atexit(void (* _Nonnull)(void)); |
9385eb3d A |
144 | double atof(const char *); |
145 | int atoi(const char *); | |
146 | long atol(const char *); | |
3d9156a7 A |
147 | #if !__DARWIN_NO_LONG_LONG |
148 | long long | |
149 | atoll(const char *); | |
150 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
974e3884 A |
151 | void *bsearch(const void *__key, const void *__base, size_t __nel, |
152 | size_t __width, int (* _Nonnull __compar)(const void *, const void *)); | |
b061a43b | 153 | void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2); |
9385eb3d A |
154 | div_t div(int, int) __pure2; |
155 | void exit(int) __dead2; | |
156 | void free(void *); | |
157 | char *getenv(const char *); | |
158 | long labs(long) __pure2; | |
159 | ldiv_t ldiv(long, long) __pure2; | |
3d9156a7 A |
160 | #if !__DARWIN_NO_LONG_LONG |
161 | long long | |
162 | llabs(long long); | |
163 | lldiv_t lldiv(long long, long long); | |
164 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
b061a43b | 165 | void *malloc(size_t __size) __result_use_check __alloc_size(1); |
974e3884 | 166 | int mblen(const char *__s, size_t __n); |
9385eb3d A |
167 | size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); |
168 | int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); | |
974e3884 A |
169 | int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); |
170 | void qsort(void *__base, size_t __nel, size_t __width, | |
171 | int (* _Nonnull __compar)(const void *, const void *)); | |
172 | int rand(void) __swift_unavailable("Use arc4random instead."); | |
b061a43b | 173 | void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2); |
974e3884 | 174 | void srand(unsigned) __swift_unavailable("Use arc4random instead."); |
224c7076 A |
175 | double strtod(const char *, char **) __DARWIN_ALIAS(strtod); |
176 | float strtof(const char *, char **) __DARWIN_ALIAS(strtof); | |
974e3884 | 177 | long strtol(const char *__str, char **__endptr, int __base); |
9385eb3d | 178 | long double |
ad3c9f2a | 179 | strtold(const char *, char **); |
3d9156a7 A |
180 | #if !__DARWIN_NO_LONG_LONG |
181 | long long | |
974e3884 | 182 | strtoll(const char *__str, char **__endptr, int __base); |
3d9156a7 | 183 | #endif /* !__DARWIN_NO_LONG_LONG */ |
5b2abdfb | 184 | unsigned long |
974e3884 | 185 | strtoul(const char *__str, char **__endptr, int __base); |
3d9156a7 A |
186 | #if !__DARWIN_NO_LONG_LONG |
187 | unsigned long long | |
974e3884 | 188 | strtoull(const char *__str, char **__endptr, int __base); |
3d9156a7 | 189 | #endif /* !__DARWIN_NO_LONG_LONG */ |
224c7076 A |
190 | //Begin-Libc |
191 | #ifndef LIBC_ALIAS_SYSTEM | |
192 | //End-Libc | |
974e3884 A |
193 | |
194 | #if TARGET_OS_EMBEDDED | |
195 | #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg) | |
196 | #else | |
197 | #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg) | |
198 | #endif | |
199 | ||
200 | __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable") | |
b061a43b | 201 | __API_AVAILABLE(macos(10.0)) __IOS_PROHIBITED |
974e3884 A |
202 | __WATCHOS_PROHIBITED __TVOS_PROHIBITED |
203 | int system(const char *) __DARWIN_ALIAS_C(system); | |
224c7076 A |
204 | //Begin-Libc |
205 | #else /* LIBC_ALIAS_SYSTEM */ | |
206 | int system(const char *) LIBC_ALIAS_C(system); | |
207 | #endif /* !LIBC_ALIAS_SYSTEM */ | |
208 | //End-Libc | |
974e3884 A |
209 | |
210 | #undef __swift_unavailable_on | |
211 | ||
9385eb3d | 212 | size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); |
3d9156a7 | 213 | int wctomb(char *, wchar_t); |
5b2abdfb A |
214 | |
215 | #ifndef _ANSI_SOURCE | |
3d9156a7 A |
216 | void _Exit(int) __dead2; |
217 | long a64l(const char *); | |
9385eb3d | 218 | double drand48(void); |
3d9156a7 | 219 | char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ |
974e3884 | 220 | double erand48(unsigned short[3]); |
3d9156a7 A |
221 | char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ |
222 | char *gcvt(double, int, char *); /* LEGACY */ | |
223 | int getsubopt(char **, char * const *, char **); | |
224 | int grantpt(int); | |
225 | #if __DARWIN_UNIX03 | |
226 | char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ | |
227 | #else /* !__DARWIN_UNIX03 */ | |
228 | char *initstate(unsigned long, char *, long); | |
229 | #endif /* __DARWIN_UNIX03 */ | |
974e3884 | 230 | long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); |
3d9156a7 | 231 | char *l64a(long); |
9385eb3d | 232 | void lcong48(unsigned short[7]); |
974e3884 | 233 | long lrand48(void) __swift_unavailable("Use arc4random instead."); |
3d9156a7 A |
234 | char *mktemp(char *); |
235 | int mkstemp(char *); | |
974e3884 A |
236 | long mrand48(void) __swift_unavailable("Use arc4random instead."); |
237 | long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); | |
3d9156a7 A |
238 | int posix_openpt(int); |
239 | char *ptsname(int); | |
e07eda1a A |
240 | |
241 | #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) | |
242 | int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); | |
243 | #endif | |
244 | ||
224c7076 A |
245 | //Begin-Libc |
246 | #ifndef LIBC_ALIAS_PUTENV | |
247 | //End-Libc | |
3d9156a7 | 248 | int putenv(char *) __DARWIN_ALIAS(putenv); |
224c7076 A |
249 | //Begin-Libc |
250 | #else /* LIBC_ALIAS_PUTENV */ | |
251 | int putenv(char *) LIBC_ALIAS(putenv); | |
252 | #endif /* !LIBC_ALIAS_PUTENV */ | |
253 | //End-Libc | |
974e3884 A |
254 | long random(void) __swift_unavailable("Use arc4random instead."); |
255 | int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); | |
224c7076 A |
256 | //Begin-Libc |
257 | #ifdef __LIBC__ | |
258 | #ifndef LIBC_ALIAS_REALPATH | |
259 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); | |
260 | #else /* LIBC_ALIAS_REALPATH */ | |
261 | #ifdef VARIANT_DARWINEXTSN | |
262 | char *realpath(const char * __restrict, char * __restrict) LIBC_EXTSN(realpath); | |
263 | #else /* !VARIANT_DARWINEXTSN */ | |
264 | char *realpath(const char * __restrict, char * __restrict) LIBC_ALIAS(realpath); | |
265 | #endif /* VARIANT_DARWINEXTSN */ | |
266 | #endif /* !LIBC_ALIAS_REALPATH */ | |
267 | #else /* !__LIBC__ */ | |
268 | //End-Libc | |
269 | #if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH) | |
270 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); | |
271 | #else /* (!__DARWIN_UNIX03 || _POSIX_C_SOURCE) && !_DARWIN_C_SOURCE && !_DARWIN_BETTER_REALPATH */ | |
272 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath); | |
273 | #endif /* (__DARWIN_UNIX03 && _POSIX_C_SOURCE) || _DARWIN_C_SOURCE || _DARWIN_BETTER_REALPATH */ | |
274 | //Begin-Libc | |
275 | #endif /* __LIBC__ */ | |
276 | //End-Libc | |
9385eb3d A |
277 | unsigned short |
278 | *seed48(unsigned short[3]); | |
224c7076 A |
279 | //Begin-Libc |
280 | #ifndef LIBC_ALIAS_SETENV | |
281 | //End-Libc | |
974e3884 | 282 | int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); |
224c7076 A |
283 | //Begin-Libc |
284 | #else /* LIBC_ALIAS_SETENV */ | |
974e3884 | 285 | int setenv(const char * __name, const char * __value, int __overwrite) LIBC_ALIAS(setenv); |
224c7076 A |
286 | #endif /* !LIBC_ALIAS_SETENV */ |
287 | //End-Libc | |
3d9156a7 | 288 | #if __DARWIN_UNIX03 |
224c7076 A |
289 | //Begin-Libc |
290 | #ifndef LIBC_ALIAS_SETKEY | |
291 | //End-Libc | |
3d9156a7 | 292 | void setkey(const char *) __DARWIN_ALIAS(setkey); |
224c7076 A |
293 | //Begin-Libc |
294 | #else /* LIBC_ALIAS_SETKEY */ | |
295 | void setkey(const char *) LIBC_ALIAS(setkey); | |
296 | #endif /* !LIBC_ALIAS_SETKEY */ | |
297 | //End-Libc | |
3d9156a7 A |
298 | #else /* !__DARWIN_UNIX03 */ |
299 | int setkey(const char *); | |
300 | #endif /* __DARWIN_UNIX03 */ | |
301 | char *setstate(const char *); | |
9385eb3d | 302 | void srand48(long); |
3d9156a7 A |
303 | #if __DARWIN_UNIX03 |
304 | void srandom(unsigned); | |
305 | #else /* !__DARWIN_UNIX03 */ | |
306 | void srandom(unsigned long); | |
307 | #endif /* __DARWIN_UNIX03 */ | |
308 | int unlockpt(int); | |
309 | #if __DARWIN_UNIX03 | |
224c7076 A |
310 | //Begin-Libc |
311 | #ifndef LIBC_ALIAS_UNSETENV | |
312 | //End-Libc | |
3d9156a7 | 313 | int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); |
224c7076 A |
314 | //Begin-Libc |
315 | #else /* LIBC_ALIAS_UNSETENV */ | |
316 | int unsetenv(const char *) LIBC_ALIAS(unsetenv); | |
317 | #endif /* !LIBC_ALIAS_UNSETENV */ | |
318 | //End-Libc | |
3d9156a7 A |
319 | #else /* !__DARWIN_UNIX03 */ |
320 | void unsetenv(const char *); | |
321 | #endif /* __DARWIN_UNIX03 */ | |
224c7076 | 322 | #endif /* !_ANSI_SOURCE */ |
3d9156a7 | 323 | |
224c7076 | 324 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
3d9156a7 A |
325 | #include <machine/types.h> |
326 | ||
6465356a A |
327 | #include <sys/_types/_dev_t.h> |
328 | #include <sys/_types/_mode_t.h> | |
974e3884 | 329 | #include <_types/_uint32_t.h> |
3d9156a7 | 330 | |
974e3884 A |
331 | uint32_t arc4random(void); |
332 | void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) | |
333 | __OSX_DEPRECATED(10.0, 10.12, "use arc4random_stir") | |
334 | __IOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") | |
335 | __TVOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") | |
336 | __WATCHOS_DEPRECATED(1.0, 3.0, "use arc4random_stir"); | |
337 | void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
3d9156a7 | 338 | void arc4random_stir(void); |
974e3884 A |
339 | uint32_t |
340 | arc4random_uniform(uint32_t __upper_bound) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
34e8f829 | 341 | #ifdef __BLOCKS__ |
974e3884 A |
342 | int atexit_b(void (^ _Nonnull)(void)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); |
343 | void *bsearch_b(const void *__key, const void *__base, size_t __nel, | |
344 | size_t __width, int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 345 | #endif /* __BLOCKS__ */ |
9385eb3d A |
346 | |
347 | /* getcap(3) functions */ | |
348 | char *cgetcap(char *, const char *, int); | |
349 | int cgetclose(void); | |
350 | int cgetent(char **, char **, const char *); | |
351 | int cgetfirst(char **, char **); | |
352 | int cgetmatch(const char *, const char *); | |
353 | int cgetnext(char **, char **); | |
354 | int cgetnum(char *, const char *, long *); | |
355 | int cgetset(const char *); | |
356 | int cgetstr(char *, const char *, char **); | |
357 | int cgetustr(char *, const char *, char **); | |
358 | ||
5f125488 | 359 | int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED; |
3d9156a7 A |
360 | char *devname(dev_t, mode_t); |
361 | char *devname_r(dev_t, mode_t, char *buf, int len); | |
9385eb3d A |
362 | char *getbsize(int *, long *); |
363 | int getloadavg(double [], int); | |
364 | const char | |
365 | *getprogname(void); | |
366 | ||
974e3884 A |
367 | int heapsort(void *__base, size_t __nel, size_t __width, |
368 | int (* _Nonnull __compar)(const void *, const void *)); | |
34e8f829 | 369 | #ifdef __BLOCKS__ |
974e3884 A |
370 | int heapsort_b(void *__base, size_t __nel, size_t __width, |
371 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 372 | #endif /* __BLOCKS__ */ |
974e3884 A |
373 | int mergesort(void *__base, size_t __nel, size_t __width, |
374 | int (* _Nonnull __compar)(const void *, const void *)); | |
34e8f829 | 375 | #ifdef __BLOCKS__ |
974e3884 A |
376 | int mergesort_b(void *__base, size_t __nel, size_t __width, |
377 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 378 | #endif /* __BLOCKS__ */ |
974e3884 A |
379 | void psort(void *__base, size_t __nel, size_t __width, |
380 | int (* _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 381 | #ifdef __BLOCKS__ |
974e3884 A |
382 | void psort_b(void *__base, size_t __nel, size_t __width, |
383 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 384 | #endif /* __BLOCKS__ */ |
974e3884 A |
385 | void psort_r(void *__base, size_t __nel, size_t __width, void *, |
386 | int (* _Nonnull __compar)(void *, const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 387 | #ifdef __BLOCKS__ |
974e3884 A |
388 | void qsort_b(void *__base, size_t __nel, size_t __width, |
389 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 390 | #endif /* __BLOCKS__ */ |
974e3884 A |
391 | void qsort_r(void *__base, size_t __nel, size_t __width, void *, |
392 | int (* _Nonnull __compar)(void *, const void *, const void *)); | |
393 | int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, | |
394 | unsigned __endbyte); | |
9385eb3d | 395 | void setprogname(const char *); |
974e3884 A |
396 | int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, |
397 | unsigned __endbyte); | |
9385eb3d A |
398 | void sranddev(void); |
399 | void srandomdev(void); | |
b061a43b | 400 | void *reallocf(void *__ptr, size_t __size) __alloc_size(2); |
3d9156a7 | 401 | #if !__DARWIN_NO_LONG_LONG |
5b2abdfb | 402 | long long |
974e3884 | 403 | strtoq(const char *__str, char **__endptr, int __base); |
5b2abdfb | 404 | unsigned long long |
974e3884 | 405 | strtouq(const char *__str, char **__endptr, int __base); |
3d9156a7 A |
406 | #endif /* !__DARWIN_NO_LONG_LONG */ |
407 | extern char *suboptarg; /* getsubopt(3) external variable */ | |
b061a43b | 408 | void *valloc(size_t) __alloc_size(1); |
224c7076 A |
409 | #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ |
410 | ||
411 | /* Poison the following routines if -fshort-wchar is set */ | |
412 | #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU | |
413 | #pragma GCC poison mbstowcs mbtowc wcstombs wctomb | |
5b2abdfb A |
414 | #endif |
415 | __END_DECLS | |
416 | ||
3d9156a7 A |
417 | #ifdef _USE_EXTENDED_LOCALES_ |
418 | #include <xlocale/_stdlib.h> | |
419 | #endif /* _USE_EXTENDED_LOCALES_ */ | |
420 | ||
5b2abdfb | 421 | #endif /* _STDLIB_H_ */ |