Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
stdlib.h
Go to the documentation of this file.
1/* stdlib.h */
2
3/*
4 * Copyright (c) 2011-2014 Wind River Systems, Inc.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
10#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
11
12#include <stddef.h>
13#include <limits.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19unsigned long strtoul(const char *nptr, char **endptr, int base);
20long strtol(const char *nptr, char **endptr, int base);
21int atoi(const char *s);
22
23void *malloc(size_t size);
24void free(void *ptr);
25void *calloc(size_t nmemb, size_t size);
26void *realloc(void *ptr, size_t size);
27void *reallocarray(void *ptr, size_t nmemb, size_t size);
28
29void *bsearch(const void *key, const void *array,
30 size_t count, size_t size,
31 int (*cmp)(const void *key, const void *element));
32
33#define EXIT_SUCCESS 0
34#define EXIT_FAILURE 1
35void _exit(int status);
36static inline void exit(int status)
37{
38 _exit(status);
39}
40void abort(void);
41
42#ifdef CONFIG_MINIMAL_LIBC_RAND
43#define RAND_MAX INT_MAX
44int rand(void);
45void srand(unsigned int seed);
46#endif /* CONFIG_MINIMAL_LIBC_RAND */
47
48static inline int abs(int __n)
49{
50 return (__n < 0) ? -__n : __n;
51}
52
53static inline long labs(long __n)
54{
55 return (__n < 0L) ? -__n : __n;
56}
57
58static inline long long llabs(long long __n)
59{
60 return (__n < 0LL) ? -__n : __n;
61}
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_ */
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa s
Definition: asm-macro-32-bit-gnu.h:17
ZTEST_BMEM int count
Definition: main.c:33
void * ptr
Definition: printk.c:79
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
void * calloc(size_t nmemb, size_t size)
int atoi(const char *s)
long strtol(const char *nptr, char **endptr, int base)
static long long llabs(long long __n)
Definition: stdlib.h:58
void * bsearch(const void *key, const void *array, size_t count, size_t size, int(*cmp)(const void *key, const void *element))
unsigned long strtoul(const char *nptr, char **endptr, int base)
void abort(void)
static long labs(long __n)
Definition: stdlib.h:53
void * malloc(size_t size)
void * reallocarray(void *ptr, size_t nmemb, size_t size)
void * realloc(void *ptr, size_t size)
static int abs(int __n)
Definition: stdlib.h:48
static void exit(int status)
Definition: stdlib.h:36
void free(void *ptr)