mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-27 13:44:01 +00:00
fd子系统3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user