aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/features/syscall.c')
-rw-r--r--kernel/features/syscall.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c
index abd7130..2c30a3b 100644
--- a/kernel/features/syscall.c
+++ b/kernel/features/syscall.c
@@ -60,7 +60,12 @@ static void syscall_handler(struct regs *r)
break;
}
case SYS_IOREAD: {
- r->eax = io_read(r->ebx, (void *)r->ecx, r->edx, r->esi);
+ res ret = io_read(r->ebx, (void *)r->ecx, r->edx, r->esi);
+ if (ret == -EAGAIN) {
+ io_block(r->ebx, proc_current(), r);
+ } else {
+ r->eax = ret;
+ }
break;
}
case SYS_IOWRITE: {
@@ -87,10 +92,12 @@ static void syscall_handler(struct regs *r)
break;
}
case SYS_EXIT: {
+ r->eax = EOK;
proc_exit(proc_current(), r, (s32)r->ebx);
break;
}
case SYS_YIELD: {
+ r->eax = EOK;
proc_yield(r);
break;
}
@@ -126,6 +133,7 @@ static void syscall_handler(struct regs *r)
// TODO: Reimplement network functions using VFS
default: {
+ r->eax = -EINVAL;
printf("Unknown syscall %d!\n", num);
break;
}