17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* 327c478bd9Sstevel@tonic-gate * An application should not include this header directly. Instead it 337c478bd9Sstevel@tonic-gate * should be included only through the inclusion of other Sun headers. 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * The contents of this header is limited to identifiers specified in the 367c478bd9Sstevel@tonic-gate * C Standard. Any new identifiers specified in future amendments to the 377c478bd9Sstevel@tonic-gate * C Standard must be placed in this header. If these new identifiers 387c478bd9Sstevel@tonic-gate * are required to also be in the C++ Standard "std" namespace, then for 397c478bd9Sstevel@tonic-gate * anything other than macro definitions, corresponding "using" directives 407c478bd9Sstevel@tonic-gate * must also be added to <locale.h>. 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #ifndef _ISO_STDLIB_ISO_H 447c478bd9Sstevel@tonic-gate #define _ISO_STDLIB_ISO_H 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #ifdef __cplusplus 517c478bd9Sstevel@tonic-gate extern "C" { 527c478bd9Sstevel@tonic-gate #endif 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #if defined(__STDC__) 557c478bd9Sstevel@tonic-gate extern unsigned char __ctype[]; 567c478bd9Sstevel@tonic-gate #define MB_CUR_MAX __ctype[520] 577c478bd9Sstevel@tonic-gate #else 587c478bd9Sstevel@tonic-gate extern unsigned char _ctype[]; 597c478bd9Sstevel@tonic-gate #define MB_CUR_MAX _ctype[520] 607c478bd9Sstevel@tonic-gate #endif 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 637c478bd9Sstevel@tonic-gate namespace std { 647c478bd9Sstevel@tonic-gate #endif 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate typedef struct { 677c478bd9Sstevel@tonic-gate int quot; 687c478bd9Sstevel@tonic-gate int rem; 697c478bd9Sstevel@tonic-gate } div_t; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate typedef struct { 727c478bd9Sstevel@tonic-gate long quot; 737c478bd9Sstevel@tonic-gate long rem; 747c478bd9Sstevel@tonic-gate } ldiv_t; 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L 777c478bd9Sstevel@tonic-gate #define _SIZE_T 787c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 797c478bd9Sstevel@tonic-gate typedef unsigned long size_t; /* size of something in bytes */ 807c478bd9Sstevel@tonic-gate #else 817c478bd9Sstevel@tonic-gate typedef unsigned int size_t; /* (historical version) */ 827c478bd9Sstevel@tonic-gate #endif 837c478bd9Sstevel@tonic-gate #endif /* !_SIZE_T */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate #ifndef NULL 867c478bd9Sstevel@tonic-gate #if defined(_LP64) 877c478bd9Sstevel@tonic-gate #define NULL 0L 887c478bd9Sstevel@tonic-gate #else 897c478bd9Sstevel@tonic-gate #define NULL 0 907c478bd9Sstevel@tonic-gate #endif 917c478bd9Sstevel@tonic-gate #endif 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #define EXIT_FAILURE 1 947c478bd9Sstevel@tonic-gate #define EXIT_SUCCESS 0 957c478bd9Sstevel@tonic-gate #define RAND_MAX 32767 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * wchar_t is a built-in type in standard C++ and as such is not 997c478bd9Sstevel@tonic-gate * defined here when using standard C++. However, the GNU compiler 100*159cf8a6Swesolows * fixincludes utility nonetheless creates its own version of this 1017c478bd9Sstevel@tonic-gate * header for use by gcc and g++. In that version it adds a redundant 1027c478bd9Sstevel@tonic-gate * guard for __cplusplus. To avoid the creation of a gcc/g++ specific 1037c478bd9Sstevel@tonic-gate * header we need to include the following magic comment: 1047c478bd9Sstevel@tonic-gate * 1057c478bd9Sstevel@tonic-gate * we must use the C++ compiler's type 1067c478bd9Sstevel@tonic-gate * 1077c478bd9Sstevel@tonic-gate * The above comment should not be removed or changed until GNU 1087c478bd9Sstevel@tonic-gate * gcc/fixinc/inclhack.def is updated to bypass this header. 1097c478bd9Sstevel@tonic-gate */ 1107c478bd9Sstevel@tonic-gate #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) 1117c478bd9Sstevel@tonic-gate #ifndef _WCHAR_T 1127c478bd9Sstevel@tonic-gate #define _WCHAR_T 1137c478bd9Sstevel@tonic-gate #if defined(_LP64) 1147c478bd9Sstevel@tonic-gate typedef int wchar_t; 1157c478bd9Sstevel@tonic-gate #else 1167c478bd9Sstevel@tonic-gate typedef long wchar_t; 1177c478bd9Sstevel@tonic-gate #endif 1187c478bd9Sstevel@tonic-gate #endif /* !_WCHAR_T */ 1197c478bd9Sstevel@tonic-gate #endif /* !defined(__cplusplus) ... */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #if defined(__STDC__) 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate extern void abort(void) __NORETURN; 1247c478bd9Sstevel@tonic-gate extern int abs(int); 1257c478bd9Sstevel@tonic-gate extern int atexit(void (*)(void)); 1267c478bd9Sstevel@tonic-gate extern double atof(const char *); 1277c478bd9Sstevel@tonic-gate extern int atoi(const char *); 1287c478bd9Sstevel@tonic-gate extern long int atol(const char *); 1297c478bd9Sstevel@tonic-gate extern void *bsearch(const void *, const void *, size_t, size_t, 1307c478bd9Sstevel@tonic-gate int (*)(const void *, const void *)); 1317c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 1327c478bd9Sstevel@tonic-gate extern "C++" { 1337c478bd9Sstevel@tonic-gate void *bsearch(const void *, const void *, size_t, size_t, 1347c478bd9Sstevel@tonic-gate int (*)(const void *, const void *)); 1357c478bd9Sstevel@tonic-gate } 1367c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */ 1377c478bd9Sstevel@tonic-gate extern void *calloc(size_t, size_t); 1387c478bd9Sstevel@tonic-gate extern div_t div(int, int); 1397c478bd9Sstevel@tonic-gate extern void exit(int) 1407c478bd9Sstevel@tonic-gate __NORETURN; 1417c478bd9Sstevel@tonic-gate extern void free(void *); 1427c478bd9Sstevel@tonic-gate extern char *getenv(const char *); 1437c478bd9Sstevel@tonic-gate extern long int labs(long); 1447c478bd9Sstevel@tonic-gate extern ldiv_t ldiv(long, long); 1457c478bd9Sstevel@tonic-gate extern void *malloc(size_t); 1467c478bd9Sstevel@tonic-gate extern int mblen(const char *, size_t); 1477c478bd9Sstevel@tonic-gate extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 1487c478bd9Sstevel@tonic-gate size_t); 1497c478bd9Sstevel@tonic-gate extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); 1507c478bd9Sstevel@tonic-gate extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); 1517c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 1527c478bd9Sstevel@tonic-gate extern "C++" { 1537c478bd9Sstevel@tonic-gate void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); 1547c478bd9Sstevel@tonic-gate } 1557c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */ 1567c478bd9Sstevel@tonic-gate extern int rand(void); 1577c478bd9Sstevel@tonic-gate extern void *realloc(void *, size_t); 1587c478bd9Sstevel@tonic-gate extern void srand(unsigned int); 1597c478bd9Sstevel@tonic-gate extern double strtod(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD); 1607c478bd9Sstevel@tonic-gate extern long int strtol(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, int); 1617c478bd9Sstevel@tonic-gate extern unsigned long int strtoul(const char *_RESTRICT_KYWD, 1627c478bd9Sstevel@tonic-gate char **_RESTRICT_KYWD, int); 1637c478bd9Sstevel@tonic-gate extern int system(const char *); 1647c478bd9Sstevel@tonic-gate extern int wctomb(char *, wchar_t); 1657c478bd9Sstevel@tonic-gate extern size_t wcstombs(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, 1667c478bd9Sstevel@tonic-gate size_t); 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 1697c478bd9Sstevel@tonic-gate extern "C++" { 1707c478bd9Sstevel@tonic-gate inline long abs(long _l) { return labs(_l); } 1717c478bd9Sstevel@tonic-gate inline ldiv_t div(long _l1, long _l2) { return ldiv(_l1, _l2); } 1727c478bd9Sstevel@tonic-gate } 1737c478bd9Sstevel@tonic-gate #endif /* __cplusplus */ 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate #else /* not __STDC__ */ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate extern void abort(); 1787c478bd9Sstevel@tonic-gate extern int abs(); 1797c478bd9Sstevel@tonic-gate extern int atexit(); 1807c478bd9Sstevel@tonic-gate extern double atof(); 1817c478bd9Sstevel@tonic-gate extern int atoi(); 1827c478bd9Sstevel@tonic-gate extern long int atol(); 1837c478bd9Sstevel@tonic-gate extern void *bsearch(); 1847c478bd9Sstevel@tonic-gate extern void *calloc(); 1857c478bd9Sstevel@tonic-gate extern div_t div(); 1867c478bd9Sstevel@tonic-gate extern void exit(); 1877c478bd9Sstevel@tonic-gate extern void free(); 1887c478bd9Sstevel@tonic-gate extern char *getenv(); 1897c478bd9Sstevel@tonic-gate extern long int labs(); 1907c478bd9Sstevel@tonic-gate extern ldiv_t ldiv(); 1917c478bd9Sstevel@tonic-gate extern void *malloc(); 1927c478bd9Sstevel@tonic-gate extern int mblen(); 1937c478bd9Sstevel@tonic-gate extern size_t mbstowcs(); 1947c478bd9Sstevel@tonic-gate extern int mbtowc(); 1957c478bd9Sstevel@tonic-gate extern void qsort(); 1967c478bd9Sstevel@tonic-gate extern int rand(); 1977c478bd9Sstevel@tonic-gate extern void *realloc(); 1987c478bd9Sstevel@tonic-gate extern void srand(); 1997c478bd9Sstevel@tonic-gate extern double strtod(); 2007c478bd9Sstevel@tonic-gate extern long int strtol(); 2017c478bd9Sstevel@tonic-gate extern unsigned long strtoul(); 2027c478bd9Sstevel@tonic-gate extern int system(); 2037c478bd9Sstevel@tonic-gate extern int wctomb(); 2047c478bd9Sstevel@tonic-gate extern size_t wcstombs(); 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 2097c478bd9Sstevel@tonic-gate } 2107c478bd9Sstevel@tonic-gate #endif /* end of namespace std */ 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2137c478bd9Sstevel@tonic-gate } 2147c478bd9Sstevel@tonic-gate #endif 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate #endif /* _ISO_STDLIB_ISO_H */ 217