diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-07-13 20:09:53 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-07-13 20:09:53 +0200 |
commit | 7d356b1ddab0150b7347a5952e3bff2a04704fd4 (patch) | |
tree | c26a5b9c45d970dda011f9923966233a4f70669b /src/libc/stdlib.c | |
parent | 7162c5eed91a8e22a4b768110011df28bfd86455 (diff) | |
download | abaos-7d356b1ddab0150b7347a5952e3bff2a04704fd4.tar.gz abaos-7d356b1ddab0150b7347a5952e3bff2a04704fd4.tar.bz2 |
added an exit function
added Linux syscall stubs for exit and write
adapted all tests
added a printf test
made stdio work on Linux or AbaOs syscalls
Diffstat (limited to 'src/libc/stdlib.c')
-rw-r--r-- | src/libc/stdlib.c | 20 |
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 |