]>
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> |
70ad1dc8 | 62 | #include <sys/cdefs.h> |
224c7076 | 63 | |
3d9156a7 A |
64 | #include <_types.h> |
65 | #if !defined(_ANSI_SOURCE) | |
66 | #include <sys/wait.h> | |
224c7076 | 67 | #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
9385eb3d | 68 | #include <alloca.h> |
224c7076 | 69 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ |
3d9156a7 | 70 | #endif /* !_ANSI_SOURCE */ |
5b2abdfb | 71 | |
3d9156a7 A |
72 | /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: |
73 | * _GCC_SIZE_T */ | |
6465356a | 74 | #include <sys/_types/_size_t.h> |
5b2abdfb | 75 | |
224c7076 | 76 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
6465356a A |
77 | #include <sys/_types/_ct_rune_t.h> |
78 | #include <sys/_types/_rune_t.h> | |
224c7076 | 79 | #endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ |
5b2abdfb | 80 | |
6465356a | 81 | #include <sys/_types/_wchar_t.h> |
9385eb3d | 82 | |
5b2abdfb A |
83 | typedef struct { |
84 | int quot; /* quotient */ | |
85 | int rem; /* remainder */ | |
86 | } div_t; | |
87 | ||
88 | typedef struct { | |
89 | long quot; /* quotient */ | |
90 | long rem; /* remainder */ | |
91 | } ldiv_t; | |
92 | ||
3d9156a7 A |
93 | #if !__DARWIN_NO_LONG_LONG |
94 | typedef struct { | |
95 | long long quot; | |
96 | long long rem; | |
97 | } lldiv_t; | |
98 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
99 | ||
6465356a | 100 | #include <sys/_types/_null.h> |
5b2abdfb A |
101 | |
102 | #define EXIT_FAILURE 1 | |
103 | #define EXIT_SUCCESS 0 | |
104 | ||
105 | #define RAND_MAX 0x7fffffff | |
106 | ||
3d9156a7 A |
107 | #ifdef _USE_EXTENDED_LOCALES_ |
108 | #include <_xlocale.h> | |
109 | #endif /* _USE_EXTENDED_LOCALES_ */ | |
110 | ||
111 | #ifndef MB_CUR_MAX | |
112 | #ifdef _USE_EXTENDED_LOCALES_ | |
113 | #define MB_CUR_MAX (___mb_cur_max()) | |
114 | #ifndef MB_CUR_MAX_L | |
115 | #define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) | |
116 | #endif /* !MB_CUR_MAX_L */ | |
117 | #else /* !_USE_EXTENDED_LOCALES_ */ | |
5b2abdfb A |
118 | extern int __mb_cur_max; |
119 | #define MB_CUR_MAX __mb_cur_max | |
3d9156a7 A |
120 | #endif /* _USE_EXTENDED_LOCALES_ */ |
121 | #endif /* MB_CUR_MAX */ | |
5b2abdfb | 122 | |
224c7076 | 123 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) \ |
3d9156a7 A |
124 | && defined(_USE_EXTENDED_LOCALES_) && !defined(MB_CUR_MAX_L) |
125 | #define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) | |
126 | #endif | |
34e8f829 | 127 | //Begin-Libc |
5f125488 | 128 | #include "libc_private.h" |
34e8f829 A |
129 | /* f must be a literal string */ |
130 | #define LIBC_ABORT(f,...) abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__) | |
131 | //End-Libc | |
5b2abdfb | 132 | |
70ad1dc8 | 133 | #include <malloc/_malloc.h> |
b061a43b | 134 | |
5b2abdfb | 135 | __BEGIN_DECLS |
9385eb3d A |
136 | void abort(void) __dead2; |
137 | int abs(int) __pure2; | |
974e3884 | 138 | int atexit(void (* _Nonnull)(void)); |
9385eb3d A |
139 | double atof(const char *); |
140 | int atoi(const char *); | |
141 | long atol(const char *); | |
3d9156a7 A |
142 | #if !__DARWIN_NO_LONG_LONG |
143 | long long | |
144 | atoll(const char *); | |
145 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
974e3884 A |
146 | void *bsearch(const void *__key, const void *__base, size_t __nel, |
147 | size_t __width, int (* _Nonnull __compar)(const void *, const void *)); | |
70ad1dc8 | 148 | /* calloc is now declared in _malloc.h */ |
9385eb3d A |
149 | div_t div(int, int) __pure2; |
150 | void exit(int) __dead2; | |
70ad1dc8 | 151 | /* free is now declared in _malloc.h */ |
9385eb3d A |
152 | char *getenv(const char *); |
153 | long labs(long) __pure2; | |
154 | ldiv_t ldiv(long, long) __pure2; | |
3d9156a7 A |
155 | #if !__DARWIN_NO_LONG_LONG |
156 | long long | |
157 | llabs(long long); | |
158 | lldiv_t lldiv(long long, long long); | |
159 | #endif /* !__DARWIN_NO_LONG_LONG */ | |
70ad1dc8 | 160 | /* malloc is now declared in _malloc.h */ |
974e3884 | 161 | int mblen(const char *__s, size_t __n); |
9385eb3d A |
162 | size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); |
163 | int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); | |
70ad1dc8 | 164 | /* posix_memalign is now declared in _malloc.h */ |
974e3884 A |
165 | void qsort(void *__base, size_t __nel, size_t __width, |
166 | int (* _Nonnull __compar)(const void *, const void *)); | |
167 | int rand(void) __swift_unavailable("Use arc4random instead."); | |
70ad1dc8 | 168 | /* realloc is now declared in _malloc.h */ |
974e3884 | 169 | void srand(unsigned) __swift_unavailable("Use arc4random instead."); |
224c7076 A |
170 | double strtod(const char *, char **) __DARWIN_ALIAS(strtod); |
171 | float strtof(const char *, char **) __DARWIN_ALIAS(strtof); | |
974e3884 | 172 | long strtol(const char *__str, char **__endptr, int __base); |
9385eb3d | 173 | long double |
ad3c9f2a | 174 | strtold(const char *, char **); |
3d9156a7 A |
175 | #if !__DARWIN_NO_LONG_LONG |
176 | long long | |
974e3884 | 177 | strtoll(const char *__str, char **__endptr, int __base); |
3d9156a7 | 178 | #endif /* !__DARWIN_NO_LONG_LONG */ |
5b2abdfb | 179 | unsigned long |
974e3884 | 180 | strtoul(const char *__str, char **__endptr, int __base); |
3d9156a7 A |
181 | #if !__DARWIN_NO_LONG_LONG |
182 | unsigned long long | |
974e3884 | 183 | strtoull(const char *__str, char **__endptr, int __base); |
3d9156a7 | 184 | #endif /* !__DARWIN_NO_LONG_LONG */ |
224c7076 A |
185 | //Begin-Libc |
186 | #ifndef LIBC_ALIAS_SYSTEM | |
187 | //End-Libc | |
974e3884 A |
188 | |
189 | #if TARGET_OS_EMBEDDED | |
190 | #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg) | |
191 | #else | |
192 | #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg) | |
193 | #endif | |
194 | ||
195 | __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable") | |
b061a43b | 196 | __API_AVAILABLE(macos(10.0)) __IOS_PROHIBITED |
974e3884 A |
197 | __WATCHOS_PROHIBITED __TVOS_PROHIBITED |
198 | int system(const char *) __DARWIN_ALIAS_C(system); | |
224c7076 A |
199 | //Begin-Libc |
200 | #else /* LIBC_ALIAS_SYSTEM */ | |
201 | int system(const char *) LIBC_ALIAS_C(system); | |
202 | #endif /* !LIBC_ALIAS_SYSTEM */ | |
203 | //End-Libc | |
974e3884 A |
204 | |
205 | #undef __swift_unavailable_on | |
206 | ||
9385eb3d | 207 | size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); |
3d9156a7 | 208 | int wctomb(char *, wchar_t); |
5b2abdfb A |
209 | |
210 | #ifndef _ANSI_SOURCE | |
3d9156a7 A |
211 | void _Exit(int) __dead2; |
212 | long a64l(const char *); | |
9385eb3d | 213 | double drand48(void); |
3d9156a7 | 214 | char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ |
974e3884 | 215 | double erand48(unsigned short[3]); |
3d9156a7 A |
216 | char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ |
217 | char *gcvt(double, int, char *); /* LEGACY */ | |
218 | int getsubopt(char **, char * const *, char **); | |
219 | int grantpt(int); | |
220 | #if __DARWIN_UNIX03 | |
221 | char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ | |
222 | #else /* !__DARWIN_UNIX03 */ | |
223 | char *initstate(unsigned long, char *, long); | |
224 | #endif /* __DARWIN_UNIX03 */ | |
974e3884 | 225 | long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); |
3d9156a7 | 226 | char *l64a(long); |
9385eb3d | 227 | void lcong48(unsigned short[7]); |
974e3884 | 228 | long lrand48(void) __swift_unavailable("Use arc4random instead."); |
3d9156a7 A |
229 | char *mktemp(char *); |
230 | int mkstemp(char *); | |
974e3884 A |
231 | long mrand48(void) __swift_unavailable("Use arc4random instead."); |
232 | long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); | |
3d9156a7 A |
233 | int posix_openpt(int); |
234 | char *ptsname(int); | |
e07eda1a A |
235 | |
236 | #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) | |
237 | 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)); | |
238 | #endif | |
239 | ||
224c7076 A |
240 | //Begin-Libc |
241 | #ifndef LIBC_ALIAS_PUTENV | |
242 | //End-Libc | |
3d9156a7 | 243 | int putenv(char *) __DARWIN_ALIAS(putenv); |
224c7076 A |
244 | //Begin-Libc |
245 | #else /* LIBC_ALIAS_PUTENV */ | |
246 | int putenv(char *) LIBC_ALIAS(putenv); | |
247 | #endif /* !LIBC_ALIAS_PUTENV */ | |
248 | //End-Libc | |
974e3884 A |
249 | long random(void) __swift_unavailable("Use arc4random instead."); |
250 | int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); | |
224c7076 A |
251 | //Begin-Libc |
252 | #ifdef __LIBC__ | |
253 | #ifndef LIBC_ALIAS_REALPATH | |
254 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); | |
255 | #else /* LIBC_ALIAS_REALPATH */ | |
256 | #ifdef VARIANT_DARWINEXTSN | |
257 | char *realpath(const char * __restrict, char * __restrict) LIBC_EXTSN(realpath); | |
258 | #else /* !VARIANT_DARWINEXTSN */ | |
259 | char *realpath(const char * __restrict, char * __restrict) LIBC_ALIAS(realpath); | |
260 | #endif /* VARIANT_DARWINEXTSN */ | |
261 | #endif /* !LIBC_ALIAS_REALPATH */ | |
262 | #else /* !__LIBC__ */ | |
263 | //End-Libc | |
264 | #if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH) | |
265 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); | |
266 | #else /* (!__DARWIN_UNIX03 || _POSIX_C_SOURCE) && !_DARWIN_C_SOURCE && !_DARWIN_BETTER_REALPATH */ | |
267 | char *realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath); | |
268 | #endif /* (__DARWIN_UNIX03 && _POSIX_C_SOURCE) || _DARWIN_C_SOURCE || _DARWIN_BETTER_REALPATH */ | |
269 | //Begin-Libc | |
270 | #endif /* __LIBC__ */ | |
271 | //End-Libc | |
9385eb3d A |
272 | unsigned short |
273 | *seed48(unsigned short[3]); | |
224c7076 A |
274 | //Begin-Libc |
275 | #ifndef LIBC_ALIAS_SETENV | |
276 | //End-Libc | |
974e3884 | 277 | int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); |
224c7076 A |
278 | //Begin-Libc |
279 | #else /* LIBC_ALIAS_SETENV */ | |
974e3884 | 280 | int setenv(const char * __name, const char * __value, int __overwrite) LIBC_ALIAS(setenv); |
224c7076 A |
281 | #endif /* !LIBC_ALIAS_SETENV */ |
282 | //End-Libc | |
3d9156a7 | 283 | #if __DARWIN_UNIX03 |
224c7076 A |
284 | //Begin-Libc |
285 | #ifndef LIBC_ALIAS_SETKEY | |
286 | //End-Libc | |
3d9156a7 | 287 | void setkey(const char *) __DARWIN_ALIAS(setkey); |
224c7076 A |
288 | //Begin-Libc |
289 | #else /* LIBC_ALIAS_SETKEY */ | |
290 | void setkey(const char *) LIBC_ALIAS(setkey); | |
291 | #endif /* !LIBC_ALIAS_SETKEY */ | |
292 | //End-Libc | |
3d9156a7 A |
293 | #else /* !__DARWIN_UNIX03 */ |
294 | int setkey(const char *); | |
295 | #endif /* __DARWIN_UNIX03 */ | |
296 | char *setstate(const char *); | |
9385eb3d | 297 | void srand48(long); |
3d9156a7 A |
298 | #if __DARWIN_UNIX03 |
299 | void srandom(unsigned); | |
300 | #else /* !__DARWIN_UNIX03 */ | |
301 | void srandom(unsigned long); | |
302 | #endif /* __DARWIN_UNIX03 */ | |
303 | int unlockpt(int); | |
304 | #if __DARWIN_UNIX03 | |
224c7076 A |
305 | //Begin-Libc |
306 | #ifndef LIBC_ALIAS_UNSETENV | |
307 | //End-Libc | |
3d9156a7 | 308 | int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); |
224c7076 A |
309 | //Begin-Libc |
310 | #else /* LIBC_ALIAS_UNSETENV */ | |
311 | int unsetenv(const char *) LIBC_ALIAS(unsetenv); | |
312 | #endif /* !LIBC_ALIAS_UNSETENV */ | |
313 | //End-Libc | |
3d9156a7 A |
314 | #else /* !__DARWIN_UNIX03 */ |
315 | void unsetenv(const char *); | |
316 | #endif /* __DARWIN_UNIX03 */ | |
224c7076 | 317 | #endif /* !_ANSI_SOURCE */ |
3d9156a7 | 318 | |
224c7076 | 319 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
3d9156a7 A |
320 | #include <machine/types.h> |
321 | ||
6465356a A |
322 | #include <sys/_types/_dev_t.h> |
323 | #include <sys/_types/_mode_t.h> | |
974e3884 | 324 | #include <_types/_uint32_t.h> |
3d9156a7 | 325 | |
974e3884 A |
326 | uint32_t arc4random(void); |
327 | void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) | |
328 | __OSX_DEPRECATED(10.0, 10.12, "use arc4random_stir") | |
329 | __IOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") | |
330 | __TVOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") | |
331 | __WATCHOS_DEPRECATED(1.0, 3.0, "use arc4random_stir"); | |
332 | void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
3d9156a7 | 333 | void arc4random_stir(void); |
974e3884 A |
334 | uint32_t |
335 | arc4random_uniform(uint32_t __upper_bound) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
34e8f829 | 336 | #ifdef __BLOCKS__ |
974e3884 A |
337 | int atexit_b(void (^ _Nonnull)(void)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); |
338 | void *bsearch_b(const void *__key, const void *__base, size_t __nel, | |
339 | size_t __width, int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 340 | #endif /* __BLOCKS__ */ |
9385eb3d A |
341 | |
342 | /* getcap(3) functions */ | |
343 | char *cgetcap(char *, const char *, int); | |
344 | int cgetclose(void); | |
345 | int cgetent(char **, char **, const char *); | |
346 | int cgetfirst(char **, char **); | |
347 | int cgetmatch(const char *, const char *); | |
348 | int cgetnext(char **, char **); | |
349 | int cgetnum(char *, const char *, long *); | |
350 | int cgetset(const char *); | |
351 | int cgetstr(char *, const char *, char **); | |
352 | int cgetustr(char *, const char *, char **); | |
353 | ||
5f125488 | 354 | 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 |
355 | char *devname(dev_t, mode_t); |
356 | char *devname_r(dev_t, mode_t, char *buf, int len); | |
9385eb3d A |
357 | char *getbsize(int *, long *); |
358 | int getloadavg(double [], int); | |
359 | const char | |
360 | *getprogname(void); | |
361 | ||
974e3884 A |
362 | int heapsort(void *__base, size_t __nel, size_t __width, |
363 | int (* _Nonnull __compar)(const void *, const void *)); | |
34e8f829 | 364 | #ifdef __BLOCKS__ |
974e3884 A |
365 | int heapsort_b(void *__base, size_t __nel, size_t __width, |
366 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 367 | #endif /* __BLOCKS__ */ |
974e3884 A |
368 | int mergesort(void *__base, size_t __nel, size_t __width, |
369 | int (* _Nonnull __compar)(const void *, const void *)); | |
34e8f829 | 370 | #ifdef __BLOCKS__ |
974e3884 A |
371 | int mergesort_b(void *__base, size_t __nel, size_t __width, |
372 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 373 | #endif /* __BLOCKS__ */ |
974e3884 A |
374 | void psort(void *__base, size_t __nel, size_t __width, |
375 | int (* _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 376 | #ifdef __BLOCKS__ |
974e3884 A |
377 | void psort_b(void *__base, size_t __nel, size_t __width, |
378 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 379 | #endif /* __BLOCKS__ */ |
974e3884 A |
380 | void psort_r(void *__base, size_t __nel, size_t __width, void *, |
381 | int (* _Nonnull __compar)(void *, const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 382 | #ifdef __BLOCKS__ |
974e3884 A |
383 | void qsort_b(void *__base, size_t __nel, size_t __width, |
384 | int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
34e8f829 | 385 | #endif /* __BLOCKS__ */ |
974e3884 A |
386 | void qsort_r(void *__base, size_t __nel, size_t __width, void *, |
387 | int (* _Nonnull __compar)(void *, const void *, const void *)); | |
388 | int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, | |
389 | unsigned __endbyte); | |
9385eb3d | 390 | void setprogname(const char *); |
974e3884 A |
391 | int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, |
392 | unsigned __endbyte); | |
9385eb3d A |
393 | void sranddev(void); |
394 | void srandomdev(void); | |
b061a43b | 395 | void *reallocf(void *__ptr, size_t __size) __alloc_size(2); |
3d9156a7 | 396 | #if !__DARWIN_NO_LONG_LONG |
5b2abdfb | 397 | long long |
974e3884 | 398 | strtoq(const char *__str, char **__endptr, int __base); |
5b2abdfb | 399 | unsigned long long |
974e3884 | 400 | strtouq(const char *__str, char **__endptr, int __base); |
3d9156a7 A |
401 | #endif /* !__DARWIN_NO_LONG_LONG */ |
402 | extern char *suboptarg; /* getsubopt(3) external variable */ | |
70ad1dc8 | 403 | /* valloc is now declared in _malloc.h */ |
224c7076 A |
404 | #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ |
405 | ||
406 | /* Poison the following routines if -fshort-wchar is set */ | |
407 | #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU | |
408 | #pragma GCC poison mbstowcs mbtowc wcstombs wctomb | |
5b2abdfb A |
409 | #endif |
410 | __END_DECLS | |
411 | ||
3d9156a7 A |
412 | #ifdef _USE_EXTENDED_LOCALES_ |
413 | #include <xlocale/_stdlib.h> | |
414 | #endif /* _USE_EXTENDED_LOCALES_ */ | |
415 | ||
5b2abdfb | 416 | #endif /* _STDLIB_H_ */ |