Add nsswitch support.
[dragonfly.git] / include / stdlib.h
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
34 * $FreeBSD: src/include/stdlib.h,v 1.16.2.5 2002/12/13 01:34:00 tjr Exp $
e4dcda4d 35 * $DragonFly: src/include/stdlib.h,v 1.22 2008/06/05 17:53:10 swildner Exp $
984263bc
MD
36 */
37
38#ifndef _STDLIB_H_
39#define _STDLIB_H_
40
41#include <sys/cdefs.h>
fa261b1d 42#include <sys/types.h>
984263bc 43
e2565a42
MD
44#ifndef _SYS_STDINT_H_
45#include <sys/stdint.h>
46#endif
984263bc 47
e2565a42 48#ifndef __cplusplus
a81b3ef3
JR
49#ifndef _WCHAR_T_DECLARED
50#define _WCHAR_T_DECLARED
e2565a42 51typedef __wchar_t wchar_t;
984263bc 52#endif
984263bc 53#endif
e2565a42 54
a81b3ef3
JR
55#ifndef _SIZE_T_DECLARED
56#define _SIZE_T_DECLARED
e2565a42 57typedef __size_t size_t;
984263bc
MD
58#endif
59
60typedef struct {
61 int quot; /* quotient */
62 int rem; /* remainder */
63} div_t;
64
65typedef struct {
66 long quot; /* quotient */
67 long rem; /* remainder */
68} ldiv_t;
69
f7d32065
SW
70#if __ISO_C_VISIBLE >= 1999
71typedef struct {
72 long long quot;
73 long long rem;
74} lldiv_t;
75#endif
76
e4dcda4d 77#include <sys/_null.h>
984263bc
MD
78
79#define EXIT_FAILURE 1
80#define EXIT_SUCCESS 0
81
82#define RAND_MAX 0x7fffffff
83
84extern int __mb_cur_max;
85#define MB_CUR_MAX __mb_cur_max
86
87__BEGIN_DECLS
f0a7d0bb 88void _Exit(int) __dead2;
5baeefc7
JS
89void abort(void) __dead2;
90int abs(int) __pure2;
91int atexit(void (*)(void));
92double atof(const char *);
93int atoi(const char *);
94long atol(const char *);
95void *bsearch(const void *, const void *, size_t,
96 size_t, int (*)(const void *, const void *));
97void *calloc(size_t, size_t);
98div_t div(int, int) __pure2;
99void exit(int) __dead2;
100void free(void *);
101char *getenv(const char *);
102long labs(long) __pure2;
103ldiv_t ldiv(long, long) __pure2;
f7d32065
SW
104#if __ISO_C_VISIBLE >= 1999
105lldiv_t lldiv(long long, long long) __pure2;
106#endif
5baeefc7
JS
107void *malloc(size_t);
108void qsort(void *, size_t, size_t, int(*)(const void *, const void *));
109int rand(void);
110void *realloc(void *, size_t);
111void srand(unsigned);
112double strtod(const char *, char **);
984263bc 113#ifdef __LONG_LONG_SUPPORTED
5e478546 114long long int atoll(const char *);
c0918928 115long long llabs(long long) __pure2;
5baeefc7
JS
116long long strtoll(const char *, char **, int);
117unsigned long long strtoull(const char *, char **, int);
984263bc 118#endif
5baeefc7 119int system(const char *);
984263bc 120
44a09dd6
MD
121#if !defined(_KERNEL_VIRTUAL)
122long strtol(const char *, char **, int);
123unsigned long strtoul(const char *, char **, int);
124#endif
125
5baeefc7
JS
126int mblen(const char *, size_t);
127size_t mbstowcs(wchar_t *, const char *, size_t);
128int wctomb(char *, wchar_t);
129int mbtowc(wchar_t *, const char *, size_t);
130size_t wcstombs(char *, const wchar_t *, size_t);
984263bc
MD
131
132#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
5baeefc7
JS
133int putenv(const char *);
134int setenv(const char *, const char *, int);
135
136double drand48(void);
137double erand48(unsigned short[3]);
138long jrand48(unsigned short[3]);
139void lcong48(unsigned short[7]);
140long lrand48(void);
141long mrand48(void);
142long nrand48(unsigned short[3]);
143unsigned short *seed48(unsigned short[3]);
144void srand48(long);
145
146void *alloca(size_t); /* built-in for gcc */
984263bc 147 /* getcap(3) functions */
5baeefc7 148__uint32_t arc4random(void);
d82b6b65 149void arc4random_addrandom(__uint8_t *, size_t);
5baeefc7
JS
150void arc4random_stir(void);
151char *getbsize(int *, long *);
152char *cgetcap(char *, char *, int);
153int cgetclose(void);
154int cgetent(char **, char **, char *);
155int cgetfirst(char **, char **);
156int cgetmatch(char *, char *);
157int cgetnext(char **, char **);
158int cgetnum(char *, char *, long *);
159int cgetset(char *);
160int cgetstr(char *, char *, char **);
161int cgetustr(char *, char *, char **);
162
163int daemon(int, int);
24d00e84
JS
164char *devname(dev_t, mode_t);
165char *devname_r(dev_t, mode_t, char *, size_t);
3eaaad2c 166int getloadavg(double [], int);
5baeefc7
JS
167const char *getprogname(void);
168
5baeefc7
JS
169int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
170char *initstate(unsigned long, char *, long);
171int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
172int radixsort(const unsigned char **, int, const unsigned char *,
173 unsigned int);
174int sradixsort(const unsigned char **, int, const unsigned char *,
175 unsigned int);
176int rand_r(unsigned *);
177long random(void);
178void *reallocf(void *, size_t);
179char *realpath(const char *, char []);
180void setprogname(const char *);
181char *setstate(char *);
182void srandom(unsigned long);
183void srandomdev(void);
44a09dd6
MD
184
185#if !defined(__STRICT_ANSI__) && !defined(_KERNEL_VIRTUAL)
5baeefc7
JS
186__int64_t strtoq(const char *, char **, int);
187__uint64_t strtouq(const char *, char **, int);
44a09dd6 188#endif
70e9d14e 189
44a09dd6 190#ifndef __STRICT_ANSI__
70e9d14e 191#ifdef __LONG_LONG_SUPPORTED
2bd0301f
SS
192long long
193 strtonum(const char *, long long, long long, const char **);
70e9d14e 194#endif
984263bc 195#endif
5baeefc7 196void unsetenv(const char *);
984263bc
MD
197#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
198__END_DECLS
199
200#endif /* !_STDLIB_H_ */