forked from PoliEcho-holding-org/kern
31 lines
704 B
C
31 lines
704 B
C
#ifndef _STDLIB_H
|
|
#define _STDLIB_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#define EXIT_SUCCESS 0
|
|
#define EXIT_FAILURE 1
|
|
#define RAND_MAX 0x7FFFFFF
|
|
|
|
/* Memory allocation */
|
|
void* malloc(size_t size);
|
|
void* calloc(size_t count, size_t size);
|
|
void* realloc(void* ptr, size_t size);
|
|
void free(void* ptr);
|
|
|
|
/* Process controll */
|
|
void _Exit(int status);
|
|
void exit(int status);
|
|
|
|
// TODO: move atoi() here
|
|
|
|
/* Random number generator */
|
|
int rand(void);
|
|
void srand(unsigned int seed);
|
|
|
|
/* Sort & search */
|
|
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
|
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
|
|
|
#endif
|