]> git.saurik.com Git - apple/xnu.git/blob - bsd/include/stdlib.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / include / stdlib.h
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_
64 typedef _BSD_SIZE_T_ size_t;
65 #endif
66
67 #ifndef _BSD_WCHAR_T_DEFINED_
68 #define _BSD_WCHAR_T_DEFINED_
69 #ifndef _ANSI_SOURCE
70 typedef _BSD_WCHAR_T_ rune_t;
71 #endif
72 typedef _BSD_WCHAR_T_ wchar_t;
73 #endif
74
75 typedef struct {
76 int quot; /* quotient */
77 int rem; /* remainder */
78 } div_t;
79
80 typedef 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
94 extern 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));
104 int atexit __P((void (*)(void)));
105 double atof __P((const char *));
106 int atoi __P((const char *));
107 long atol __P((const char *));
108 void *bsearch __P((const void *, const void *, size_t,
109 size_t, int (*)(const void *, const void *)));
110 void *calloc __P((size_t, size_t));
111 __pure div_t
112 div __P((int, int));
113 __dead void
114 exit __P((int));
115 void free __P((void *));
116 char *getenv __P((const char *));
117 __pure long
118 labs __P((long));
119 __pure ldiv_t
120 ldiv __P((long, long));
121 void *malloc __P((size_t));
122 void qsort __P((void *, size_t, size_t,
123 int (*)(const void *, const void *)));
124 int rand __P((void));
125 void *realloc __P((void *, size_t));
126 void srand __P((unsigned));
127 double strtod __P((const char *, char **));
128 long strtol __P((const char *, char **, int));
129 unsigned long
130 strtoul __P((const char *, char **, int));
131 int system __P((const char *));
132
133 /* These are currently just stubs. */
134 int mblen __P((const char *, size_t));
135 size_t mbstowcs __P((wchar_t *, const char *, size_t));
136 int wctomb __P((char *, wchar_t));
137 int mbtowc __P((wchar_t *, const char *, size_t));
138 size_t wcstombs __P((char *, const wchar_t *, size_t));
139
140 #ifndef _ANSI_SOURCE
141 int putenv __P((const char *));
142 int setenv __P((const char *, const char *, int));
143 #endif
144
145 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
146 void *alloca __P((size_t)); /* built-in for gcc */
147 /* getcap(3) functions */
148 char *getbsize __P((int *, long *));
149 char *cgetcap __P((char *, char *, int));
150 int cgetclose __P((void));
151 int cgetent __P((char **, char **, char *));
152 int cgetfirst __P((char **, char **));
153 int cgetmatch __P((char *, char *));
154 int cgetnext __P((char **, char **));
155 int cgetnum __P((char *, char *, long *));
156 int cgetset __P((char *));
157 int cgetstr __P((char *, char *, char **));
158 int cgetustr __P((char *, char *, char **));
159
160 int daemon __P((int, int));
161 char *devname __P((int, int));
162 int getloadavg __P((double [], int));
163
164 char *group_from_gid __P((unsigned long, int));
165 int heapsort __P((void *, size_t, size_t,
166 int (*)(const void *, const void *)));
167 char *initstate __P((unsigned long, char *, long));
168 int mergesort __P((void *, size_t, size_t,
169 int (*)(const void *, const void *)));
170 int radixsort __P((const unsigned char **, int, const unsigned char *,
171 unsigned));
172 int sradixsort __P((const unsigned char **, int, const unsigned char *,
173 unsigned));
174 long random __P((void));
175 char *realpath __P((const char *, char resolved_path[]));
176 char *setstate __P((char *));
177 void srandom __P((unsigned long));
178 char *user_from_uid __P((unsigned long, int));
179 #ifndef __STRICT_ANSI__
180 long long
181 strtoq __P((const char *, char **, int));
182 unsigned long long
183 strtouq __P((const char *, char **, int));
184 #endif
185 void unsetenv __P((const char *));
186 #endif
187 __END_DECLS
188
189 #endif /* _STDLIB_H_ */