4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright 2014 PALO, Richard.
26 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 /* Copyright (c) 1988 AT&T */
31 /* All Rights Reserved */
35 * An application should not include this header directly. Instead it
36 * should be included only through the inclusion of other Sun headers.
38 * The contents of this header is limited to identifiers specified in the
39 * C Standard. Any new identifiers specified in future amendments to the
40 * C Standard must be placed in this header. If these new identifiers
41 * are required to also be in the C++ Standard "std" namespace, then for
42 * anything other than macro definitions, corresponding "using" directives
43 * must also be added to <locale.h>.
46 #ifndef _ISO_STDLIB_ISO_H
47 #define _ISO_STDLIB_ISO_H
49 #include <sys/feature_tests.h>
56 unsigned char __mb_cur_max(void);
58 #define MB_CUR_MAX (__mb_cur_max())
61 #if __cplusplus >= 199711L
75 #if !defined(_SIZE_T) || __cplusplus >= 199711L
77 #if defined(_LP64) || defined(_I32LPx)
78 typedef unsigned long size_t; /* size of something in bytes */
80 typedef unsigned int size_t; /* (historical version) */
84 #define EXIT_FAILURE 1
85 #define EXIT_SUCCESS 0
86 #define RAND_MAX 32767
89 * wchar_t is a built-in type in standard C++ and as such is not
90 * defined here when using standard C++. However, the GNU compiler
91 * fixincludes utility nonetheless creates its own version of this
92 * header for use by gcc and g++. In that version it adds a redundant
93 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
94 * header we need to include the following magic comment:
96 * we must use the C++ compiler's type
98 * The above comment should not be removed or changed until GNU
99 * gcc/fixinc/inclhack.def is updated to bypass this header.
101 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
107 typedef long wchar_t;
109 #endif /* !_WCHAR_T */
110 #endif /* !defined(__cplusplus) ... */
112 #if !defined(_NORETURN_KYWD)
113 #if __STDC_VERSION__ - 0 >= 201112L
114 #define _NORETURN_KYWD _Noreturn
116 #define _NORETURN_KYWD
117 #endif /* __STDC_VERSION__ - 0 >= 201112L */
118 #endif /* !defined(_NORETURN_KYWD) */
120 extern _NORETURN_KYWD
void abort(void) __NORETURN
;
122 extern int atexit(void (*)(void));
123 extern double atof(const char *);
124 extern int atoi(const char *);
125 extern long int atol(const char *);
126 extern void *bsearch(const void *, const void *, size_t, size_t,
127 int (*)(const void *, const void *));
128 #if __cplusplus >= 199711L && defined(__SUNPRO_CC)
130 void *bsearch(const void *, const void *, size_t, size_t,
131 int (*)(const void *, const void *));
133 #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
134 extern void *calloc(size_t, size_t);
135 extern div_t div(int, int);
136 extern _NORETURN_KYWD
void exit(int)
138 extern void free(void *);
139 extern void freezero(void *, size_t);
140 extern char *getenv(const char *);
141 extern long int labs(long);
142 extern ldiv_t ldiv(long, long);
143 extern void *malloc(size_t);
144 extern int mblen(const char *, size_t);
145 extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD
, const char *_RESTRICT_KYWD
,
147 extern int mbtowc(wchar_t *_RESTRICT_KYWD
, const char *_RESTRICT_KYWD
, size_t);
148 extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
149 #if __cplusplus >= 199711L && defined(__SUNPRO_CC)
151 void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
153 #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
154 extern int rand(void);
155 extern void *realloc(void *, size_t);
156 extern void *reallocarray(void *, size_t, size_t);
157 extern void *recallocarray(void *, size_t, size_t, size_t);
158 extern void srand(unsigned int);
159 extern double strtod(const char *_RESTRICT_KYWD
, char **_RESTRICT_KYWD
);
160 extern long int strtol(const char *_RESTRICT_KYWD
, char **_RESTRICT_KYWD
, int);
161 extern unsigned long int strtoul(const char *_RESTRICT_KYWD
,
162 char **_RESTRICT_KYWD
, int);
163 extern int system(const char *);
164 extern int wctomb(char *, wchar_t);
165 extern size_t wcstombs(char *_RESTRICT_KYWD
, const wchar_t *_RESTRICT_KYWD
,
168 #if __cplusplus >= 199711L
170 inline long abs(long _l
) { return labs(_l
); }
171 inline ldiv_t div(long _l1
, long _l2
) { return ldiv(_l1
, _l2
); }
173 #endif /* __cplusplus */
175 #if __cplusplus >= 199711L
177 #endif /* end of namespace std */
183 #endif /* _ISO_STDLIB_ISO_H */