Skip to content

Commit

Permalink
Kernel+LibC+UE: Introduce SIGINFO (generated with ^T)
Browse files Browse the repository at this point in the history
This signal is ignored by default, but can be caught to implement state
reporting a la BSD. :^)
  • Loading branch information
awesomekling committed Sep 9, 2020
1 parent 687aad0 commit f8e59ad
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DevTools/UserspaceEmulator/Emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,11 +1109,11 @@ static DefaultSignalAction default_signal_action(int signal)
case SIGIO:
case SIGPROF:
case SIGTERM:
case SIGPWR:
return DefaultSignalAction::Terminate;
case SIGCHLD:
case SIGURG:
case SIGWINCH:
case SIGINFO:
return DefaultSignalAction::Ignore;
case SIGQUIT:
case SIGILL:
Expand Down
7 changes: 6 additions & 1 deletion Kernel/TTY/TTY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void TTY::set_default_termios()
{
memset(&m_termios, 0, sizeof(m_termios));
m_termios.c_lflag |= ISIG | ECHO | ICANON;
static const char default_cc[32] = "\003\034\010\025\004\0\1\0\021\023\032\0\022\017\027\026\0";
static const char default_cc[32] = "\003\034\010\025\004\0\1\0\021\023\032\0\022\017\027\026\0\024";
memcpy(m_termios.c_cc, default_cc, sizeof(default_cc));
}

Expand Down Expand Up @@ -141,6 +141,11 @@ bool TTY::is_werase(u8 ch) const
void TTY::emit(u8 ch)
{
if (should_generate_signals()) {
if (ch == m_termios.c_cc[VINFO]) {
dbg() << tty_name() << ": VINFO pressed!";
generate_signal(SIGINFO);
return;
}
if (ch == m_termios.c_cc[VINTR]) {
dbg() << tty_name() << ": VINTR pressed!";
generate_signal(SIGINT);
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,11 @@ static DefaultSignalAction default_signal_action(u8 signal)
case SIGIO:
case SIGPROF:
case SIGTERM:
case SIGPWR:
return DefaultSignalAction::Terminate;
case SIGCHLD:
case SIGURG:
case SIGWINCH:
case SIGINFO:
return DefaultSignalAction::Ignore;
case SIGQUIT:
case SIGILL:
Expand Down
1 change: 1 addition & 0 deletions Kernel/UnixTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ enum {
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
#define VINFO 17

/* c_iflag bits */
#define IGNBRK 0000001
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LibC/signal_numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPWR 30
#define SIGINFO 30
#define SIGSYS 31
#define NSIG 32

0 comments on commit f8e59ad

Please sign in to comment.