62 #ifndef __INCLUDE_STDLIB_H 63 #define __INCLUDE_STDLIB_H 69 #include <tinyara/config.h> 70 #include <tinyara/compiler.h> 72 #include <sys/types.h> 84 #define EXIT_SUCCESS 0 85 #define EXIT_FAILURE 1 93 #define RAND_MAX INT_MAX 106 #ifndef CONFIG_DISABLE_ENVIRON 107 #define environ get_environ_ptr() 164 #if defined(__cplusplus) 165 #define EXTERN extern "C" 168 #define EXTERN extern 181 void srand(
unsigned int seed);
191 #define srandom(s) srand(s) 204 #ifndef CONFIG_DISABLE_ENVIRON 224 FAR
char *
getenv(FAR
const char *name);
233 int putenv(FAR
const char *
string);
251 int setenv(
const char *name,
const char *value,
int overwrite);
272 void exit(
int status) noreturn_function;
280 void abort(
void) noreturn_function;
281 #ifdef CONFIG_SCHED_ATEXIT 290 int atexit(CODE
void (*func)(
void));
292 #ifdef CONFIG_SCHED_ONEXIT 305 int on_exit(CODE
void (*func)(
int, FAR
void *), FAR
void *arg);
313 void _exit(
int status);
317 #define _Exit(s) _exit(s) 327 long strtol(
const char *,
char **,
int);
335 unsigned long strtoul(
const char *,
char **,
int);
336 #ifdef CONFIG_HAVE_LONG_LONG 344 long long strtoll(
const char *,
char **,
int);
352 unsigned long long strtoull(
const char *,
char **,
int);
354 #ifdef CONFIG_HAVE_DOUBLE 362 double strtod(FAR
const char *str, FAR
char **endptr);
364 #ifdef CONFIG_HAVE_LONG_DOUBLE 369 long double strtold(FAR
const char *str, FAR
char **endptr);
374 float strtof(FAR
const char *str, FAR
char **endptr);
386 #define atoi(nptr) strtol((nptr), NULL, 10) 394 #define atol(nptr) strtol((nptr), NULL, 10) 395 #ifdef CONFIG_HAVE_LONG_LONG 403 #define atoll(nptr) strtoll((nptr), NULL, 10) 412 #define atof(nptr) strtod((nptr), NULL) 426 char *
itoa(
int value,
char *str,
int base);
430 #ifdef CONFIG_LIBC_WCHAR 435 int mbtowc(FAR
wchar_t *pwc, FAR
const char *s,
size_t n);
439 int wctomb(FAR
char *s,
wchar_t wchar);
461 void free(FAR
void *);
469 FAR
void *
realloc(FAR
void *,
size_t);
498 FAR
void *
calloc(
size_t,
size_t);
516 long int labs(
long int j);
517 #ifdef CONFIG_HAVE_LONG_LONG 525 long long int llabs(
long long int j);
528 #ifdef CONFIG_CAN_PASS_STRUCTS 541 ldiv_t ldiv(
long numer,
long denom);
542 #ifdef CONFIG_HAVE_LONG_LONG 546 lldiv_t lldiv(
long long numer,
long long denom);
560 FAR
char *
mktemp(FAR
char *path_template);
569 int mkstemp(FAR
char *path_template);
579 void qsort(
void *base,
size_t nmemb,
size_t size,
int (*compar)(
const void *,
const void *));
589 FAR
void *
bsearch(FAR
const void *key, FAR
const void *base,
size_t nel,
size_t width, CODE
int (*compar)(FAR
const void *, FAR
const void *));
591 #ifdef CONFIG_CAN_PASS_STRUCTS 613 #if defined(__cplusplus)
FAR void * bsearch(FAR const void *key, FAR const void *base, size_t nel, size_t width, CODE int(*compar)(FAR const void *, FAR const void *))
binary search a sorted table
FAR void * calloc(size_t, size_t)
a memory allocator
int setenv(const char *name, const char *value, int overwrite)
add or change environment variable
struct mallinfo mallinfo(void)
returns a copy of updated current heap information for the user heap
int on_exit(CODE void(*func)(int, FAR void *), FAR void *arg)
register a function to be called at program exit
unsigned long long strtoull(const char *, char **, int)
convert a string to an unsigned long
int abs(int j)
return an integer absolute value
int rand(void)
pseudo-random number generator
void abort(void) noreturn_function
generate an abnormal process abort
void free(FAR void *)
free allocated memory
FAR char * get_environ_ptr(size_t *envsize)
Return a pointer to the thread specific environ variable.
int putenv(FAR const char *string)
change or add a value to an environment
double strtod(FAR const char *str, FAR char **endptr)
convert a string to a double-precision number
void exit(int status) noreturn_function
terminate a process
FAR char * mktemp(FAR char *path_template)
generates a unique temporary filename from template.
unsigned long strtoul(const char *, char **, int)
convert a string to an unsigned long
FAR void * memalign(size_t, size_t)
allocates size bytes and returns a pointer to the allocated memory
void srand(unsigned int seed)
initialize random number generator
int mkstemp(FAR char *path_template)
create a regular file with a unique name derived from template and return a file descriptor for the f...
long long strtoll(const char *, char **, int)
convert a string to a long integer
int atexit(CODE void(*func)(void))
register a function to run at process termination
long long int llabs(long long int j)
return a long integer absolute value
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
sort a table of data
FAR void * realloc(FAR void *, size_t)
memory reallocator
FAR void * malloc(size_t)
a memory allocator
int unsetenv(const char *name)
remove an environment variable
char * itoa(int value, char *str, int base)
convert integer to string
FAR void * zalloc(size_t)
Allocate and zero memory from the user heap.
div_t div(int numer, int denom)
compute the quotient and remainder of an integer division
int clearenv(void)
clears the environment of all name-value pairs and sets the value of the external variable environ to...
long random(void)
pseudo-random number generator
long int labs(long int j)
return a long integer absolute value
FAR char * getenv(FAR const char *name)
get value of an environment variable
structure of memory information
long strtol(const char *, char **, int)
convert a string to a long integer