summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-16 18:12:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-16 18:12:22 +0100
commit4e2c2b9748e8cc505d52575a76f0dd6808bc6a17 (patch)
tree84203fb10a8308820e56f6e70ad1828e1bb3e9ac /Kernel
parentd2046e79cfd915429b4755ef8e1338a1baa7815f (diff)
downloadserenity-4e2c2b9748e8cc505d52575a76f0dd6808bc6a17.zip
Minor TTY tweak.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/TTY.cpp11
-rw-r--r--Kernel/TTY.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/Kernel/TTY.cpp b/Kernel/TTY.cpp
index fca09c7f00..1067f72f58 100644
--- a/Kernel/TTY.cpp
+++ b/Kernel/TTY.cpp
@@ -4,6 +4,8 @@
#include <LibC/signal_numbers.h>
#include <LibC/sys/ioctl_numbers.h>
+//#define TTY_DEBUG
+
void DoubleBuffer::flip()
{
ASSERT(m_read_buffer_index == m_read_buffer->size());
@@ -48,6 +50,9 @@ ssize_t TTY::read(byte* buffer, size_t size)
ssize_t TTY::write(const byte* buffer, size_t size)
{
+#ifdef TTY_DEBUG
+ dbgprintf("TTY::write %b {%u}\n", buffer[0], size);
+#endif
onTTYWrite(buffer, size);
return 0;
}
@@ -81,10 +86,12 @@ void TTY::interrupt()
void TTY::set_termios(const Unix::termios& t)
{
m_termios = t;
- dbgprintf("%s set_termios: IECHO? %u, ISIG? %u\n",
+ dbgprintf("%s set_termios: IECHO? %u, ISIG? %u, ICANON? %u\n",
ttyName().characters(),
should_echo_input(),
- should_generate_signals());
+ should_generate_signals(),
+ in_canonical_mode()
+ );
}
int TTY::ioctl(Process& process, unsigned request, unsigned arg)
diff --git a/Kernel/TTY.h b/Kernel/TTY.h
index b1a45ab9a2..9c3dfa2c21 100644
--- a/Kernel/TTY.h
+++ b/Kernel/TTY.h
@@ -46,6 +46,7 @@ public:
void set_termios(const Unix::termios&);
bool should_generate_signals() const { return m_termios.c_lflag & ISIG; }
bool should_echo_input() const { return m_termios.c_lflag & ECHO; }
+ bool in_canonical_mode() const { return m_termios.c_lflag & ICANON; }
protected:
virtual bool isTTY() const final override { return true; }