]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/include/stdlib.h
10 #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */
14 #define NULL ((void*)0)
17 #include <__header_stdlib.h>
23 #define __NEED_wchar_t
25 #include <bits/alltypes.h>
27 int atoi (const char *);
28 long atol (const char *);
29 long long atoll (const char *);
30 double atof (const char *);
32 float strtof (const char *__restrict
, char **__restrict
);
33 double strtod (const char *__restrict
, char **__restrict
);
34 long double strtold (const char *__restrict
, char **__restrict
);
36 long strtol (const char *__restrict
, char **__restrict
, int);
37 unsigned long strtoul (const char *__restrict
, char **__restrict
, int);
38 long long strtoll (const char *__restrict
, char **__restrict
, int);
39 unsigned long long strtoull (const char *__restrict
, char **__restrict
, int);
42 void srand (unsigned);
44 void *malloc (size_t);
45 void *calloc (size_t, size_t);
46 void *realloc (void *, size_t);
48 void *aligned_alloc(size_t, size_t);
50 _Noreturn
void abort (void);
51 int atexit (void (*) (void));
52 _Noreturn
void exit (int);
53 _Noreturn
void _Exit (int);
54 int at_quick_exit (void (*) (void));
55 _Noreturn
void quick_exit (int);
57 char *getenv (const char *);
59 int system (const char *);
61 void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
62 void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
66 long long llabs (long long);
68 typedef struct { int quot
, rem
; } div_t;
69 typedef struct { long quot
, rem
; } ldiv_t;
70 typedef struct { long long quot
, rem
; } lldiv_t
;
73 ldiv_t ldiv (long, long);
74 lldiv_t
lldiv (long long, long long);
76 int mblen (const char *, size_t);
77 int mbtowc (wchar_t *__restrict
, const char *__restrict
, size_t);
78 int wctomb (char *, wchar_t);
79 size_t mbstowcs (wchar_t *__restrict
, const char *__restrict
, size_t);
80 size_t wcstombs (char *__restrict
, const wchar_t *__restrict
, size_t);
82 #define EXIT_FAILURE 1
83 #define EXIT_SUCCESS 0
85 size_t __ctype_get_mb_cur_max(void);
86 #define MB_CUR_MAX (__ctype_get_mb_cur_max())
88 #define RAND_MAX (0x7fffffff)
91 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
92 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
93 || defined(_BSD_SOURCE)
98 #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
99 #define WTERMSIG(s) ((s) & 0x7f)
100 #define WSTOPSIG(s) WEXITSTATUS(s)
101 #define WIFEXITED(s) (!WTERMSIG(s))
102 #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
103 #define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
105 int posix_memalign (void **, size_t, size_t);
106 int setenv (const char *, const char *, int);
107 int unsetenv (const char *);
108 #ifdef __wasilibc_unmodified_upstream /* WASI has no temp directories */
109 int mkstemp (char *);
110 int mkostemp (char *, int);
111 char *mkdtemp (char *);
113 int getsubopt (char **, char *const *, char **);
114 int rand_r (unsigned *);
119 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
120 || defined(_BSD_SOURCE)
121 char *realpath (const char *__restrict
, char *__restrict
);
122 long int random (void);
123 void srandom (unsigned int);
124 char *initstate (unsigned int, char *, size_t);
125 char *setstate (char *);
127 int posix_openpt (int);
132 long a64l (const char *);
133 void setkey (const char *);
134 double drand48 (void);
135 double erand48 (unsigned short [3]);
136 long int lrand48 (void);
137 long int nrand48 (unsigned short [3]);
139 long jrand48 (unsigned short [3]);
141 unsigned short *seed48 (unsigned short [3]);
142 void lcong48 (unsigned short [7]);
145 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
147 char *mktemp (char *);
148 int mkstemps (char *, int);
149 int mkostemps (char *, int, int);
150 void *valloc (size_t);
151 void *memalign(size_t, size_t);
152 int getloadavg(double *, int);
154 #define WCOREDUMP(s) ((s) & 0x80)
155 #define WIFCONTINUED(s) ((s) == 0xffff)
159 int ptsname_r(int, char *, size_t);
160 char *ecvt(double, int, int *, int *);
161 char *fcvt(double, int, int *, int *);
162 char *gcvt(double, int, char *);
163 struct __locale_struct
;
164 float strtof_l(const char *__restrict
, char **__restrict
, struct __locale_struct
*);
165 double strtod_l(const char *__restrict
, char **__restrict
, struct __locale_struct
*);
166 long double strtold_l(const char *__restrict
, char **__restrict
, struct __locale_struct
*);
169 #ifdef __wasilibc_unmodified_upstream /* WASI has no temp directories */
170 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
171 #define mkstemp64 mkstemp
172 #define mkostemp64 mkostemp
173 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
174 #define mkstemps64 mkstemps
175 #define mkostemps64 mkostemps
180 #ifdef __wasilibc_unmodified_upstream /* Declare arc4random functions */
182 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
184 uint32_t arc4random(void);
185 void arc4random_buf(void *, size_t);
186 uint32_t arc4random_uniform(uint32_t);