From f356cff4a222ec29b7f44b75c01034619a80c32c Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 16 Sep 2020 11:13:27 -0400 Subject: [PATCH] chore: Return sane errno on unimplemented syscall --- runtime/src/libc/syscall.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/runtime/src/libc/syscall.c b/runtime/src/libc/syscall.c index c4e3337..5abd190 100644 --- a/runtime/src/libc/syscall.c +++ b/runtime/src/libc/syscall.c @@ -721,17 +721,14 @@ inner_syscall_handler(int32_t n, int32_t a, int32_t b, int32_t c, int32_t d, int case SYS_RT_SIGACTION: case SYS_RT_SIGPROGMASK: case SYS_MADVISE: - /* These calls are unimplemented but not believed to be used */ - assert(0); - return 0; default: /* This is a general catch all for the other functions below */ - debuglog("Unknown Syscall %d\n", n); - fflush(stderr); - assert(0); + debuglog("Call to unknown or implemented syscall %d\n", n); + errno = ENOSYS; + return -1; - /* The calls below this need to be validated / refactored to be non-blocking */ + /* TODO: The calls below need to be validated / refactored to be non-blocking */ // case SYS_READV: // return wasm_readv(a, b, c); // case SYS_OPEN: