diff options
author | dzwdz | 2022-07-14 16:47:40 +0200 |
---|---|---|
committer | dzwdz | 2022-07-14 16:47:40 +0200 |
commit | 81ac903ce39ae1c96d28da3d7af29f364296b4cf (patch) | |
tree | 7b07a01a8275a8dd8a08085d95c531bae49eedc1 /src/kernel/arch | |
parent | 3d73a3c8c5ce04a62f1fbea93f4f6ffda57dd6cf (diff) |
kernel/driver/serial: allow writes even with pending reads
Diffstat (limited to 'src/kernel/arch')
-rw-r--r-- | src/kernel/arch/i386/driver/serial.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/arch/i386/driver/serial.c b/src/kernel/arch/i386/driver/serial.c index d339484..dac5b75 100644 --- a/src/kernel/arch/i386/driver/serial.c +++ b/src/kernel/arch/i386/driver/serial.c @@ -77,8 +77,12 @@ static void accept(struct vfs_request *req) { break; case VFSOP_READ: if (ring_size((void*)&backlog) == 0) { - // nothing to read - blocked_on = req; + /* nothing to read, join queue */ + assert(!req->postqueue_next); + struct vfs_request **slot = &blocked_on; + while (*slot) + slot = &(*slot)->postqueue_next; + *slot = req; } else if (req->caller) { ret = clamp(0, req->output.len, sizeof buf); ret = ring_get((void*)&backlog, buf, ret); @@ -106,5 +110,5 @@ static void accept(struct vfs_request *req) { } static bool is_ready(struct vfs_backend __attribute__((unused)) *self) { - return blocked_on == NULL; + return true; } |