1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 15:47:42 +00:00
serenity/Kernel/TTY
Daniel Bertalan ae6367999f Kernel: Fix assertion failure on large TTY writes
The `File::can_write` mechanism lets us check that writes won't block,
meaning some bytes can be immediately written to the underlying device.
This means calling `File::write` in a situation where no data could be
written is a logic error, which we `VERIFY()` in `Process::do_write()`.

TTY, in particular, processes the write in 256-byte buffered chunks.
Previously, we would assert that none of these sub-writes returned zero.
This was a logic error, as this rejected some successful writes. For
example, if there was exactly enough free space in `SlavePty`'s internal
buffer for the previous sub-write to complete fully. This made it
impossible to perform writes larger than `SlavePty`'s internal buffer.

Note that it's not an issue if `on_tty_write` returns zero, as partial
writes are handled correctly by the `buffer.read_buffered` helper. We
won't spin in a loop trying to write to a full buffer.

Fixes #8090
2021-06-21 16:57:07 +02:00
..
ConsoleManagement.cpp Kernel: Fix crash when switching to console 5 & 6 2021-05-31 17:42:21 +01:00
ConsoleManagement.h Kernel: Fix crash when switching to console 5 & 6 2021-05-31 17:42:21 +01:00
MasterPTY.cpp Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00
MasterPTY.h Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00
PTYMultiplexer.cpp Kernel: static vs non-static constexpr variables 2021-05-19 21:21:47 +01:00
PTYMultiplexer.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SlavePTY.cpp Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00
SlavePTY.h Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00
TTY.cpp Kernel: Fix assertion failure on large TTY writes 2021-06-21 16:57:07 +02:00
TTY.h Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00
VirtualConsole.cpp Kernel: Fix crash when changing screen resolution 2021-06-18 13:45:21 +02:00
VirtualConsole.h Kernel: Use KResultOr<size_t> throughout the TTY subsystem 2021-06-16 21:29:36 +02:00