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.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libc/stdlib.c b/src/libc/stdlib.c
index d7d4331..b4c2d84 100644
--- a/src/libc/stdlib.c
+++ b/src/libc/stdlib.c
@@ -48,11 +48,29 @@ char *itoa( int v, char *s, int base )
return s;
}
-void abort( void )
+void __attribute__( ( noreturn ) ) exit( int status )
+{
+#ifdef OS_ABAOS
+ // TODO: this should be done on process level, terminating
+ // the process (by signalling SIGABRT for instance)
+ kernel_panic( "exited with exit code %d", status );
+#endif
+#ifdef OS_LINUX
+ syscall1( __NR_exit, status );
+#endif
+
+ // make gcc happy ("error: ‘noreturn’ function does return")
+ for( ;; );
+}
+
+void __attribute__( ( noreturn ) ) abort( void )
{
// TODO: this should be done on process level, terminating
// the process (by signalling SIGABRT for instance)
kernel_panic( "aborted" );
+
+ // make gcc happy ("error: ‘noreturn’ function does return")
+ for( ;; );
}
// TODO: we should have a global memory manager and one per