stdlib.h revision 90553fa8afd7a98e67bf29073ba4c8d157bb00c9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright (c) 2013 Gary Mills
*
*/
/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _STDLIB_H
#define _STDLIB_H
#include <iso/stdlib_iso.h>
#include <iso/stdlib_c99.h>
#if defined(__EXTENSIONS__) || defined(_XPG4)
#endif
/*
* Allow global visibility for symbols defined in
* C++ "std" namespace in <iso/stdlib_iso.h>.
*/
#if __cplusplus >= 199711L
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _UID_T
#define _UID_T
typedef unsigned int uid_t; /* UID type */
#endif /* !_UID_T */
/* large file compilation environment setup */
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
#define mkstemps mkstemps64
#define mkostemp mkostemp64
#define mkostemps mkostemps64
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _FILE_OFFSET_BITS == 64 */
/* In the LP64 compilation environment, all APIs are already large file */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
#define mkstemps64 mkstemps
#define mkostemp64 mkostemp
#define mkostemps64 mkostemps
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _LP64 && _LARGEFILE64_SOURCE */
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
extern int rand_r(unsigned int *);
#endif
extern void _exithandle(void);
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
defined(_XPG4)
extern double drand48(void);
extern double erand48(unsigned short *);
extern long jrand48(unsigned short *);
extern void lcong48(unsigned short *);
extern long lrand48(void);
extern long mrand48(void);
extern long nrand48(unsigned short *);
extern unsigned short *seed48(unsigned short *);
extern void srand48(long);
extern int putenv(char *);
extern void setkey(const char *);
#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
/*
* swab() has historically been in <stdlib.h> as delivered from AT&T
* and continues to be visible in the default compilation environment.
* swab() declaration in this header is only visible for the XPG3
* environment.
*/
#if (defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
#ifndef _SSIZE_T
#define _SSIZE_T
typedef long ssize_t; /* size of something in bytes or -1 */
#else
typedef int ssize_t; /* (historical version) */
#endif
#endif /* !_SSIZE_T */
#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
#if defined(__EXTENSIONS__) || \
!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
extern int mkstemp(char *);
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
extern int mkstemps(char *, int);
#endif
#endif /* defined(__EXTENSIONS__) ... */
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int mkstemp64(char *);
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
extern int mkstemps64(char *, int);
#endif
#endif /* _LARGEFILE64_SOURCE... */
#if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
extern char *mkdtemp(char *);
#endif /* !defined(_STRICT_SYMBOLS) || defined(_XPG7) */
#if !defined(_STRICT_SYMBOLS)
extern int mkostemp(char *, int);
extern int mkostemps(char *, int, int);
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int mkostemp64(char *, int);
extern int mkostemps64(char *, int, int);
#endif /* defined(_LARGEFILE64_SOURCE) || !((_FILE_OFFSET_BITS == 64) ... */
#endif /* !defined(_STRICT_SYMBOLS) */
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4_2)
extern long a64l(const char *);
extern char *gcvt(double, int, char *);
extern int getsubopt(char **, char *const *, char **);
extern int grantpt(int);
extern char *l64a(long);
extern char *mktemp(char *);
extern char *ptsname(int);
extern long random(void);
extern char *setstate(const char *);
extern void srandom(unsigned);
extern int unlockpt(int);
/* Marked LEGACY in SUSv2 and removed in SUSv3 */
#if !defined(_XPG6) || defined(__EXTENSIONS__)
extern int ttyslot(void);
#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
#endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG6)
extern int posix_openpt(int);
extern int setenv(const char *, const char *, int);
extern int unsetenv(const char *);
#endif
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
extern char *canonicalize_file_name(const char *);
extern int clearenv(void);
extern void closefrom(int);
extern int daemon(int, int);
extern int dup2(int, int);
extern int dup3(int, int, int);
extern int fdwalk(int (*)(void *, int), void *);
extern char *qecvt(long double, int, int *, int *);
extern char *qfcvt(long double, int, int *, int *);
extern char *qgcvt(long double, int, char *);
extern const char *getexecname(void);
#ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */
#define __GETLOGIN_DEFINED
#ifndef __USE_LEGACY_LOGNAME__
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
extern char *getloginx(void);
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* __USE_LEGACY_LOGNAME__ */
extern char *getlogin(void);
#endif /* __GETLOGIN_DEFINED */
extern int getopt(int, char *const *, const char *);
extern char *optarg;
extern char *getpass(const char *);
extern char *getpassphrase(const char *);
extern int isatty(int);
extern char *ttyname(int);
extern char *mkdtemp(char *);
extern const char *getprogname(void);
extern void setprogname(const char *);
#if !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE)
extern char *lltostr(long long, char *);
extern char *ulltostr(unsigned long long, char *);
#endif /* !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) */
#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
/* OpenBSD compatibility functions */
#if !defined(_STRICT_SYMBOLS)
#include <inttypes.h>
extern uint32_t arc4random(void);
extern void arc4random_buf(void *, size_t);
#endif /* !_STRICT_SYBMOLS */
#ifdef __cplusplus
}
#endif
#endif /* _STDLIB_H */