aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/syscall.c
diff options
context:
space:
mode:
authorMarvin Borner2021-01-13 19:51:40 +0100
committerMarvin Borner2021-01-13 19:51:40 +0100
commit91abed9333241731d0cd877beba4e2d4675989c8 (patch)
tree09a5e509afda809d56db88ec720c78864312620e /kernel/features/syscall.c
parent9ac1eda2988b6c7472a24817f4fd623de28a33f5 (diff)
VFS ready function and read yielding
Diffstat (limited to 'kernel/features/syscall.c')
-rw-r--r--kernel/features/syscall.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c
index dbb7033..c5570c3 100644
--- a/kernel/features/syscall.c
+++ b/kernel/features/syscall.c
@@ -37,7 +37,12 @@ void syscall_handler(struct regs *r)
break;
}
case SYS_READ: {
- r->eax = (u32)vfs_read((char *)r->ebx, (void *)r->ecx, r->edx, r->esi);
+ if (vfs_ready((char *)r->ebx)) {
+ r->eax = (u32)vfs_read((char *)r->ebx, (void *)r->ecx, r->edx, r->esi);
+ } else {
+ proc_current()->state = PROC_SLEEPING;
+ scheduler(r);
+ }
break;
}
case SYS_WRITE: {