fd子系统3

This commit is contained in:
2026-04-18 12:36:32 +08:00
parent caf948f4f6
commit e83b51f220
6 changed files with 47 additions and 18 deletions

View File

@@ -341,7 +341,19 @@ void ush_write(const char *text) {
}
if (should_write_tty != 0) {
(void)cleonos_sys_tty_write(text, len);
const char *cursor = text;
u64 left = len;
while (left > 0ULL) {
u64 wrote = cleonos_sys_fd_write(1ULL, cursor, left);
if (wrote == 0ULL || wrote == (u64)-1) {
break;
}
cursor += wrote;
left -= wrote;
}
}
}
@@ -365,7 +377,7 @@ void ush_write_char(char ch) {
}
if (should_write_tty != 0) {
(void)cleonos_sys_tty_write_char(ch);
(void)cleonos_sys_fd_write(1ULL, &ch, 1ULL);
}
}