diff --git a/sched/syscall.c b/sched/syscall.c index 5ae7516..815104a 100644 --- a/sched/syscall.c +++ b/sched/syscall.c @@ -41,7 +41,17 @@ ssize_t sys_read(int fd, void *buf, size_t count) if (tmp_buf == NULL) return -ENOMEM; - ssize_t ret = vfs_read(file, tmp_buf, fdesc->pos, count); + ssize_t ret; + bool blocked = false; + while ((ret = vfs_read(file, tmp_buf, fdesc->pos, count)) == -EAGAIN) { + blocked = true; + proc_block(getpid(), true); + yield(); + } + + if (blocked) + proc_unblock(getpid()); + if (ret > 0) memcpy(buf, tmp_buf, count); else diff --git a/usr.bin/shtest/shtest.c b/usr.bin/shtest/shtest.c index 058e99f..2caa411 100644 --- a/usr.bin/shtest/shtest.c +++ b/usr.bin/shtest/shtest.c @@ -22,6 +22,8 @@ void _start() if (fd < 0) exit(1); + write(fd, "shtest: simple userland shell test\n", 35); + promptfd(fd); char c;