summaryrefslogtreecommitdiff
path: root/Kernel/MasterPTY.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-15 09:17:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-15 09:17:22 +0100
commite452303c664c3facfebe39539da0d796029bc603 (patch)
tree3e2ac04f858d480843606b3000cc4e5e7ac57c09 /Kernel/MasterPTY.cpp
parent49b63281a09b61ab608f51a771f124f14c1ee1ad (diff)
downloadserenity-e452303c664c3facfebe39539da0d796029bc603.zip
Allow character devices to block write attempts until there is more space.
Diffstat (limited to 'Kernel/MasterPTY.cpp')
-rw-r--r--Kernel/MasterPTY.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/MasterPTY.cpp b/Kernel/MasterPTY.cpp
index 2894839bc1..13eb54ace6 100644
--- a/Kernel/MasterPTY.cpp
+++ b/Kernel/MasterPTY.cpp
@@ -36,6 +36,11 @@ bool MasterPTY::has_data_available_for_reading(Process&) const
return !m_buffer.is_empty();
}
+bool MasterPTY::can_write(Process&) const
+{
+ return m_buffer.bytes_in_write_buffer() < 4096;
+}
+
void MasterPTY::on_slave_write(const byte* data, size_t size)
{
m_buffer.write(data, size);