change errno to error to avoid confusion

This commit is contained in:
2026-10-06 00:20:35 +02:00
parent 57b1d338ac
commit 685f911431
6 changed files with 12 additions and 11 deletions
+3 -3
View File
@@ -12,21 +12,21 @@ struct syscall_ret arch_archctl(uintptr_t op, uintptr_t arg) {
switch (op) {
case __ARCHCTL_SET_FSBASE:
if (!arch_mem_addr_is_user(arg)) {
ret.errno = EINVAL;
ret.error = EINVAL;
return ret;
}
asm_wrmsr(MSR_FS_BASE, arg);
return ret;
case __ARCHCTL_SET_GSBASE:
if (!arch_mem_addr_is_user(arg)) {
ret.errno = EINVAL;
ret.error = EINVAL;
return ret;
}
// Update the inactive GSBASE MSR, not ours.
asm_wrmsr(MSR_KERNEL_GS_BASE, arg);
return ret;
default:
ret.errno = EINVAL;
ret.error = EINVAL;
return ret;
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
struct syscall_ret {
uintptr_t value;
int errno;
int error;
};
struct syscall {
+1 -1
View File
@@ -1,5 +1,5 @@
#ifndef SYSCALL_DECLARE
#define SYSCALL_DECLARE(number, name, num_args) extern void sys_##name(...);
#define SYSCALL_DECLARE(number, name, num_args)
#endif
SYSCALL_DECLARE(0, exit, 1)
+2 -1
View File
@@ -8,6 +8,7 @@
#include <bits/sched.h>
// Declare all syscalls.
#define SYSCALL_DECLARE(number, name, num_args) extern void sys_##name(...);
#include <zinnia/syscall_list.inc>
#undef SYSCALL_DECLARE
@@ -43,5 +44,5 @@ void syscall_dispatch(struct arch_context* ctx) {
}
ctx->ARCH_CTX_RET0 = ret.value;
ctx->ARCH_CTX_RET1 = ret.errno;
ctx->ARCH_CTX_RET1 = ret.error;
}
+1 -1
View File
@@ -4,7 +4,7 @@
struct syscall_ret sys_exit(int err) {
struct syscall_ret ret = {};
ret.errno = ENOSYS;
ret.error = ENOSYS;
panic("sys::exit() not implemented!\n");
+4 -4
View File
@@ -20,7 +20,7 @@ struct syscall_ret sys_setuname(const __user struct __utsname* ptr) {
struct syscall_ret ret = {};
if (!ptr) {
ret.errno = EINVAL;
ret.error = EINVAL;
return ret;
}
@@ -28,7 +28,7 @@ struct syscall_ret sys_setuname(const __user struct __utsname* ptr) {
struct __utsname read_buf;
if (!usercopy_read(&read_buf, ptr, sizeof(read_buf))) {
ret.errno = EFAULT;
ret.error = EFAULT;
return ret;
}
@@ -50,7 +50,7 @@ struct syscall_ret sys_getuname(__user struct __utsname* ptr) {
struct syscall_ret ret = {};
if (!ptr) {
ret.errno = EINVAL;
ret.error = EINVAL;
return ret;
}
@@ -59,7 +59,7 @@ struct syscall_ret sys_getuname(__user struct __utsname* ptr) {
spin_unlock(&uname_lock);
if (!usercopy_write(ptr, &write_buf, sizeof(write_buf)))
ret.errno = EFAULT;
ret.error = EFAULT;
return ret;
}