Import placeholders for free() and malloc()
This commit is contained in:
parent
8214751336
commit
ffdc7343f4
|
@ -10,6 +10,7 @@
|
|||
|
||||
/* constants */
|
||||
# define EBADF 9
|
||||
# define ENOMEM 12
|
||||
# define ENODEV 19
|
||||
# define EINVAL 22
|
||||
# define ERANGE 34
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user