Make pipes blocking

This commit is contained in:
2026-06-19 21:49:18 +03:00
parent 415f78fd40
commit 325dc6339a
6 changed files with 53 additions and 45 deletions
+5 -2
View File
@@ -1,5 +1,6 @@
#include "src/kernel/keyboard.h"
#include "src/kernel/idt.h"
#include "src/kernel/process.h"
#include "src/kernel/stream.h"
#include "src/kernel/util.h"
#include "src/lib/memory.h"
@@ -56,8 +57,10 @@ static uint64_t stream_write(__attribute__((unused)) const stream_t *self, __att
}
static uint64_t stream_read(__attribute__((unused)) const stream_t *self, uint64_t max, char *to) {
if (max == 0 || buffer_length == 0) {
return 0;
while (!buffer_length) {
__asm__ volatile("sti");
process_next();
__asm__ volatile("cli");
}
uint64_t size = buffer_length > max ? max : buffer_length;