4 * Definitions for common types, variables, and functions.
10 #include <machine/ieeefp.h>
14 #define __need_wchar_t
18 #include <sys/reent.h>
19 #include <sys/cdefs.h>
20 #include <machine/stdlib.h>
21 #ifndef __STRICT_ANSI__
26 #include <cygwin/stdlib.h>
30 #include <sys/_locale.h>
37 int quot
; /* quotient */
38 int rem
; /* remainder */
43 long quot
; /* quotient */
44 long rem
; /* remainder */
47 #if __ISO_C_VISIBLE >= 1999
50 long long int quot
; /* quotient */
51 long long int rem
; /* remainder */
55 #ifndef __compar_fn_t_defined
56 #define __compar_fn_t_defined
57 typedef int (*__compar_fn_t
) (const void *, const void *);
60 #define EXIT_FAILURE 1
61 #define EXIT_SUCCESS 0
63 #define RAND_MAX __RAND_MAX
65 int __locale_mb_cur_max (void);
67 #define MB_CUR_MAX __locale_mb_cur_max()
69 void abort (void) _ATTRIBUTE ((__noreturn__
));
72 __uint32_t
arc4random (void);
73 __uint32_t
arc4random_uniform (__uint32_t
);
74 void arc4random_buf (void *, size_t);
76 int atexit (void (*__func
)(void));
77 double atof (const char *__nptr
);
79 float atoff (const char *__nptr
);
81 int atoi (const char *__nptr
);
82 int _atoi_r (struct _reent
*, const char *__nptr
);
83 long atol (const char *__nptr
);
84 long _atol_r (struct _reent
*, const char *__nptr
);
85 void * bsearch (const void *__key
,
89 __compar_fn_t _compar
);
90 void *calloc(size_t, size_t) __malloc_like __result_use_check
91 __alloc_size2(1, 2) _NOTHROW
;
92 div_t div (int __numer
, int __denom
);
93 void exit (int __status
) _ATTRIBUTE ((__noreturn__
));
94 void free (void *) _NOTHROW
;
95 char * getenv (const char *__string
);
96 char * _getenv_r (struct _reent
*, const char *__string
);
98 char * secure_getenv (const char *__string
);
100 char * _findenv (const char *, int *);
101 char * _findenv_r (struct _reent
*, const char *, int *);
102 #if __POSIX_VISIBLE >= 200809
103 extern char *suboptarg
; /* getsubopt(3) external variable */
104 int getsubopt (char **, char * const *, char **);
107 ldiv_t ldiv (long __numer
, long __denom
);
108 void *malloc(size_t) __malloc_like __result_use_check
__alloc_size(1) _NOTHROW
;
109 int mblen (const char *, size_t);
110 int _mblen_r (struct _reent
*, const char *, size_t, _mbstate_t
*);
111 int mbtowc (wchar_t *__restrict
, const char *__restrict
, size_t);
112 int _mbtowc_r (struct _reent
*, wchar_t *__restrict
, const char *__restrict
, size_t, _mbstate_t
*);
113 int wctomb (char *, wchar_t);
114 int _wctomb_r (struct _reent
*, char *, wchar_t, _mbstate_t
*);
115 size_t mbstowcs (wchar_t *__restrict
, const char *__restrict
, size_t);
116 size_t _mbstowcs_r (struct _reent
*, wchar_t *__restrict
, const char *__restrict
, size_t, _mbstate_t
*);
117 size_t wcstombs (char *__restrict
, const wchar_t *__restrict
, size_t);
118 size_t _wcstombs_r (struct _reent
*, char *__restrict
, const wchar_t *__restrict
, size_t, _mbstate_t
*);
120 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
121 char * mkdtemp (char *);
124 int mkostemp (char *, int);
125 int mkostemps (char *, int, int);
127 #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
128 int mkstemp (char *);
131 int mkstemps (char *, int);
133 #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
134 char * mktemp (char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
136 #endif /* !_REENT_ONLY */
137 char * _mkdtemp_r (struct _reent
*, char *);
138 int _mkostemp_r (struct _reent
*, char *, int);
139 int _mkostemps_r (struct _reent
*, char *, int, int);
140 int _mkstemp_r (struct _reent
*, char *);
141 int _mkstemps_r (struct _reent
*, char *, int);
142 char * _mktemp_r (struct _reent
*, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
143 void qsort (void *__base
, size_t __nmemb
, size_t __size
, __compar_fn_t _compar
);
145 void *realloc(void *, size_t) __result_use_check
__alloc_size(2) _NOTHROW
;
147 void *reallocarray(void *, size_t, size_t) __result_use_check
__alloc_size2(2, 3);
148 void *reallocf(void *, size_t) __result_use_check
__alloc_size(2);
150 #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
151 char * realpath (const char *__restrict path
, char *__restrict resolved_path
);
154 int rpmatch (const char *response
);
157 void setkey (const char *__key
);
159 void srand (unsigned __seed
);
160 double strtod (const char *__restrict __n
, char **__restrict __end_PTR
);
161 double _strtod_r (struct _reent
*,const char *__restrict __n
, char **__restrict __end_PTR
);
162 #if __ISO_C_VISIBLE >= 1999
163 float strtof (const char *__restrict __n
, char **__restrict __end_PTR
);
166 /* the following strtodf interface is deprecated...use strtof instead */
168 # define strtodf strtof
171 long strtol (const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
172 long _strtol_r (struct _reent
*,const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
173 unsigned long strtoul (const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
174 unsigned long _strtoul_r (struct _reent
*,const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
177 double strtod_l (const char *__restrict
, char **__restrict
, locale_t
);
178 float strtof_l (const char *__restrict
, char **__restrict
, locale_t
);
179 #ifdef _HAVE_LONG_DOUBLE
180 extern long double strtold_l (const char *__restrict
, char **__restrict
,
182 #endif /* _HAVE_LONG_DOUBLE */
183 long strtol_l (const char *__restrict
, char **__restrict
, int, locale_t
);
184 unsigned long strtoul_l (const char *__restrict
, char **__restrict
, int,
186 long long strtoll_l (const char *__restrict
, char **__restrict
, int, locale_t
);
187 unsigned long long strtoull_l (const char *__restrict
, char **__restrict
, int,
191 int system (const char *__string
);
193 #if __SVID_VISIBLE || __XSI_VISIBLE >= 4
194 long a64l (const char *__input
);
195 char * l64a (long __input
);
196 char * _l64a_r (struct _reent
*,long __input
);
199 int on_exit (void (*__func
)(int, void *),void *__arg
);
201 #if __ISO_C_VISIBLE >= 1999
202 void _Exit (int __status
) _ATTRIBUTE ((__noreturn__
));
204 #if __SVID_VISIBLE || __XSI_VISIBLE
205 int putenv (char *__string
);
207 int _putenv_r (struct _reent
*, char *__string
);
208 void * _reallocf_r (struct _reent
*, void *, size_t);
209 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
210 int setenv (const char *__string
, const char *__value
, int __overwrite
);
212 int _setenv_r (struct _reent
*, const char *__string
, const char *__value
, int __overwrite
);
214 #if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112
215 char * gcvt (double,int,char *);
216 char * gcvtf (float,int,char *);
217 char * fcvt (double,int,int *,int *);
218 char * fcvtf (float,int,int *,int *);
219 char * ecvt (double,int,int *,int *);
220 char * ecvtbuf (double, int, int*, int*, char *);
221 char * fcvtbuf (double, int, int*, int*, char *);
222 char * ecvtf (float,int,int *,int *);
224 #if !defined (__CYGWIN__) || defined (_LIBC)
225 char * __itoa (int, char *, int);
226 char * __utoa (unsigned, char *, int);
228 char * itoa (int, char *, int);
229 char * utoa (unsigned, char *, int);
233 int rand_r (unsigned *__seed
);
236 #if __SVID_VISIBLE || __XSI_VISIBLE
237 double drand48 (void);
238 double _drand48_r (struct _reent
*);
239 double erand48 (unsigned short [3]);
240 double _erand48_r (struct _reent
*, unsigned short [3]);
241 long jrand48 (unsigned short [3]);
242 long _jrand48_r (struct _reent
*, unsigned short [3]);
243 void lcong48 (unsigned short [7]);
244 void _lcong48_r (struct _reent
*, unsigned short [7]);
246 long _lrand48_r (struct _reent
*);
248 long _mrand48_r (struct _reent
*);
249 long nrand48 (unsigned short [3]);
250 long _nrand48_r (struct _reent
*, unsigned short [3]);
252 seed48 (unsigned short [3]);
254 _seed48_r (struct _reent
*, unsigned short [3]);
256 void _srand48_r (struct _reent
*, long);
257 #endif /* __SVID_VISIBLE || __XSI_VISIBLE */
258 #if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
259 char * initstate (unsigned, char *, size_t);
261 char * setstate (char *);
262 void srandom (unsigned);
264 #if __ISO_C_VISIBLE >= 1999
265 long long atoll (const char *__nptr
);
267 long long _atoll_r (struct _reent
*, const char *__nptr
);
268 #if __ISO_C_VISIBLE >= 1999
269 long long llabs (long long);
270 lldiv_t
lldiv (long long __numer
, long long __denom
);
271 long long strtoll (const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
273 long long _strtoll_r (struct _reent
*, const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
274 #if __ISO_C_VISIBLE >= 1999
275 unsigned long long strtoull (const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
277 unsigned long long _strtoull_r (struct _reent
*, const char *__restrict __n
, char **__restrict __end_PTR
, int __base
);
283 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
284 int unsetenv (const char *__string
);
286 int _unsetenv_r (struct _reent
*, const char *__string
);
287 #endif /* !__CYGWIN__ */
289 #if __POSIX_VISIBLE >= 200112
290 int posix_memalign (void **, size_t, size_t) __nonnull((1))
294 char * _dtoa_r (struct _reent
*, double, int, int, int *, int*, char**);
296 void * _malloc_r (struct _reent
*, size_t) _NOTHROW
;
297 void * _calloc_r (struct _reent
*, size_t, size_t) _NOTHROW
;
298 void _free_r (struct _reent
*, void *) _NOTHROW
;
299 void * _realloc_r (struct _reent
*, void *, size_t) _NOTHROW
;
300 void _mstats_r (struct _reent
*, char *);
302 int _system_r (struct _reent
*, const char *);
304 void __eprintf (const char *, const char *, unsigned int, const char *);
306 /* There are two common qsort_r variants. If you request
307 _BSD_SOURCE, you get the BSD version; otherwise you get the GNU
308 version. We want that #undef qsort_r will still let you
309 invoke the underlying function, but that requires gcc support. */
311 void qsort_r (void *__base
, size_t __nmemb
, size_t __size
, int (*_compar
)(const void *, const void *, void *), void *__thunk
);
314 void qsort_r (void *__base
, size_t __nmemb
, size_t __size
, void *__thunk
, int (*_compar
)(void *, const void *, const void *))
315 __asm__ (__ASMNAME ("__bsd_qsort_r"));
317 void __bsd_qsort_r (void *__base
, size_t __nmemb
, size_t __size
, void *__thunk
, int (*_compar
)(void *, const void *, const void *));
318 # define qsort_r __bsd_qsort_r
322 /* On platforms where long double equals double. */
323 #ifdef _HAVE_LONG_DOUBLE
324 extern long double _strtold_r (struct _reent
*, const char *__restrict
, char **__restrict
);
325 #if __ISO_C_VISIBLE >= 1999
326 extern long double strtold (const char *__restrict
, char **__restrict
);
328 #endif /* _HAVE_LONG_DOUBLE */
331 * If we're in a mode greater than C99, expose C11 functions.
333 #if __ISO_C_VISIBLE >= 2011
334 void * aligned_alloc(size_t, size_t) __malloc_like
__alloc_align(1)
335 __alloc_size(2) __result_use_check
;
336 int at_quick_exit(void (*)(void));
339 #endif /* __ISO_C_VISIBLE >= 2011 */
343 #if __SSP_FORTIFY_LEVEL > 0
344 #include <ssp/stdlib.h>
347 #endif /* _STDLIB_H_ */