-/* The SIGSTOP/SIGTSTP handler
- * NB: inside it, all signals except SIGCONT are masked
- * via appropriate setup in sigaction().
- */
-static void stop_handler(int sig UNUSED_PARAM)
-{
- smallint saved_bb_got_signal;
- int saved_errno;
-
- saved_bb_got_signal = bb_got_signal;
- saved_errno = errno;
- signal(SIGCONT, record_signo);
-
- while (1) {
- pid_t wpid;
-
- if (bb_got_signal == SIGCONT)
- break;
- /* NB: this can accidentally wait() for a process
- * which we waitfor() elsewhere! waitfor() must have
- * code which is resilient against this.
- */
- wpid = wait_any_nohang(NULL);
- mark_terminated(wpid);
- sleep(1);
- }
-
- signal(SIGCONT, SIG_DFL);
- errno = saved_errno;
- bb_got_signal = saved_bb_got_signal;
-}
-