1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 34 * $FreeBSD: src/include/stdlib.h,v 1.16.2.5 2002/12/13 01:34:00 tjr Exp $ 35 * $DragonFly: src/include/stdlib.h,v 1.3 2003/11/09 02:22:28 dillon Exp $ 36 */ 37 38 #ifndef _STDLIB_H_ 39 #define _STDLIB_H_ 40 41 #include <sys/cdefs.h> 42 43 #ifndef _SYS_STDINT_H_ 44 #include <sys/stdint.h> 45 #endif 46 47 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 48 #ifndef _RUNE_T_DECLARED_ 49 #define _RUNE_T_DECLARED_ 50 typedef __rune_t rune_t; 51 #endif 52 #endif 53 54 #ifndef __cplusplus 55 #ifndef _WCHAR_T_DECLARED_ 56 #define _WCHAR_T_DECLARED_ 57 typedef __wchar_t wchar_t; 58 #endif 59 #endif 60 61 #ifndef _SIZE_T_DECLARED_ 62 #define _SIZE_T_DECLARED_ 63 typedef __size_t size_t; 64 #endif 65 66 typedef struct { 67 int quot; /* quotient */ 68 int rem; /* remainder */ 69 } div_t; 70 71 typedef struct { 72 long quot; /* quotient */ 73 long rem; /* remainder */ 74 } ldiv_t; 75 76 #ifndef NULL 77 #define NULL 0 78 #endif 79 80 #define EXIT_FAILURE 1 81 #define EXIT_SUCCESS 0 82 83 #define RAND_MAX 0x7fffffff 84 85 extern int __mb_cur_max; 86 #define MB_CUR_MAX __mb_cur_max 87 88 __BEGIN_DECLS 89 void abort __P((void)) __dead2; 90 int abs __P((int)) __pure2; 91 int atexit __P((void (*)(void))); 92 double atof __P((const char *)); 93 int atoi __P((const char *)); 94 long atol __P((const char *)); 95 void *bsearch __P((const void *, const void *, size_t, 96 size_t, int (*)(const void *, const void *))); 97 void *calloc __P((size_t, size_t)); 98 div_t div __P((int, int)) __pure2; 99 void exit __P((int)) __dead2; 100 void free __P((void *)); 101 char *getenv __P((const char *)); 102 long labs __P((long)) __pure2; 103 ldiv_t ldiv __P((long, long)) __pure2; 104 void *malloc __P((size_t)); 105 void qsort __P((void *, size_t, size_t, 106 int (*)(const void *, const void *))); 107 int rand __P((void)); 108 void *realloc __P((void *, size_t)); 109 void srand __P((unsigned)); 110 double strtod __P((const char *, char **)); 111 long strtol __P((const char *, char **, int)); 112 #ifdef __LONG_LONG_SUPPORTED 113 long long 114 strtoll __P((const char *, char **, int)); 115 #endif 116 unsigned long 117 strtoul __P((const char *, char **, int)); 118 #ifdef __LONG_LONG_SUPPORTED 119 unsigned long long 120 strtoull __P((const char *, char **, int)); 121 #endif 122 int system __P((const char *)); 123 124 int mblen __P((const char *, size_t)); 125 size_t mbstowcs __P((wchar_t *, const char *, size_t)); 126 int wctomb __P((char *, wchar_t)); 127 int mbtowc __P((wchar_t *, const char *, size_t)); 128 size_t wcstombs __P((char *, const wchar_t *, size_t)); 129 130 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 131 int putenv __P((const char *)); 132 int setenv __P((const char *, const char *, int)); 133 134 double drand48 __P((void)); 135 double erand48 __P((unsigned short[3])); 136 long jrand48 __P((unsigned short[3])); 137 void lcong48 __P((unsigned short[7])); 138 long lrand48 __P((void)); 139 long mrand48 __P((void)); 140 long nrand48 __P((unsigned short[3])); 141 unsigned short 142 *seed48 __P((unsigned short[3])); 143 void srand48 __P((long)); 144 145 void *alloca __P((size_t)); /* built-in for gcc */ 146 /* getcap(3) functions */ 147 __uint32_t 148 arc4random __P((void)); 149 void arc4random_addrandom __P((unsigned char *dat, int datlen)); 150 void arc4random_stir __P((void)); 151 char *getbsize __P((int *, long *)); 152 char *cgetcap __P((char *, char *, int)); 153 int cgetclose __P((void)); 154 int cgetent __P((char **, char **, char *)); 155 int cgetfirst __P((char **, char **)); 156 int cgetmatch __P((char *, char *)); 157 int cgetnext __P((char **, char **)); 158 int cgetnum __P((char *, char *, long *)); 159 int cgetset __P((char *)); 160 int cgetstr __P((char *, char *, char **)); 161 int cgetustr __P((char *, char *, char **)); 162 163 int daemon __P((int, int)); 164 char *devname __P((int, int)); 165 int getloadavg __P((double [], int)); 166 __const char * 167 getprogname __P((void)); 168 169 char *group_from_gid __P((unsigned long, int)); 170 int heapsort __P((void *, size_t, size_t, 171 int (*)(const void *, const void *))); 172 char *initstate __P((unsigned long, char *, long)); 173 int mergesort __P((void *, size_t, size_t, 174 int (*)(const void *, const void *))); 175 int radixsort __P((const unsigned char **, int, const unsigned char *, 176 unsigned)); 177 int sradixsort __P((const unsigned char **, int, const unsigned char *, 178 unsigned)); 179 int rand_r __P((unsigned *)); 180 long random __P((void)); 181 void *reallocf __P((void *, size_t)); 182 char *realpath __P((const char *, char resolved_path[])); 183 void setprogname __P((const char *)); 184 char *setstate __P((char *)); 185 void srandom __P((unsigned long)); 186 void srandomdev __P((void)); 187 char *user_from_uid __P((unsigned long, int)); 188 #ifndef __STRICT_ANSI__ 189 __int64_t strtoq __P((const char *, char **, int)); 190 __uint64_t 191 strtouq __P((const char *, char **, int)); 192 #endif 193 void unsetenv __P((const char *)); 194 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 195 __END_DECLS 196 197 #endif /* !_STDLIB_H_ */ 198