summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kernel/arch/i386/driver/serial.c10
-rw-r--r--src/kernel/vfs/request.h3
2 files changed, 10 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;
}
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h
index 29f1ee9..fc1ef08 100644
--- a/src/kernel/vfs/request.h
+++ b/src/kernel/vfs/request.h
@@ -55,6 +55,9 @@ struct vfs_request {
struct vfs_backend *backend;
struct vfs_request *queue_next;
+ struct vfs_request *postqueue_next; /* used by kernel backends */
+ /* only one of these queues is in use at a given moment, they could
+ * be merged into a single field */
};
/** Assigns the vfs_request to the caller, and dispatches the call */