Kernel, libc: Add ENOSYS

This error is returned by the kernel/C Library when an attempt is made to use a system call that doesn't exist.
This commit is contained in:
apio 2022-10-08 14:18:25 +02:00
parent ac72d64490
commit ce6ec3585c
5 changed files with 7 additions and 3 deletions

View File

@ -2,4 +2,5 @@
#define EPERM 1
#define ENOMEM 12
#define EINVAL 22
#define EINVAL 22
#define ENOSYS 38

View File

@ -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;
}
}

View File

@ -6,5 +6,6 @@ extern int errno;
#define EPERM 1
#define ENOMEM 12
#define EINVAL 22
#define ENOSYS 38
#endif

View File

@ -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;
}
}

View File

@ -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); }