summaryrefslogtreecommitdiff
path: root/src/libc/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libc/stdlib.c')
-rw-r--r--src/libc/stdlib.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libc/stdlib.c b/src/libc/stdlib.c
index d6bb8b2..d7d4331 100644
--- a/src/libc/stdlib.c
+++ b/src/libc/stdlib.c
@@ -3,6 +3,8 @@
#include "stdlib.h"
#include "stddef.h"
+#include "kernel.h"
+
static void strreverse( char *s )
{
char *end = s + strlen( s ) - 1;
@@ -46,29 +48,28 @@ char *itoa( int v, char *s, int base )
return s;
}
-#ifdef OS_ABAOS
+void abort( void )
+{
+ // TODO: this should be done on process level, terminating
+ // the process (by signalling SIGABRT for instance)
+ kernel_panic( "aborted" );
+}
+
// TODO: we should have a global memory manager and one per
// user process later
static memory_manager_t *stdlib_memory_manager = NULL;
-#endif
void *malloc( size_t size )
{
-#ifdef OS_ABAOS
return memory_manager_allocate( stdlib_memory_manager, size );
-#endif
}
void free( void *p )
{
-#ifdef OS_ABAOS
memory_manager_deallocate( stdlib_memory_manager, &p );
-#endif
}
-#ifdef OS_ABAOS
void __stdlib_set_memory_manager( memory_manager_t *memory_manager )
{
stdlib_memory_manager = memory_manager;
}
-#endif