don't bother resolving onbld python module deps
[unleashed.git] / include / stdlib.h
blob7b0df42bd087fbdfa8438ea36af28051ce4faa56
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright (c) 2013 Gary Mills
26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
29 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
31 /* Copyright (c) 1988 AT&T */
32 /* All Rights Reserved */
34 #ifndef _STDLIB_H
35 #define _STDLIB_H
37 #include <iso/stdlib_iso.h>
38 #include <iso/stdlib_c99.h>
39 #include <iso/stdlib_c11.h>
41 #if defined(__EXTENSIONS__) || defined(_XPG4)
42 #include <sys/wait.h>
43 #endif
46 * Allow global visibility for symbols defined in
47 * C++ "std" namespace in <iso/stdlib_iso.h>.
49 #if __cplusplus >= 199711L
50 using std::div_t;
51 using std::ldiv_t;
52 using std::size_t;
53 using std::abort;
54 using std::abs;
55 using std::atexit;
56 using std::atof;
57 using std::atoi;
58 using std::atol;
59 using std::bsearch;
60 using std::calloc;
61 using std::div;
62 using std::exit;
63 using std::free;
64 using std::getenv;
65 using std::labs;
66 using std::ldiv;
67 using std::malloc;
68 using std::mblen;
69 using std::mbstowcs;
70 using std::mbtowc;
71 using std::qsort;
72 using std::rand;
73 using std::realloc;
74 using std::srand;
75 using std::strtod;
76 using std::strtol;
77 using std::strtoul;
78 using std::system;
79 using std::wcstombs;
80 using std::wctomb;
81 #endif
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
87 #ifndef _UID_T
88 #define _UID_T
89 typedef unsigned int uid_t; /* UID type */
90 #endif /* !_UID_T */
92 /* large file compilation environment setup */
93 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
95 #ifdef __PRAGMA_REDEFINE_EXTNAME
96 #pragma redefine_extname mkstemp mkstemp64
97 #pragma redefine_extname mkstemps mkstemps64
98 #pragma redefine_extname mkostemp mkostemp64
99 #pragma redefine_extname mkostemps mkostemps64
100 #else /* __PRAGMA_REDEFINE_EXTNAME */
101 #define mkstemp mkstemp64
102 #define mkstemps mkstemps64
103 #define mkostemp mkostemp64
104 #define mkostemps mkostemps64
105 #endif /* __PRAGMA_REDEFINE_EXTNAME */
107 #endif /* _FILE_OFFSET_BITS == 64 */
109 /* In the LP64 compilation environment, all APIs are already large file */
110 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
112 #ifdef __PRAGMA_REDEFINE_EXTNAME
113 #pragma redefine_extname mkstemp64 mkstemp
114 #pragma redefine_extname mkstemps64 mkstemps
115 #pragma redefine_extname mkostemp64 mkostemp
116 #pragma redefine_extname mkostemps64 mkostemps
117 #else /* __PRAGMA_REDEFINE_EXTNAME */
118 #define mkstemp64 mkstemp
119 #define mkstemps64 mkstemps
120 #define mkostemp64 mkostemp
121 #define mkostemps64 mkostemps
122 #endif /* __PRAGMA_REDEFINE_EXTNAME */
124 #endif /* _LP64 && _LARGEFILE64_SOURCE */
126 extern int rand_r(unsigned int *);
128 extern void _exithandle(void);
130 #if defined(__EXTENSIONS__) || \
131 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
132 defined(_XPG4)
133 extern double drand48(void);
134 extern double erand48(unsigned short *);
135 extern long jrand48(unsigned short *);
136 extern void lcong48(unsigned short *);
137 extern long lrand48(void);
138 extern long mrand48(void);
139 extern long nrand48(unsigned short *);
140 extern unsigned short *seed48(unsigned short *);
141 extern void srand48(long);
142 extern int putenv(char *);
143 extern void setkey(const char *);
144 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
147 * swab() has historically been in <stdlib.h> as delivered from AT&T
148 * and continues to be visible in the default compilation environment.
149 * As of Issue 4 of the X/Open Portability Guides, swab() was declared
150 * in <unistd.h>. As a result, with respect to X/Open namespace the
151 * swab() declaration in this header is only visible for the XPG3
152 * environment.
154 #if (defined(__EXTENSIONS__) || \
155 (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
156 (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4)))
157 #ifndef _SSIZE_T
158 #define _SSIZE_T
159 #if defined(_LP64) || defined(_I32LPx)
160 typedef long ssize_t; /* size of something in bytes or -1 */
161 #else
162 typedef int ssize_t; /* (historical version) */
163 #endif
164 #endif /* !_SSIZE_T */
166 extern void swab(const char *, char *, ssize_t);
167 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
169 #if defined(__EXTENSIONS__) || \
170 !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
171 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
172 extern int mkstemp(char *);
173 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
174 extern int mkstemps(char *, int);
175 #endif
176 #endif /* defined(__EXTENSIONS__) ... */
178 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
179 !defined(__PRAGMA_REDEFINE_EXTNAME))
180 extern int mkstemp64(char *);
181 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
182 extern int mkstemps64(char *, int);
183 #endif
184 #endif /* _LARGEFILE64_SOURCE... */
186 #if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
187 extern char *mkdtemp(char *);
188 #endif /* !defined(_STRICT_SYMBOLS) || defined(_XPG7) */
190 #if !defined(_STRICT_SYMBOLS)
191 extern int mkostemp(char *, int);
192 extern int mkostemps(char *, int, int);
193 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
194 !defined(__PRAGMA_REDEFINE_EXTNAME))
195 extern int mkostemp64(char *, int);
196 extern int mkostemps64(char *, int, int);
197 #endif /* defined(_LARGEFILE64_SOURCE) || !((_FILE_OFFSET_BITS == 64) ... */
198 #endif /* !defined(_STRICT_SYMBOLS) */
200 #if defined(__EXTENSIONS__) || \
201 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
202 defined(_XPG4_2)
203 extern long a64l(const char *);
204 extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
205 extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
206 extern char *gcvt(double, int, char *);
207 extern int getsubopt(char **, char *const *, char **);
208 extern int grantpt(int);
209 extern char *initstate(unsigned, char *, size_t);
210 extern char *l64a(long);
211 extern char *mktemp(char *);
212 extern char *ptsname(int);
213 extern long random(void);
214 extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
215 extern char *setstate(const char *);
216 extern void srandom(unsigned);
217 extern int unlockpt(int);
218 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
219 #if !defined(_XPG6) || defined(__EXTENSIONS__)
220 extern int ttyslot(void);
221 extern void *valloc(size_t);
222 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
223 #endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */
225 #if defined(__EXTENSIONS__) || \
226 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
227 defined(_XPG6)
228 extern int posix_memalign(void **, size_t, size_t);
229 extern int posix_openpt(int);
230 extern int setenv(const char *, const char *, int);
231 extern int unsetenv(const char *);
232 #endif
234 #if defined(__EXTENSIONS__) || \
235 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
236 extern char *canonicalize_file_name(const char *);
237 extern int clearenv(void);
238 extern void closefrom(int);
239 extern int daemon(int, int);
240 extern int dup2(int, int);
241 extern int dup3(int, int, int);
242 extern int fdwalk(int (*)(void *, int), void *);
243 extern char *qecvt(long double, int, int *, int *);
244 extern char *qfcvt(long double, int, int *, int *);
245 extern char *qgcvt(long double, int, char *);
246 extern char *getcwd(char *, size_t);
247 extern const char *getexecname(void);
249 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */
250 #define __GETLOGIN_DEFINED
251 #ifndef __USE_LEGACY_LOGNAME__
252 #ifdef __PRAGMA_REDEFINE_EXTNAME
253 #pragma redefine_extname getlogin getloginx
254 #else /* __PRAGMA_REDEFINE_EXTNAME */
255 extern char *getloginx(void);
256 #define getlogin getloginx
257 #endif /* __PRAGMA_REDEFINE_EXTNAME */
258 #endif /* __USE_LEGACY_LOGNAME__ */
259 extern char *getlogin(void);
260 #endif /* __GETLOGIN_DEFINED */
262 extern int getopt(int, char *const *, const char *);
263 extern char *optarg;
264 extern int optind, opterr, optopt;
265 extern char *getpass(const char *);
266 extern char *getpassphrase(const char *);
267 extern int isatty(int);
268 extern void *memalign(size_t, size_t);
269 extern char *ttyname(int);
270 extern char *mkdtemp(char *);
271 extern const char *getprogname(void);
272 extern void setprogname(const char *);
274 #if !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE)
275 extern char *lltostr(long long, char *);
276 extern char *ulltostr(unsigned long long, char *);
277 #endif /* !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) */
279 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
281 /* OpenBSD compatibility functions */
282 #if !defined(_STRICT_SYMBOLS)
284 #include <inttypes.h>
285 extern uint32_t arc4random(void);
286 extern void arc4random_buf(void *, size_t);
287 extern uint32_t arc4random_uniform(uint32_t);
288 long long strtonum(const char *, long long, long long, const char **);
290 #endif /* !_STRICT_SYBMOLS */
292 #ifdef __cplusplus
294 #endif
296 #endif /* _STDLIB_H */