xref: /freebsd/include/stdlib.h (revision 16545cf5d5f51cb67c03923cbb9c75a024bdaca8)
159deaec5SRodney W. Grimes /*-
22321c474SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
32321c474SPedro F. Giffuni  *
459deaec5SRodney W. Grimes  * Copyright (c) 1990, 1993
559deaec5SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
659deaec5SRodney W. Grimes  *
759deaec5SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
859deaec5SRodney W. Grimes  * modification, are permitted provided that the following conditions
959deaec5SRodney W. Grimes  * are met:
1059deaec5SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
1159deaec5SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
1259deaec5SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
1359deaec5SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
1459deaec5SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15f2556687SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
1659deaec5SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
1759deaec5SRodney W. Grimes  *    without specific prior written permission.
1859deaec5SRodney W. Grimes  *
1959deaec5SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2059deaec5SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2159deaec5SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2259deaec5SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2359deaec5SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2459deaec5SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2559deaec5SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2659deaec5SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2759deaec5SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2859deaec5SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2959deaec5SRodney W. Grimes  * SUCH DAMAGE.
3059deaec5SRodney W. Grimes  *
31c59376afSPeter Wemm  *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
32dea750aeSBruce Evans  * $FreeBSD$
3359deaec5SRodney W. Grimes  */
3459deaec5SRodney W. Grimes 
3559deaec5SRodney W. Grimes #ifndef _STDLIB_H_
3659deaec5SRodney W. Grimes #define	_STDLIB_H_
3759deaec5SRodney W. Grimes 
3885b46962SBruce Evans #include <sys/cdefs.h>
3912eb46c8SMarcel Moolenaar #include <sys/_null.h>
40abbd8902SMike Barcroft #include <sys/_types.h>
4159deaec5SRodney W. Grimes 
42649702c5SPedro F. Giffuni __NULLABILITY_PRAGMA_PUSH
43649702c5SPedro F. Giffuni 
443ecc48e2SGarrett Wollman #if __BSD_VISIBLE
45abbd8902SMike Barcroft #ifndef _RUNE_T_DECLARED
46abbd8902SMike Barcroft typedef	__rune_t	rune_t;
47abbd8902SMike Barcroft #define	_RUNE_T_DECLARED
48cdd84b02SBruce Evans #endif
49cdd84b02SBruce Evans #endif
50cdd84b02SBruce Evans 
51abbd8902SMike Barcroft #ifndef _SIZE_T_DECLARED
52abbd8902SMike Barcroft typedef	__size_t	size_t;
53abbd8902SMike Barcroft #define	_SIZE_T_DECLARED
5459deaec5SRodney W. Grimes #endif
5559deaec5SRodney W. Grimes 
566087d244SDavid E. O'Brien #ifndef	__cplusplus
57abbd8902SMike Barcroft #ifndef _WCHAR_T_DECLARED
580a4c54d6STijl Coosemans typedef	___wchar_t	wchar_t;
59abbd8902SMike Barcroft #define	_WCHAR_T_DECLARED
6059deaec5SRodney W. Grimes #endif
616087d244SDavid E. O'Brien #endif
6259deaec5SRodney W. Grimes 
6359deaec5SRodney W. Grimes typedef struct {
6459deaec5SRodney W. Grimes 	int	quot;		/* quotient */
6559deaec5SRodney W. Grimes 	int	rem;		/* remainder */
6659deaec5SRodney W. Grimes } div_t;
6759deaec5SRodney W. Grimes 
6859deaec5SRodney W. Grimes typedef struct {
69a4c8a68cSBruce Evans 	long	quot;
70a4c8a68cSBruce Evans 	long	rem;
7159deaec5SRodney W. Grimes } ldiv_t;
7259deaec5SRodney W. Grimes 
7359deaec5SRodney W. Grimes #define	EXIT_FAILURE	1
7459deaec5SRodney W. Grimes #define	EXIT_SUCCESS	0
7559deaec5SRodney W. Grimes 
76476d9314SAndrey A. Chernov #define	RAND_MAX	0x7ffffffd
7759deaec5SRodney W. Grimes 
7859deaec5SRodney W. Grimes __BEGIN_DECLS
793ac9d659SDavid Chisnall #ifdef _XLOCALE_H_
803ac9d659SDavid Chisnall #include <xlocale/_stdlib.h>
813ac9d659SDavid Chisnall #endif
823c87aa1dSDavid Chisnall extern int __mb_cur_max;
833c87aa1dSDavid Chisnall extern int ___mb_cur_max(void);
84822b22a9SEd Schouten #define	MB_CUR_MAX	((size_t)___mb_cur_max())
853c87aa1dSDavid Chisnall 
8657979d1bSDavid Chisnall _Noreturn void	 abort(void);
87bb28f3c2SWarner Losh int	 abs(int) __pure2;
88649702c5SPedro F. Giffuni int	 atexit(void (* _Nonnull)(void));
89bb28f3c2SWarner Losh double	 atof(const char *);
90bb28f3c2SWarner Losh int	 atoi(const char *);
91bb28f3c2SWarner Losh long	 atol(const char *);
92bb28f3c2SWarner Losh void	*bsearch(const void *, const void *, size_t,
93649702c5SPedro F. Giffuni 	    size_t, int (*)(const void * _Nonnull, const void *));
94153cbcd6SPedro F. Giffuni void	*calloc(size_t, size_t) __malloc_like __result_use_check
95153cbcd6SPedro F. Giffuni 	     __alloc_size(1) __alloc_size(2);
96bb28f3c2SWarner Losh div_t	 div(int, int) __pure2;
9757979d1bSDavid Chisnall _Noreturn void	 exit(int);
98bb28f3c2SWarner Losh void	 free(void *);
99bb28f3c2SWarner Losh char	*getenv(const char *);
100bb28f3c2SWarner Losh long	 labs(long) __pure2;
101bb28f3c2SWarner Losh ldiv_t	 ldiv(long, long) __pure2;
102153cbcd6SPedro F. Giffuni void	*malloc(size_t) __malloc_like __result_use_check __alloc_size(1);
1033ecc48e2SGarrett Wollman int	 mblen(const char *, size_t);
1043ecc48e2SGarrett Wollman size_t	 mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
1053ecc48e2SGarrett Wollman int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
106bb28f3c2SWarner Losh void	 qsort(void *, size_t, size_t,
107649702c5SPedro F. Giffuni 	    int (* _Nonnull)(const void *, const void *));
108bb28f3c2SWarner Losh int	 rand(void);
109153cbcd6SPedro F. Giffuni void	*realloc(void *, size_t) __result_use_check __alloc_size(2);
110bb28f3c2SWarner Losh void	 srand(unsigned);
1115618f724SRobert Drehmel double	 strtod(const char * __restrict, char ** __restrict);
1126a66acb5SDavid Schultz float	 strtof(const char * __restrict, char ** __restrict);
1135618f724SRobert Drehmel long	 strtol(const char * __restrict, char ** __restrict, int);
1146a66acb5SDavid Schultz long double
1156a66acb5SDavid Schultz 	 strtold(const char * __restrict, char ** __restrict);
11659deaec5SRodney W. Grimes unsigned long
1175618f724SRobert Drehmel 	 strtoul(const char * __restrict, char ** __restrict, int);
118bb28f3c2SWarner Losh int	 system(const char *);
119bb28f3c2SWarner Losh int	 wctomb(char *, wchar_t);
1209771f1e2STim J. Robbins size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
12159deaec5SRodney W. Grimes 
1223ecc48e2SGarrett Wollman /*
1233ecc48e2SGarrett Wollman  * Functions added in C99 which we make conditionally available in the
1243ecc48e2SGarrett Wollman  * BSD^C89 namespace if the compiler supports `long long'.
1253ecc48e2SGarrett Wollman  * The #if test is more complicated than it ought to be because
1263ecc48e2SGarrett Wollman  * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
1273ecc48e2SGarrett Wollman  * is not supported in the compilation environment (which therefore means
1283ecc48e2SGarrett Wollman  * that it can't really be ISO C99).
1293ecc48e2SGarrett Wollman  *
1303ecc48e2SGarrett Wollman  * (The only other extension made by C99 in thie header is _Exit().)
1313ecc48e2SGarrett Wollman  */
1324ec98362SDimitry Andric #if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus)
1333ecc48e2SGarrett Wollman #ifdef __LONG_LONG_SUPPORTED
1343ecc48e2SGarrett Wollman /* LONGLONG */
1353ecc48e2SGarrett Wollman typedef struct {
1363ecc48e2SGarrett Wollman 	long long quot;
1373ecc48e2SGarrett Wollman 	long long rem;
1383ecc48e2SGarrett Wollman } lldiv_t;
139798c1fd8SPoul-Henning Kamp 
1403ecc48e2SGarrett Wollman /* LONGLONG */
1413ecc48e2SGarrett Wollman long long
1423ecc48e2SGarrett Wollman 	 atoll(const char *);
1433ecc48e2SGarrett Wollman /* LONGLONG */
1443ecc48e2SGarrett Wollman long long
1453ecc48e2SGarrett Wollman 	 llabs(long long) __pure2;
1463ecc48e2SGarrett Wollman /* LONGLONG */
1473ecc48e2SGarrett Wollman lldiv_t	 lldiv(long long, long long) __pure2;
1483ecc48e2SGarrett Wollman /* LONGLONG */
1493ecc48e2SGarrett Wollman long long
1503ecc48e2SGarrett Wollman 	 strtoll(const char * __restrict, char ** __restrict, int);
1513ecc48e2SGarrett Wollman /* LONGLONG */
1523ecc48e2SGarrett Wollman unsigned long long
1533ecc48e2SGarrett Wollman 	 strtoull(const char * __restrict, char ** __restrict, int);
1543ecc48e2SGarrett Wollman #endif /* __LONG_LONG_SUPPORTED */
1553ecc48e2SGarrett Wollman 
15657979d1bSDavid Chisnall _Noreturn void	 _Exit(int);
1573ecc48e2SGarrett Wollman #endif /* __ISO_C_VISIBLE >= 1999 */
1583ecc48e2SGarrett Wollman 
1593ecc48e2SGarrett Wollman /*
1605d8c5f69SEd Schouten  * If we're in a mode greater than C99, expose C11 functions.
1610a31efe0SDavid Chisnall  */
16279d09835SDavid Chisnall #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
163ee90489bSPedro F. Giffuni void *	aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
164ee90489bSPedro F. Giffuni 	    __alloc_size(2);
1655d8c5f69SEd Schouten int	at_quick_exit(void (*)(void));
166b1214a51SEd Schouten _Noreturn void
167b1214a51SEd Schouten 	quick_exit(int);
168b1214a51SEd Schouten #endif /* __ISO_C_VISIBLE >= 2011 */
1690a31efe0SDavid Chisnall /*
170e45e1f27SJilles Tjoelker  * Extensions made by POSIX relative to C.
1713ecc48e2SGarrett Wollman  */
172e45e1f27SJilles Tjoelker #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
173585b8e0fSKonstantin Belousov char	*realpath(const char * __restrict, char * __restrict);
174e45e1f27SJilles Tjoelker #endif
175e45e1f27SJilles Tjoelker #if __POSIX_VISIBLE >= 199506
176e45e1f27SJilles Tjoelker int	 rand_r(unsigned *);			/* (TSF) */
177e45e1f27SJilles Tjoelker #endif
178e45e1f27SJilles Tjoelker #if __POSIX_VISIBLE >= 200112
179f1b298adSPedro F. Giffuni int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
180bb28f3c2SWarner Losh int	 setenv(const char *, const char *, int);
1812966d28cSSean Farley int	 unsetenv(const char *);
1823ecc48e2SGarrett Wollman #endif
18359deaec5SRodney W. Grimes 
18465e8b129SDavid Schultz #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
18565e8b129SDavid Schultz int	 getsubopt(char **, char *const *, char **);
18665e8b129SDavid Schultz #ifndef _MKDTEMP_DECLARED
18765e8b129SDavid Schultz char	*mkdtemp(char *);
18865e8b129SDavid Schultz #define	_MKDTEMP_DECLARED
18965e8b129SDavid Schultz #endif
19065e8b129SDavid Schultz #ifndef _MKSTEMP_DECLARED
19165e8b129SDavid Schultz int	 mkstemp(char *);
19265e8b129SDavid Schultz #define	_MKSTEMP_DECLARED
19365e8b129SDavid Schultz #endif
19465e8b129SDavid Schultz #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
19565e8b129SDavid Schultz 
1963ecc48e2SGarrett Wollman /*
1973ecc48e2SGarrett Wollman  * The only changes to the XSI namespace in revision 6 were the deletion
1983ecc48e2SGarrett Wollman  * of the ttyslot() and valloc() functions, which FreeBSD never declared
1993ecc48e2SGarrett Wollman  * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which
2003ecc48e2SGarrett Wollman  * FreeBSD also does not have, and mktemp(), are to be deleted.
2013ecc48e2SGarrett Wollman  */
2023ecc48e2SGarrett Wollman #if __XSI_VISIBLE
2033ecc48e2SGarrett Wollman /* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */
204257551c6STom Rhodes long	 a64l(const char *);
205bb28f3c2SWarner Losh double	 drand48(void);
2063ecc48e2SGarrett Wollman /* char	*ecvt(double, int, int * __restrict, int * __restrict); */
207bb28f3c2SWarner Losh double	 erand48(unsigned short[3]);
2083ecc48e2SGarrett Wollman /* char	*fcvt(double, int, int * __restrict, int * __restrict); */
2093ecc48e2SGarrett Wollman /* char	*gcvt(double, int, int * __restrict, int * __restrict); */
210d3951ad1SJuli Mallett int	 grantpt(int);
2118de6c267SEd Schouten char	*initstate(unsigned int, char *, size_t);
212bb28f3c2SWarner Losh long	 jrand48(unsigned short[3]);
213257551c6STom Rhodes char	*l64a(long);
214bb28f3c2SWarner Losh void	 lcong48(unsigned short[7]);
215bb28f3c2SWarner Losh long	 lrand48(void);
216d9c43159SDavid Schultz #if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)
2173ecc48e2SGarrett Wollman char	*mktemp(char *);
2183ecc48e2SGarrett Wollman #define	_MKTEMP_DECLARED
2193ecc48e2SGarrett Wollman #endif
220bb28f3c2SWarner Losh long	 mrand48(void);
221bb28f3c2SWarner Losh long	 nrand48(unsigned short[3]);
222d3951ad1SJuli Mallett int	 posix_openpt(int);
223d3951ad1SJuli Mallett char	*ptsname(int);
2242966d28cSSean Farley int	 putenv(char *);
2253ecc48e2SGarrett Wollman long	 random(void);
22667c54240SBruce Evans unsigned short
227bb28f3c2SWarner Losh 	*seed48(unsigned short[3]);
2283ecc48e2SGarrett Wollman char	*setstate(/* const */ char *);
229bb28f3c2SWarner Losh void	 srand48(long);
2308de6c267SEd Schouten void	 srandom(unsigned int);
231d3951ad1SJuli Mallett int	 unlockpt(int);
2323ecc48e2SGarrett Wollman #endif /* __XSI_VISIBLE */
2333ecc48e2SGarrett Wollman 
2343ecc48e2SGarrett Wollman #if __BSD_VISIBLE
235a4bd5210SJason Evans extern const char *malloc_conf;
236a4bd5210SJason Evans extern void (*malloc_message)(void *, const char *);
237f8f6d0dcSAndreas Schulz 
23879806b4cSDag-Erling Smørgrav /*
23979806b4cSDag-Erling Smørgrav  * The alloca() function can't be implemented in C, and on some
24079806b4cSDag-Erling Smørgrav  * platforms it can't be implemented at all as a callable function.
241383f241dSKonstantin Belousov  * The GNU C compiler provides a built-in alloca() which we can use.
242383f241dSKonstantin Belousov  * On platforms where alloca() is not in libc, programs which use it
243383f241dSKonstantin Belousov  * will fail to link when compiled with non-GNU compilers.
24479806b4cSDag-Erling Smørgrav  */
245d7875fc3SDavid E. O'Brien #if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
246d7875fc3SDavid E. O'Brien #undef  alloca	/* some GNU bits try to get cute and define this on their own */
24779806b4cSDag-Erling Smørgrav #define alloca(sz) __builtin_alloca(sz)
24879806b4cSDag-Erling Smørgrav #endif
24979806b4cSDag-Erling Smørgrav 
250b38a55d4SDavid Schultz void	 abort2(const char *, int, void **) __dead2;
2518252a465SDmitrij Tejblum __uint32_t
252bb28f3c2SWarner Losh 	 arc4random(void);
2533204108bSAndrey A. Chernov void	 arc4random_addrandom(unsigned char *, int);
2543204108bSAndrey A. Chernov void	 arc4random_buf(void *, size_t);
255bb28f3c2SWarner Losh void	 arc4random_stir(void);
256c0046493SAndrey A. Chernov __uint32_t
257c0046493SAndrey A. Chernov 	 arc4random_uniform(__uint32_t);
258f4189cd6SPedro F. Giffuni #ifdef __BLOCKS__
259649702c5SPedro F. Giffuni int	 atexit_b(void (^ _Nonnull)(void));
260f4189cd6SPedro F. Giffuni void	*bsearch_b(const void *, const void *, size_t,
261649702c5SPedro F. Giffuni 	    size_t, int (^ _Nonnull)(const void *, const void *));
262f4189cd6SPedro F. Giffuni #endif
263c2e55537SDavid E. O'Brien char	*getbsize(int *, long *);
2643ecc48e2SGarrett Wollman 					/* getcap(3) functions */
265bb28f3c2SWarner Losh char	*cgetcap(char *, const char *, int);
266bb28f3c2SWarner Losh int	 cgetclose(void);
267bb28f3c2SWarner Losh int	 cgetent(char **, char **, const char *);
268bb28f3c2SWarner Losh int	 cgetfirst(char **, char **);
269bb28f3c2SWarner Losh int	 cgetmatch(const char *, const char *);
270bb28f3c2SWarner Losh int	 cgetnext(char **, char **);
271bb28f3c2SWarner Losh int	 cgetnum(char *, const char *, long *);
272bb28f3c2SWarner Losh int	 cgetset(const char *);
273bb28f3c2SWarner Losh int	 cgetstr(char *, const char *, char **);
274bb28f3c2SWarner Losh int	 cgetustr(char *, const char *, char **);
27559deaec5SRodney W. Grimes 
276bb28f3c2SWarner Losh int	 daemon(int, int);
277*16545cf5SMariusz Zaborski int	 daemonfd(int, int);
2789d301680SStefan Farfeleder char	*devname(__dev_t, __mode_t);
2799d301680SStefan Farfeleder char	*devname_r(__dev_t, __mode_t, char *, int);
28026d4f5e9SEd Schouten char	*fdevname(int);
28126d4f5e9SEd Schouten char	*fdevname_r(int, char *, int);
282bb28f3c2SWarner Losh int	 getloadavg(double [], int);
283f6ab8089SEd Schouten const char *
284bb28f3c2SWarner Losh 	 getprogname(void);
28559deaec5SRodney W. Grimes 
286649702c5SPedro F. Giffuni int	 heapsort(void *, size_t, size_t,
287649702c5SPedro F. Giffuni 	    int (* _Nonnull)(const void *, const void *));
28846cdc140SDavid Chisnall #ifdef __BLOCKS__
289649702c5SPedro F. Giffuni int	 heapsort_b(void *, size_t, size_t,
290649702c5SPedro F. Giffuni 	    int (^ _Nonnull)(const void *, const void *));
291f4189cd6SPedro F. Giffuni void	 qsort_b(void *, size_t, size_t,
292649702c5SPedro F. Giffuni 	    int (^ _Nonnull)(const void *, const void *));
29346cdc140SDavid Chisnall #endif
294257551c6STom Rhodes int	 l64a_r(long, char *, int);
295bb28f3c2SWarner Losh int	 mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
29646cdc140SDavid Chisnall #ifdef __BLOCKS__
29746cdc140SDavid Chisnall int	 mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
29846cdc140SDavid Chisnall #endif
29965ba8dffSJilles Tjoelker int	 mkostemp(char *, int);
30065ba8dffSJilles Tjoelker int	 mkostemps(char *, int, int);
3010855f655SGarrett Wollman void	 qsort_r(void *, size_t, size_t, void *,
3020855f655SGarrett Wollman 	    int (*)(void *, const void *, const void *));
303bb28f3c2SWarner Losh int	 radixsort(const unsigned char **, int, const unsigned char *,
304bb28f3c2SWarner Losh 	    unsigned);
3058f0baadaSBaptiste Daroussin void	*reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
3068f0baadaSBaptiste Daroussin 	    __alloc_size(3);
307d0e9981eSPedro F. Giffuni void	*reallocf(void *, size_t) __alloc_size(2);
30817ebe400STim J. Robbins int	 rpmatch(const char *);
309bb28f3c2SWarner Losh void	 setprogname(const char *);
3100855f655SGarrett Wollman int	 sradixsort(const unsigned char **, int, const unsigned char *,
3110855f655SGarrett Wollman 	    unsigned);
312bb28f3c2SWarner Losh void	 sranddev(void);
313bb28f3c2SWarner Losh void	 srandomdev(void);
314c74dfa2fSAndre Oppermann long long
315c74dfa2fSAndre Oppermann 	strtonum(const char *, long long, long long, const char **);
3163ecc48e2SGarrett Wollman 
31710723054SPedro F. Giffuni /* Deprecated interfaces, to be removed. */
318a4c8a68cSBruce Evans __int64_t
319a4c8a68cSBruce Evans 	 strtoq(const char *, char **, int);
3208252a465SDmitrij Tejblum __uint64_t
321bb28f3c2SWarner Losh 	 strtouq(const char *, char **, int);
3228720578dSAndrey A. Chernov 
3238720578dSAndrey A. Chernov extern char *suboptarg;			/* getsubopt(3) external variable */
3243ecc48e2SGarrett Wollman #endif /* __BSD_VISIBLE */
3259851b340SKonstantin Belousov 
3269851b340SKonstantin Belousov #if __EXT1_VISIBLE
3279851b340SKonstantin Belousov 
3289851b340SKonstantin Belousov #ifndef _ERRNO_T_DEFINED
3299851b340SKonstantin Belousov #define _ERRNO_T_DEFINED
3309851b340SKonstantin Belousov typedef int errno_t;
3319851b340SKonstantin Belousov #endif
3329851b340SKonstantin Belousov 
3339851b340SKonstantin Belousov /* K.3.6 */
3349851b340SKonstantin Belousov typedef void (*constraint_handler_t)(const char * __restrict,
3359851b340SKonstantin Belousov     void * __restrict, errno_t);
3369851b340SKonstantin Belousov /* K.3.6.1.1 */
3379851b340SKonstantin Belousov constraint_handler_t set_constraint_handler_s(constraint_handler_t handler);
3389851b340SKonstantin Belousov /* K.3.6.1.2 */
3399851b340SKonstantin Belousov _Noreturn void abort_handler_s(const char * __restrict, void * __restrict,
3409851b340SKonstantin Belousov     errno_t);
3419851b340SKonstantin Belousov /* K3.6.1.3 */
3429851b340SKonstantin Belousov void ignore_handler_s(const char * __restrict, void * __restrict, errno_t);
3439851b340SKonstantin Belousov #endif /* __EXT1_VISIBLE */
3449851b340SKonstantin Belousov 
34559deaec5SRodney W. Grimes __END_DECLS
346649702c5SPedro F. Giffuni __NULLABILITY_PRAGMA_POP
34759deaec5SRodney W. Grimes 
34867c54240SBruce Evans #endif /* !_STDLIB_H_ */
349