1stdlib.h(0P)               POSIX Programmer's Manual              stdlib.h(0P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       stdlib.h — standard library definitions
13

SYNOPSIS

15       #include <stdlib.h>
16

DESCRIPTION

18       Some of the functionality described on this reference page extends  the
19       ISO C  standard. Applications shall define the appropriate feature test
20       macro (see the System Interfaces volume of POSIX.1‐2017,  Section  2.2,
21       The  Compilation Environment) to enable the visibility of these symbols
22       in this header.
23
24       The <stdlib.h> header shall define the  following  macros  which  shall
25       expand to integer constant expressions:
26
27       EXIT_FAILURE
28                   Unsuccessful  termination  for  exit(); evaluates to a non-
29                   zero value.
30
31       EXIT_SUCCESS
32                   Successful termination for exit(); evaluates to 0.
33
34       {RAND_MAX}  Maximum value returned by rand(); at least 32767.
35
36       The <stdlib.h> header shall define  the  following  macro  which  shall
37       expand to a positive integer expression with type size_t:
38
39       {MB_CUR_MAX}
40                   Maximum  number  of  bytes  in a character specified by the
41                   current locale (category LC_CTYPE).
42
43       In the POSIX locale the value of {MB_CUR_MAX} shall be 1.
44
45       The <stdlib.h> header shall define NULL as described in <stddef.h>.
46
47       The <stdlib.h> header shall define the  following  data  types  through
48       typedef:
49
50       div_t       Structure type returned by the div() function.
51
52       ldiv_t      Structure type returned by the ldiv() function.
53
54       lldiv_t     Structure type returned by the lldiv() function.
55
56       size_t      As described in <stddef.h>.
57
58       wchar_t     As described in <stddef.h>.
59
60       In  addition, the <stdlib.h> header shall define the following symbolic
61       constants and macros as described in <sys/wait.h>:
62
63       WEXITSTATUS
64       WIFEXITED
65       WIFSIGNALED
66       WIFSTOPPED
67       WNOHANG
68       WSTOPSIG
69       WTERMSIG
70       WUNTRACED
71
72       The following shall be declared as functions and may also be defined as
73       macros. Function prototypes shall be provided.
74
75
76           void          _Exit(int);
77           long          a64l(const char *);
78           void          abort(void);
79           int           abs(int);
80           int           atexit(void (*)(void));
81           double        atof(const char *);
82           int           atoi(const char *);
83           long          atol(const char *);
84           long long     atoll(const char *);
85           void         *bsearch(const void *, const void *, size_t, size_t,
86                             int (*)(const void *, const void *));
87           void         *calloc(size_t, size_t);
88           div_t         div(int, int);
89           double        drand48(void);
90           double        erand48(unsigned short [3]);
91           void          exit(int);
92           void          free(void *);
93           char         *getenv(const char *);
94           int           getsubopt(char **, char *const *, char **);
95           int           grantpt(int);
96           char         *initstate(unsigned, char *, size_t);
97           long          jrand48(unsigned short [3]);
98           char         *l64a(long);
99           long          labs(long);
100           void          lcong48(unsigned short [7]);
101           ldiv_t        ldiv(long, long);
102           long long     llabs(long long);
103           lldiv_t       lldiv(long long, long long);
104           long          lrand48(void);
105           void         *malloc(size_t);
106           int           mblen(const char *, size_t);
107           size_t        mbstowcs(wchar_t *restrict, const char *restrict, size_t);
108           int           mbtowc(wchar_t *restrict, const char *restrict, size_t);
109           char         *mkdtemp(char *);
110           int           mkstemp(char *);
111           long          mrand48(void);
112           long          nrand48(unsigned short [3]);
113           int           posix_memalign(void **, size_t, size_t);
114           int           posix_openpt(int);
115           char         *ptsname(int);
116           int           putenv(char *);
117           void          qsort(void *, size_t, size_t, int (*)(const void *,
118                             const void *));
119           int           rand(void);
120           int           rand_r(unsigned *);
121           long          random(void);
122           void         *realloc(void *, size_t);
123           char         *realpath(const char *restrict, char *restrict);
124           unsigned short *seed48(unsigned short [3]);
125           int           setenv(const char *, const char *, int);
126           void          setkey(const char *);
127           char         *setstate(char *);
128           void          srand(unsigned);
129           void          srand48(long);
130           void          srandom(unsigned);
131           double        strtod(const char *restrict, char **restrict);
132           float         strtof(const char *restrict, char **restrict);
133           long          strtol(const char *restrict, char **restrict, int);
134           long double   strtold(const char *restrict, char **restrict);
135           long long     strtoll(const char *restrict, char **restrict, int);
136           unsigned long strtoul(const char *restrict, char **restrict, int);
137           unsigned long long
138                         strtoull(const char *restrict, char **restrict, int);
139           int           system(const char *);
140           int           unlockpt(int);
141           int           unsetenv(const char *);
142           size_t        wcstombs(char *restrict, const wchar_t *restrict, size_t);
143           int           wctomb(char *, wchar_t);
144
145       Inclusion  of  the  <stdlib.h> header may also make visible all symbols
146       from <stddef.h>, <limits.h>, <math.h>, and <sys/wait.h>.
147
148       The following sections are informative.
149

APPLICATION USAGE

151       None.
152

RATIONALE

154       None.
155

FUTURE DIRECTIONS

157       None.
158

SEE ALSO

160       <limits.h>, <math.h>, <stddef.h>, <sys_types.h>, <sys_wait.h>
161
162       The System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compila‐
163       tion Environment, _Exit(), a64l(), abort(), abs(), atexit(), atof(),
164       atoi(), atol(), bsearch(), calloc(), div(), drand48(), exit(), free(),
165       getenv(), getsubopt(), grantpt(), initstate(), labs(), ldiv(), mal‐
166       loc(), mblen(), mbstowcs(), mbtowc(), mkdtemp(), posix_memalign(),
167       posix_openpt(), ptsname(), putenv(), qsort(), rand(), realloc(), real‐
168       path(), setenv(), setkey(), strtod(), strtol(), strtoul(), system(),
169       unlockpt(), unsetenv(), wcstombs(), wctomb()
170
172       Portions  of  this text are reprinted and reproduced in electronic form
173       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
174       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
175       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
176       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
177       event of any discrepancy between this version and the original IEEE and
178       The  Open Group Standard, the original IEEE and The Open Group Standard
179       is the referee document. The original Standard can be  obtained  online
180       at http://www.opengroup.org/unix/online.html .
181
182       Any  typographical  or  formatting  errors that appear in this page are
183       most likely to have been introduced during the conversion of the source
184       files  to  man page format. To report such errors, see https://www.ker
185       nel.org/doc/man-pages/reporting_bugs.html .
186
187
188
189IEEE/The Open Group                  2017                         stdlib.h(0P)
Impressum