Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
stdlib.h
Go to the documentation of this file.
1 
4 #ifndef __STDLIB_H__
5 #define __STDLIB_H__
6 
7 #include <stddef.h>
8 
9 /* What a program hands exit() to say how it went */
10 #define EXIT_SUCCESS 0
11 #define EXIT_FAILURE 1
12 
13 /* The largest number rand() returns */
14 #define RAND_MAX 0x7fffffff
15 
21 void exit(int status);
22 
29 void *malloc(size_t size);
30 
36 void free(void *ptr);
37 
45 void *calloc(size_t nmemb, size_t size);
46 
55 void *realloc(void *ptr, size_t size);
56 
65 int mkstemp(char *template);
66 
67 /* Room on the stack of the caller, which goes away when the caller does. The
68  * compiler is the one that can take it, so it is the one that is asked
69  */
70 #define alloca(size) __builtin_alloca(size)
71 
72 /*
73  * Currently not implemented:
74  */
75 
76 #if 0
77 int atexit(void (*function)(void));
78 void abort(void);
79 int system(const char *command);
80 int setenv(const char *name, const char *value, int overwrite);
81 int unsetenv(const char *name);
82 int putenv(char *string);
83 char *getenv(const char *name);
84 #endif
85 
86 /*
87  * Non-standard extensions:
88  */
89 
90 char *ltoa(long value, char *buffer, int radix);
91 
92 /*
93  * Functions provided by the compiler:
94  */
95 
96 typedef struct {
97  int quot;
98  int rem;
99 } div_t;
100 
101 typedef struct {
102  long quot;
103  long rem;
104 } ldiv_t;
105 
106 typedef struct {
107  long long int quot;
108  long long int rem;
109 } lldiv_t;
110 
111 int atoi(const char *nptr);
112 long atol(const char *nptr);
113 long long atoll(const char *nptr);
114 long a64l(const char *str64);
115 int abs(int j);
116 double atof(const char *nptr);
117 void *bsearch(const void *key,
118  const void *base,
119  size_t nmemb,
120  size_t size,
121  int (*compar)(const void *, const void *));
122 div_t div(int numerator, int denominator);
123 int getsubopt(char **optionp, char *const *tokens, char **valuep);
124 char *l64a(long value);
125 long labs(long j);
126 ldiv_t ldiv(long numerator, long denominator);
127 long long llabs(long long j);
128 lldiv_t lldiv(long long numerator, long long denominator);
129 int mblen(const char *s, size_t n);
130 size_t mbstowcs(wchar_t *dest, const char *src, size_t n);
131 int mbtowc(wchar_t *pwc, const char *s, size_t n);
132 void qsort(void *base,
133  size_t nmemb,
134  size_t size,
135  int (*compar)(const void *, const void *));
136 char *realpath(const char *path, char *resolved_path);
137 double strtod(const char *nptr, char **endptr);
138 float strtof(const char *nptr, char **endptr);
139 long strtol(const char *nptr, char **endptr, int base);
140 long double strtold(const char *nptr, char **endptr);
141 long long strtoll(const char *nptr, char **endptr, int base);
142 unsigned long strtoul(const char *nptr, char **endptr, int base);
143 unsigned long long strtoull(const char *nptr, char **endptr, int base);
144 size_t wcstombs(char *dest, const wchar_t *src, size_t n);
145 int wctomb(char *s, wchar_t wc);
146 
147 #endif
void * realloc(void *ptr, size_t size)
Resize an allocated memory space, preserving its contents.
Definition: mm.c:242
void exit(int status)
To cause task termination.
void * calloc(size_t nmemb, size_t size)
Allocate and reset a memory space of an array.
Definition: mm.c:247
int mkstemp(char *template)
Create a file no other name stands for and open it. The last six characters of the template must be X...
Definition: wrapper.c:468
void * malloc(size_t size)
Allocate a memory space.
Definition: mm.c:152
void free(void *ptr)
Free a memory space.
Definition: mm.c:200
Definition: stdlib.h:96
Definition: stdlib.h:101
Definition: stdlib.h:106