]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/include/stdlib.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / include / stdlib.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*-
23 * Copyright (c) 1990, 1993
24 * The Regents of the University of California. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 * must display the following acknowledgement:
36 * This product includes software developed by the University of
37 * California, Berkeley and its contributors.
38 * 4. Neither the name of the University nor the names of its contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 *
54 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
55 */
56
57#ifndef _STDLIB_H_
58#define _STDLIB_H_
59
60#include <machine/ansi.h>
61
62#ifndef _BSD_SIZE_T_DEFINED_
63#define _BSD_SIZE_T_DEFINED_
64typedef _BSD_SIZE_T_ size_t;
65#endif
66
67#ifndef _BSD_WCHAR_T_DEFINED_
68#define _BSD_WCHAR_T_DEFINED_
69#ifndef _ANSI_SOURCE
70typedef _BSD_WCHAR_T_ rune_t;
71#endif
72typedef _BSD_WCHAR_T_ wchar_t;
73#endif
74
75typedef struct {
76 int quot; /* quotient */
77 int rem; /* remainder */
78} div_t;
79
80typedef struct {
81 long quot; /* quotient */
82 long rem; /* remainder */
83} ldiv_t;
84
85#ifndef NULL
86#define NULL 0
87#endif
88
89#define EXIT_FAILURE 1
90#define EXIT_SUCCESS 0
91
92#define RAND_MAX 0x7fffffff
93
94extern int __mb_cur_max;
95#define MB_CUR_MAX __mb_cur_max
96
97#include <sys/cdefs.h>
98
99__BEGIN_DECLS
100__dead void
101 abort __P((void));
102__pure int
103 abs __P((int));
104int atexit __P((void (*)(void)));
105double atof __P((const char *));
106int atoi __P((const char *));
107long atol __P((const char *));
108void *bsearch __P((const void *, const void *, size_t,
109 size_t, int (*)(const void *, const void *)));
110void *calloc __P((size_t, size_t));
111__pure div_t
112 div __P((int, int));
113__dead void
114 exit __P((int));
115void free __P((void *));
116char *getenv __P((const char *));
117__pure long
118 labs __P((long));
119__pure ldiv_t
120 ldiv __P((long, long));
121void *malloc __P((size_t));
122void qsort __P((void *, size_t, size_t,
123 int (*)(const void *, const void *)));
124int rand __P((void));
125void *realloc __P((void *, size_t));
126void srand __P((unsigned));
127double strtod __P((const char *, char **));
128long strtol __P((const char *, char **, int));
129unsigned long
130 strtoul __P((const char *, char **, int));
131int system __P((const char *));
132
133/* These are currently just stubs. */
134int mblen __P((const char *, size_t));
135size_t mbstowcs __P((wchar_t *, const char *, size_t));
136int wctomb __P((char *, wchar_t));
137int mbtowc __P((wchar_t *, const char *, size_t));
138size_t wcstombs __P((char *, const wchar_t *, size_t));
139
140#ifndef _ANSI_SOURCE
141int putenv __P((const char *));
142int setenv __P((const char *, const char *, int));
143#endif
144
145#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
146void *alloca __P((size_t)); /* built-in for gcc */
147 /* getcap(3) functions */
148char *getbsize __P((int *, long *));
149char *cgetcap __P((char *, char *, int));
150int cgetclose __P((void));
151int cgetent __P((char **, char **, char *));
152int cgetfirst __P((char **, char **));
153int cgetmatch __P((char *, char *));
154int cgetnext __P((char **, char **));
155int cgetnum __P((char *, char *, long *));
156int cgetset __P((char *));
157int cgetstr __P((char *, char *, char **));
158int cgetustr __P((char *, char *, char **));
159
160int daemon __P((int, int));
161char *devname __P((int, int));
162int getloadavg __P((double [], int));
163
164char *group_from_gid __P((unsigned long, int));
165int heapsort __P((void *, size_t, size_t,
166 int (*)(const void *, const void *)));
167char *initstate __P((unsigned long, char *, long));
168int mergesort __P((void *, size_t, size_t,
169 int (*)(const void *, const void *)));
170int radixsort __P((const unsigned char **, int, const unsigned char *,
171 unsigned));
172int sradixsort __P((const unsigned char **, int, const unsigned char *,
173 unsigned));
174long random __P((void));
175char *realpath __P((const char *, char resolved_path[]));
176char *setstate __P((char *));
177void srandom __P((unsigned long));
178char *user_from_uid __P((unsigned long, int));
179#ifndef __STRICT_ANSI__
180long long
181 strtoq __P((const char *, char **, int));
182unsigned long long
183 strtouq __P((const char *, char **, int));
184#endif
185void unsetenv __P((const char *));
186#endif
187__END_DECLS
188
189#endif /* _STDLIB_H_ */