1:
2:
3:
4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
34:
35: #ifndef _STDLIB_H_
36: #define _STDLIB_H_
37:
38: #include <sys/cdefs.h>
39: #include <machine/_types.h>
40: #if __BSD_VISIBLE
41: #include <sys/types.h>
42: #endif
43:
44: #ifndef _SIZE_T_DEFINED_
45: #define _SIZE_T_DEFINED_
46: typedef __size_t size_t;
47: #endif
48:
49:
50: #if !defined(_WCHAR_T_DEFINED_) && !defined(__cplusplus)
51: #define _WCHAR_T_DEFINED_
52: typedef __wchar_t wchar_t;
53: #endif
54:
55: typedef struct {
56: int quot;
57: int rem;
58: } div_t;
59:
60: typedef struct {
61: long quot;
62: long rem;
63: } ldiv_t;
64:
65: #if __ISO_C_VISIBLE >= 1999
66: typedef struct {
67: long long quot;
68: long long rem;
69: } lldiv_t;
70: #endif
71:
72: #if __BSD_VISIBLE
73: typedef struct {
74: quad_t quot;
75: quad_t rem;
76: } qdiv_t;
77: #endif
78:
79:
80: #ifndef NULL
81: #ifdef __GNUG__
82: #define NULL __null
83: #elif defined(__cplusplus)
84: #define NULL 0L
85: #else
86: #define NULL ((void *)0)
87: #endif
88: #endif
89:
90: #define EXIT_FAILURE 1
91: #define EXIT_SUCCESS 0
92:
93: #define RAND_MAX 0x7fffffff
94:
95: extern size_t __mb_cur_max;
96: #define MB_CUR_MAX __mb_cur_max
97:
98: #include <sys/cdefs.h>
99:
100: 101: 102: 103:
104: #ifdef abs
105: #undef abs
106: #warning abs macro collides with abs() prototype, undefining
107: #endif
108:
109: __BEGIN_DECLS
110: void abort(void);
111: int abs(int);
112: int atexit(void (*)(void));
113: double atof(const char *);
114: int atoi(const char *);
115: long atol(const char *);
116: void *bsearch(const void *, const void *, size_t, size_t,
117: int (*)(const void *, const void *));
118: void *calloc(size_t, size_t);
119: div_t div(int, int);
120: char *ecvt(double, int, int *, int *);
121: void exit(int);
122: void _Exit(int);
123: char *fcvt(double, int, int *, int *);
124: void free(void *);
125: char *gcvt(double, int, char *);
126: char *getenv(const char *);
127: long labs(long);
128: ldiv_t ldiv(long, long);
129: void *malloc(size_t);
130: int posix_memalign(void **, size_t, size_t);
131: void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
132: int rand(void);
133: void *realloc(void *, size_t);
134: void srand(unsigned);
135: double strtod(const char *, char **);
136: float strtof(const char *, char **);
137: long strtol(const char *, char **, int);
138: long double
139: strtold(const char *, char **);
140: unsigned long
141: strtoul(const char *, char **, int);
142: int system(const char *);
143:
144:
145: int mblen(const char *, size_t);
146: size_t mbstowcs(wchar_t *, const char *, size_t);
147: int wctomb(char *, wchar_t);
148: int mbtowc(wchar_t *, const char *, size_t);
149: size_t wcstombs(char *, const wchar_t *, size_t);
150:
151: 152: 153:
154: #if __BSD_VISIBLE || __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500 || \
155: defined(_REENTRANT)
156: int rand_r(unsigned int *);
157: #endif
158:
159: #if __BSD_VISIBLE || __XPG_VISIBLE >= 400
160: double drand48(void);
161: double erand48(unsigned short[3]);
162: long jrand48(unsigned short[3]);
163: void lcong48(unsigned short[7]);
164: long lrand48(void);
165: long mrand48(void);
166: long nrand48(unsigned short[3]);
167: unsigned short *seed48(unsigned short[3]);
168: void srand48(long);
169:
170: int putenv(char *);
171: #endif
172:
173: #if __BSD_VISIBLE || __XPG_VISIBLE >= 420
174: long a64l(const char *);
175: char *l64a(long);
176:
177: char *initstate(unsigned int, char *, size_t)
178: ;
179: long random(void);
180: char *setstate(const char *);
181: void srandom(unsigned int);
182:
183: int mkstemp(char *);
184: char *mktemp(char *);
185:
186: char *realpath(const char *, char *);
187:
188: int setkey(const char *);
189:
190: int ttyslot(void);
191:
192: void *valloc(size_t);
193: #endif
194:
195: 196: 197:
198: #if __ISO_C_VISIBLE >= 1999
199: long long
200: atoll(const char *);
201: long long
202: llabs(long long);
203: lldiv_t
204: lldiv(long long, long long);
205: long long
206: strtoll(const char *, char **, int);
207: unsigned long long
208: strtoull(const char *, char **, int);
209: #endif
210:
211: 212: 213:
214: #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 600
215: int setenv(const char *, const char *, int);
216: int unsetenv(const char *);
217: #endif
218:
219: #if __BSD_VISIBLE
220: void *alloca(size_t);
221:
222: char *getbsize(int *, long *);
223: char *cgetcap(char *, const char *, int);
224: int cgetclose(void);
225: int cgetent(char **, char **, const char *);
226: int cgetfirst(char **, char **);
227: int cgetmatch(char *, const char *);
228: int cgetnext(char **, char **);
229: int cgetnum(char *, const char *, long *);
230: int cgetset(const char *);
231: int cgetusedb(int);
232: int cgetstr(char *, const char *, char **);
233: int cgetustr(char *, const char *, char **);
234:
235: int daemon(int, int);
236: char *devname(int, mode_t);
237: int getloadavg(double [], int);
238:
239: void cfree(void *);
240:
241: #ifndef _GETOPT_DEFINED_
242: #define _GETOPT_DEFINED_
243: int getopt(int, char * const *, const char *);
244: extern char *optarg;
245: extern int opterr, optind, optopt, optreset;
246: int getsubopt(char **, char * const *, char **);
247: extern char *suboptarg;
248: #endif
249:
250: char *mkdtemp(char *);
251: int mkstemps(char *, int);
252:
253: int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
254: int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
255: int radixsort(const unsigned char **, int, const unsigned char *,
256: unsigned);
257: int sradixsort(const unsigned char **, int, const unsigned char *,
258: unsigned);
259:
260: void srandomdev(void);
261: long long
262: strtonum(const char *, long long, long long, const char **);
263:
264: void setproctitle(const char *, ...)
265: __attribute__((__format__ (__printf__, 1, 2)));
266:
267: quad_t qabs(quad_t);
268: qdiv_t qdiv(quad_t, quad_t);
269: quad_t strtoq(const char *, char **, int);
270: u_quad_t strtouq(const char *, char **, int);
271:
272: u_int32_t arc4random(void);
273: void arc4random_stir(void);
274: void arc4random_addrandom(unsigned char *, int)
275: ;
276: u_int32_t arc4random_uniform(u_int32_t);
277: void arc4random_buf(void *, size_t)
278: ;
279:
280: #endif
281:
282: __END_DECLS
283:
284: #endif