Annotation of src/include/stdlib.h, Revision 1.5
1.5 ! deraadt 1: /* $OpenBSD: stdlib.h,v 1.4 1997/09/21 10:45:53 niklas Exp $ */
1.2 deraadt 2: /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1990 The Regents of the University of California.
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * @(#)stdlib.h 5.13 (Berkeley) 6/4/91
37: */
38:
39: #ifndef _STDLIB_H_
40: #define _STDLIB_H_
41: #include <machine/ansi.h>
42:
43: #if !defined(_ANSI_SOURCE) /* for quad_t, etc. */
44: #include <sys/types.h>
45: #endif
46:
47: #ifdef _BSD_SIZE_T_
48: typedef _BSD_SIZE_T_ size_t;
49: #undef _BSD_SIZE_T_
50: #endif
51:
52: #ifdef _BSD_WCHAR_T_
53: typedef _BSD_WCHAR_T_ wchar_t;
54: #undef _BSD_WCHAR_T_
55: #endif
56:
57: typedef struct {
58: int quot; /* quotient */
59: int rem; /* remainder */
60: } div_t;
61:
62: typedef struct {
63: long quot; /* quotient */
64: long rem; /* remainder */
65: } ldiv_t;
66:
67: #if !defined(_ANSI_SOURCE)
68: typedef struct {
69: quad_t quot; /* quotient */
70: quad_t rem; /* remainder */
71: } qdiv_t;
72: #endif
73:
74:
75: #ifndef NULL
76: #define NULL 0
77: #endif
78:
79: #define EXIT_FAILURE 1
80: #define EXIT_SUCCESS 0
81:
82: #define RAND_MAX 0x7fffffff
83:
84: #define MB_CUR_MAX 1 /* XXX */
85:
86: #include <sys/cdefs.h>
87:
88: __BEGIN_DECLS
1.2 deraadt 89: __dead void abort __P((void));
1.1 deraadt 90: int abs __P((int));
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));
1.2 deraadt 99: __dead void exit __P((int));
1.1 deraadt 100: void free __P((void *));
101: char *getenv __P((const char *));
102: long labs __P((long));
103: ldiv_t ldiv __P((long, long));
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: unsigned long
113: strtoul __P((const char *, char **, int));
114: int system __P((const char *));
115:
116: /* these are currently just stubs */
117: int mblen __P((const char *, size_t));
118: size_t mbstowcs __P((wchar_t *, const char *, size_t));
119: int wctomb __P((char *, wchar_t));
120: int mbtowc __P((wchar_t *, const char *, size_t));
121: size_t wcstombs __P((char *, const wchar_t *, size_t));
122:
123: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
124: #if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2)
125: void *alloca __P((int)); /* built-in for gcc */
126: #else
127: void *alloca __P((size_t));
128: #endif /* __GNUC__ */
129:
130: char *getbsize __P((int *, long *));
131: char *cgetcap __P((char *, char *, int));
132: int cgetclose __P((void));
133: int cgetent __P((char **, char **, char *));
134: int cgetfirst __P((char **, char **));
135: int cgetmatch __P((char *, char *));
136: int cgetnext __P((char **, char **));
137: int cgetnum __P((char *, char *, long *));
138: int cgetset __P((char *));
139: int cgetstr __P((char *, char *, char **));
140: int cgetustr __P((char *, char *, char **));
141:
142: int daemon __P((int, int));
143: char *devname __P((int, int));
144: int getloadavg __P((double [], int));
145:
146: long a64l __P((const char *));
147: char *l64a __P((long));
148:
149: void cfree __P((void *));
150:
151: int getopt __P((int, char * const *, const char *));
152: extern char *optarg; /* getopt(3) external variables */
153: extern int opterr;
154: extern int optind;
155: extern int optopt;
156: extern int optreset;
157: int getsubopt __P((char **, char * const *, char **));
158: extern char *suboptarg; /* getsubopt(3) external variable */
159:
160: int heapsort __P((void *, size_t, size_t,
161: int (*)(const void *, const void *)));
162: int mergesort __P((void *, size_t, size_t,
163: int (*)(const void *, const void *)));
164: int radixsort __P((const unsigned char **, int, const unsigned char *,
165: unsigned));
166: int sradixsort __P((const unsigned char **, int, const unsigned char *,
167: unsigned));
168:
169: char *initstate __P((unsigned, char *, int));
170: long random __P((void));
171: char *realpath __P((const char *, char *));
172: char *setstate __P((char *));
173: void srandom __P((unsigned));
174:
175: int putenv __P((const char *));
176: int setenv __P((const char *, const char *, int));
177: void unsetenv __P((const char *));
178: void setproctitle __P((const char *, ...));
179:
180: quad_t qabs __P((quad_t));
181: qdiv_t qdiv __P((quad_t, quad_t));
182: quad_t strtoq __P((const char *, char **, int));
183: u_quad_t strtouq __P((const char *, char **, int));
184:
185: double drand48 __P((void));
186: double erand48 __P((unsigned short[3]));
187: long jrand48 __P((unsigned short[3]));
188: void lcong48 __P((unsigned short[7]));
189: long lrand48 __P((void));
190: long mrand48 __P((void));
191: long nrand48 __P((unsigned short[3]));
192: unsigned short *seed48 __P((unsigned short[3]));
193: void srand48 __P((long));
1.3 dm 194:
195: u_int32_t arc4random __P((void));
196: void arc4random_stir __P((void));
1.5 ! deraadt 197: void arc4random_addrandom __P((unsigned char *, int));
1.1 deraadt 198: #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
199:
200: __END_DECLS
201:
202: #endif /* _STDLIB_H_ */