MiniDevil
As beautiful as a shell
Signal handlers: SIGINT / SIGQUIT for interactive & exec modes. More...
Include dependency graph for signals.c:Signal handlers: SIGINT / SIGQUIT for interactive & exec modes.
Definition in file signals.c.
Functions | |
| void | interactive_sigint_handler (int sig) |
| SIGINT handler for the interactive prompt. More... | |
| void | setup_interactive_signals (void) |
| Configure signals for the interactive prompt. More... | |
| void | reset_child_signals (void) |
| Reset signals to default behavior for the child processes. More... | |
| void | setup_execution_signals (void) |
| Ignore signals during command execution in the parent. More... | |
Variables | |
| volatile sig_atomic_t | g_signal = 0 |
| The single global variable. More... | |
| void interactive_sigint_handler | ( | int | sig | ) |
SIGINT handler for the interactive prompt.
Prints a newline and resets the readline prompt to a fresh line
| sig | Signal number (SIGINT) |
Definition at line 26 of file signals.c.
References g_signal.
Referenced by setup_interactive_signals().
Here is the caller graph for this function:| void setup_interactive_signals | ( | void | ) |
Configure signals for the interactive prompt.
Definition at line 43 of file signals.c.
References interactive_sigint_handler().
Referenced by handle_heredoc(), and main_loop().
Here is the call graph for this function:
Here is the caller graph for this function:| void reset_child_signals | ( | void | ) |
Reset signals to default behavior for the child processes.
This is called after fork in child processes so that SIGINT and SIGQUIT terminate the child normally
Definition at line 66 of file signals.c.
Referenced by child_execute(), exec_left_pipe_child(), and exec_right_pipe_child().
Here is the caller graph for this function:| void setup_execution_signals | ( | void | ) |
Ignore signals during command execution in the parent.
While a child process is running, the parent ignores both SIGINT and SIGQUIT so only the child is affected
Definition at line 83 of file signals.c.
Referenced by main_loop().
Here is the caller graph for this function:| volatile sig_atomic_t g_signal = 0 |
The single global variable.
Set by signal handlers and checked/cleared in the main loop. Only stores signal numbers.
Definition at line 17 of file signals.c.
Referenced by check_resize(), handle_heredoc(), handle_ui_sigwinch(), heredoc_sigint_handler(), interactive_sigint_handler(), main_loop(), and read_heredoc_lines().