summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2017/man0p/stdlib.h.0p
blob: c913788eb2f03f2d1934f904628aeee67dcbf302 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
'\" et
.TH stdlib.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
stdlib.h
\(em standard library definitions
.SH SYNOPSIS
.LP
.nf
#include <stdlib.h>
.fi
.SH DESCRIPTION
Some of the functionality described on this reference page extends the
ISO\ C standard. Applications shall define the appropriate feature test macro
(see the System Interfaces volume of POSIX.1\(hy2017,
.IR "Section 2.2" ", " "The Compilation Environment")
to enable the visibility of these symbols in this header.
.P
The
.IR <stdlib.h> 
header shall define the following macros which shall expand to
integer constant expressions:
.IP EXIT_FAILURE 12
Unsuccessful termination for
\fIexit\fR();
evaluates to a non-zero value.
.IP EXIT_SUCCESS 12
Successful termination for
\fIexit\fR();
evaluates to 0.
.IP {RAND_MAX} 12
Maximum value returned by
\fIrand\fR();
at least 32\|767.
.P
The
.IR <stdlib.h> 
header shall define the following macro which shall expand to a
positive integer expression with type
.BR size_t :
.IP {MB_CUR_MAX} 12
Maximum number of bytes in a character specified by the current
locale (category
.IR LC_CTYPE ).
.P
In the POSIX locale the value of
{MB_CUR_MAX}
shall be 1.
.P
The
.IR <stdlib.h> 
header shall define NULL as described in
.IR <stddef.h> .
.P
The
.IR <stdlib.h> 
header shall define the following data types through
.BR typedef :
.IP "\fBdiv_t\fP" 12
Structure type returned by the
\fIdiv\fR()
function.
.IP "\fBldiv_t\fP" 12
Structure type returned by the
\fIldiv\fR()
function.
.IP "\fBlldiv_t\fP" 12
Structure type returned by the
\fIlldiv\fR()
function.
.IP "\fBsize_t\fP" 12
As described in
.IR <stddef.h> .
.IP "\fBwchar_t\fP" 12
As described in
.IR <stddef.h> .
.P
In addition, the
.IR <stdlib.h> 
header shall define the following symbolic constants and macros
as described in
.IR <sys/wait.h> :
.P
.nf
WEXITSTATUS
WIFEXITED
WIFSIGNALED
WIFSTOPPED
WNOHANG
WSTOPSIG
WTERMSIG
WUNTRACED
.fi
.P
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
.sp
.RS 4
.nf

void          _Exit(int);
long          a64l(const char *);
void          abort(void);
int           abs(int);
int           atexit(void (*)(void));
double        atof(const char *);
int           atoi(const char *);
long          atol(const char *);
long long     atoll(const char *);
void         *bsearch(const void *, const void *, size_t, size_t,
                  int (*)(const void *, const void *));
void         *calloc(size_t, size_t);
div_t         div(int, int);
double        drand48(void);
double        erand48(unsigned short [3]);
void          exit(int);
void          free(void *);
char         *getenv(const char *);
int           getsubopt(char **, char *const *, char **);
int           grantpt(int);
char         *initstate(unsigned, char *, size_t);
long          jrand48(unsigned short [3]);
char         *l64a(long);
long          labs(long);
void          lcong48(unsigned short [7]);
ldiv_t        ldiv(long, long);
long long     llabs(long long);
lldiv_t       lldiv(long long, long long);
long          lrand48(void);
void         *malloc(size_t);
int           mblen(const char *, size_t);
size_t        mbstowcs(wchar_t *restrict, const char *restrict, size_t);
int           mbtowc(wchar_t *restrict, const char *restrict, size_t);
char         *mkdtemp(char *);
int           mkstemp(char *);
long          mrand48(void);
long          nrand48(unsigned short [3]);
int           posix_memalign(void **, size_t, size_t);
int           posix_openpt(int);
char         *ptsname(int);
int           putenv(char *);
void          qsort(void *, size_t, size_t, int (*)(const void *,
                  const void *));
int           rand(void);
int           rand_r(unsigned *);
long          random(void);
void         *realloc(void *, size_t);
char         *realpath(const char *restrict, char *restrict);
unsigned short *seed48(unsigned short [3]);
int           setenv(const char *, const char *, int);
void          setkey(const char *);
char         *setstate(char *);
void          srand(unsigned);
void          srand48(long);
void          srandom(unsigned);
double        strtod(const char *restrict, char **restrict);
float         strtof(const char *restrict, char **restrict);
long          strtol(const char *restrict, char **restrict, int);
long double   strtold(const char *restrict, char **restrict);
long long     strtoll(const char *restrict, char **restrict, int);
unsigned long strtoul(const char *restrict, char **restrict, int);
unsigned long long
              strtoull(const char *restrict, char **restrict, int);
int           system(const char *);
int           unlockpt(int);
int           unsetenv(const char *);
size_t        wcstombs(char *restrict, const wchar_t *restrict, size_t);
int           wctomb(char *, wchar_t);
.fi
.P
.RE
.P
Inclusion of the
.IR <stdlib.h> 
header may also make visible all symbols from
.IR <stddef.h> ,
.IR <limits.h> ,
.IR <math.h> ,
and
.IR <sys/wait.h> .
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
None.
.SH RATIONALE
None.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "\fB<limits.h>\fP",
.IR "\fB<math.h>\fP",
.IR "\fB<stddef.h>\fP",
.IR "\fB<sys_types.h>\fP",
.IR "\fB<sys_wait.h>\fP"
.P
.ad l
The System Interfaces volume of POSIX.1\(hy2017,
.IR "Section 2.2" ", " "The Compilation Environment",
.IR "\fI_Exit\fR\^(\|)",
.IR "\fIa64l\fR\^(\|)",
.IR "\fIabort\fR\^(\|)",
.IR "\fIabs\fR\^(\|)",
.IR "\fIatexit\fR\^(\|)",
.IR "\fIatof\fR\^(\|)",
.IR "\fIatoi\fR\^(\|)",
.IR "\fIatol\fR\^(\|)",
.IR "\fIbsearch\fR\^(\|)",
.IR "\fIcalloc\fR\^(\|)",
.IR "\fIdiv\fR\^(\|)",
.IR "\fIdrand48\fR\^(\|)",
.IR "\fIexit\fR\^(\|)",
.IR "\fIfree\fR\^(\|)",
.IR "\fIgetenv\fR\^(\|)",
.IR "\fIgetsubopt\fR\^(\|)",
.IR "\fIgrantpt\fR\^(\|)",
.IR "\fIinitstate\fR\^(\|)",
.IR "\fIlabs\fR\^(\|)",
.IR "\fIldiv\fR\^(\|)",
.IR "\fImalloc\fR\^(\|)",
.IR "\fImblen\fR\^(\|)",
.IR "\fImbstowcs\fR\^(\|)",
.IR "\fImbtowc\fR\^(\|)",
.IR "\fImkdtemp\fR\^(\|)",
.IR "\fIposix_memalign\fR\^(\|)",
.IR "\fIposix_openpt\fR\^(\|)",
.IR "\fIptsname\fR\^(\|)",
.IR "\fIputenv\fR\^(\|)",
.IR "\fIqsort\fR\^(\|)",
.IR "\fIrand\fR\^(\|)",
.IR "\fIrealloc\fR\^(\|)",
.IR "\fIrealpath\fR\^(\|)",
.IR "\fIsetenv\fR\^(\|)",
.IR "\fIsetkey\fR\^(\|)",
.IR "\fIstrtod\fR\^(\|)",
.IR "\fIstrtol\fR\^(\|)",
.IR "\fIstrtoul\fR\^(\|)",
.IR "\fIsystem\fR\^(\|)",
.IR "\fIunlockpt\fR\^(\|)",
.IR "\fIunsetenv\fR\^(\|)",
.IR "\fIwcstombs\fR\^(\|)",
.IR "\fIwctomb\fR\^(\|)"
.ad b
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .