MCPcopy Create free account
hub / github.com/coreutils/coreutils / process_signals

Function process_signals

src/ls.c:1543–1581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541 immediately change colors after invoking this function. */
1542
1543static void
1544process_signals (void)
1545{
1546 while (interrupt_signal || stop_signal_count)
1547 {
1548 int sig;
1549 int stops;
1550 sigset_t oldset;
1551
1552 if (used_color)
1553 restore_default_color ();
1554 fflush (stdout);
1555
1556 sigprocmask (SIG_BLOCK, &caught_signals, &oldset);
1557
1558 /* Reload interrupt_signal and stop_signal_count, in case a new
1559 signal was handled before sigprocmask took effect. */
1560 sig = interrupt_signal;
1561 stops = stop_signal_count;
1562
1563 /* SIGTSTP is special, since the application can receive that signal
1564 more than once. In this case, don't set the signal handler to the
1565 default. Instead, just raise the uncatchable SIGSTOP. */
1566 if (stops)
1567 {
1568 stop_signal_count = stops - 1;
1569 sig = SIGSTOP;
1570 }
1571 else
1572 signal (sig, SIG_DFL);
1573
1574 /* Exit or suspend the program. */
1575 raise (sig);
1576 sigprocmask (SIG_SETMASK, &oldset, NULL);
1577
1578 /* If execution reaches here, then the program has been
1579 continued (after being suspended). */
1580 }
1581}
1582
1583/* Setup signal handlers if INIT is true,
1584 otherwise restore to the default. */

Callers 2

print_dirFunction · 0.70
print_name_with_quotingFunction · 0.70

Calls 1

restore_default_colorFunction · 0.85

Tested by

no test coverage detected