Skip to content

Commit

Permalink
Some minor termios debugging output.
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Nov 12, 2018
1 parent f1404aa commit 1cf20a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Kernel/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//#define DEBUG_IO
//#define TASK_DEBUG
//#define FORK_DEBUG
#define TERMIOS_DEBUG
#define SIGNAL_DEBUG
#define MAX_PROCESS_GIDS 32

Expand Down Expand Up @@ -1545,10 +1546,10 @@ int Process::sys$tcgetattr(int fd, Unix::termios* tp)
return -EBADF;
if (!descriptor->isTTY())
return -ENOTTY;
auto& tty = *descriptor->tty();
#ifdef TERMIOS_DEBUG
kprintf("sys$tcgetattr(fd=%d, tp=%p)\n", fd, tp);
dbgprintf("sys$tcgetattr(fd=%d, tp=%p)\n", fd, tp);
#endif
auto& tty = *descriptor->tty();
memcpy(tp, &tty.termios(), sizeof(Unix::termios));
return 0;
}
Expand All @@ -1563,10 +1564,10 @@ int Process::sys$tcsetattr(int fd, int optional_actions, const Unix::termios* tp
if (!descriptor->isTTY())
return -ENOTTY;
#ifdef TERMIOS_DEBUG
kprintf("sys$tcsetattr(fd=%d, tp=%p)\n", fd, tp);
dbgprintf("sys$tcsetattr(fd=%d, tp=%p)\n", fd, tp);
#endif
auto& tty = *descriptor->tty();
memcpy(&tty.termios(), tp, sizeof(Unix::termios));
tty.set_termios(*tp);
return 0;
}

Expand Down
9 changes: 9 additions & 0 deletions Kernel/TTY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ void TTY::interrupt()
});
}
}

void TTY::set_termios(const Unix::termios& t)
{
m_termios = t;
dbgprintf("%s set_termios: IECHO? %u, ISIG? %u\n",
ttyName().characters(),
should_echo_input(),
should_generate_signals());
}
3 changes: 2 additions & 1 deletion Kernel/TTY.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class TTY : public CharacterDevice {
void set_pgid(pid_t pgid) { m_pgid = pgid; }
pid_t pgid() const { return m_pgid; }

Unix::termios& termios() { return m_termios; }
const Unix::termios& termios() const { return m_termios; }
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; }

Expand Down

0 comments on commit 1cf20a2

Please sign in to comment.