diff --git a/kernel/include/errno.h b/kernel/include/errno.h index c02a1dcd..64cb4364 100644 --- a/kernel/include/errno.h +++ b/kernel/include/errno.h @@ -2,4 +2,5 @@ #define EPERM 1 #define ENOMEM 12 -#define EINVAL 22 \ No newline at end of file +#define EINVAL 22 +#define ENOSYS 38 \ No newline at end of file diff --git a/kernel/src/sys/Syscall.cpp b/kernel/src/sys/Syscall.cpp index 1f11e5b4..26785759 100644 --- a/kernel/src/sys/Syscall.cpp +++ b/kernel/src/sys/Syscall.cpp @@ -1,4 +1,5 @@ #include "sys/Syscall.h" +#include "errno.h" #include "io/Serial.h" #include "thread/Scheduler.h" @@ -25,6 +26,6 @@ void Syscall::entry(Context* context) case SYS_gettid: sys_gettid(context); break; case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx); break; case SYS_munmap: sys_munmap(context, (void*)context->rdi, context->rsi); break; - default: context->rax = -1; break; + default: context->rax = -ENOSYS; break; } } \ No newline at end of file diff --git a/libs/libc/include/errno.h b/libs/libc/include/errno.h index 1caae45e..27deecbf 100644 --- a/libs/libc/include/errno.h +++ b/libs/libc/include/errno.h @@ -6,5 +6,6 @@ extern int errno; #define EPERM 1 #define ENOMEM 12 #define EINVAL 22 +#define ENOSYS 38 #endif \ No newline at end of file diff --git a/libs/libc/src/string.cpp b/libs/libc/src/string.cpp index b9d32192..c99ef0ad 100644 --- a/libs/libc/src/string.cpp +++ b/libs/libc/src/string.cpp @@ -120,6 +120,7 @@ extern "C" case EPERM: return "Operation not permitted"; case EINVAL: return "Invalid argument"; case ENOMEM: return "Out of memory"; + case ENOSYS: return "Function not implemented"; default: return 0; } } diff --git a/libs/libc/src/unistd.cpp b/libs/libc/src/unistd.cpp index 25ef02cb..84ae01d3 100644 --- a/libs/libc/src/unistd.cpp +++ b/libs/libc/src/unistd.cpp @@ -60,7 +60,7 @@ extern "C" result = __luna_syscall5(number, arg0, arg1, arg2, arg3, arg4); break; } - default: result = -1; break; + default: result = -ENOSYS; break; } va_end(ap); if (number == SYS_mmap) { _RETURN_WITH_MEMORY_ERRNO(result, long int); }