Import placeholders for free() and malloc()

This commit is contained in:
Pierre Pronchery 2018-06-07 23:55:59 -04:00
parent 8214751336
commit ffdc7343f4
3 changed files with 20 additions and 0 deletions

View File

@ -10,6 +10,7 @@
/* constants */
# define EBADF 9
# define ENOMEM 12
# define ENODEV 19
# define EINVAL 22
# define ERANGE 34

View File

@ -16,7 +16,9 @@ void abort(void);
int abs(int x);
uint32_t arc4random(void);
void exit(int status);
void free(void * ptr);
long labs(long x);
long long llabs(long long x);
void * malloc(size_t size);
#endif /* !UKERNEL_STDLIB_H */

View File

@ -5,6 +5,7 @@
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
@ -39,6 +40,12 @@ void exit(int status)
}
/* free */
void free(void * ptr)
{
}
/* labs */
long labs(long x)
{
@ -51,3 +58,13 @@ long long llabs(long long x)
{
return (x >= 0) ? x : -x;
}
/* malloc */
void * malloc(size_t size)
{
if(size == 0)
return NULL;
errno = ENOMEM;
return NULL;
}