sys_read: implement different blocking mechanism
This commit is contained in:
parent
832420d8a7
commit
fba82790a9
3 changed files with 8 additions and 1 deletions
|
|
@ -43,7 +43,12 @@ ssize_t sys_read(int fd, void *buf, size_t count)
|
|||
return -ENOMEM;
|
||||
|
||||
ssize_t ret;
|
||||
ret = vfs_read(file, tmp_buf, fdesc->pos, count);
|
||||
while ((ret = vfs_read(file, tmp_buf, fdesc->pos, count)) == -EAGAIN) {
|
||||
proc->state = PROC_BLOCKED_SYSCALL;
|
||||
schedule();
|
||||
}
|
||||
|
||||
proc->state = PROC_RUNNING;
|
||||
|
||||
if (ret > 0)
|
||||
memcpy(buf, tmp_buf, count);
|
||||
|
|
|
|||
Loading…
Reference in a new issue