lib: add libc and micro libc
This commit is contained in:
25
lib/ulibc/unistd/sbrk.c
Normal file
25
lib/ulibc/unistd/sbrk.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <mango/types.h>
|
||||
#include <mango/vm.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BRK_SIZE 0x400000
|
||||
|
||||
static kern_handle_t heap_region = KERN_HANDLE_INVALID;
|
||||
static kern_handle_t heap_object = KERN_HANDLE_INVALID;
|
||||
|
||||
static void *init_brk(size_t size)
|
||||
{
|
||||
kern_status_t status = KERN_OK;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *sbrk(intptr_t increment)
|
||||
{
|
||||
kern_status_t status = KERN_OK;
|
||||
if (heap_region == KERN_HANDLE_INVALID
|
||||
|| heap_object == KERN_HANDLE_INVALID) {
|
||||
return init_brk(BRK_SIZE);
|
||||
}
|
||||
|
||||
return (void *)-1;
|
||||
}
|
||||
Reference in New Issue
Block a user