Nonlocal Jumps

D-SP-Ch9ba-Nonlocal_Jump

Stack Frames

D-SP-Ch9bb-Stack_Frames

const, volatile, restrict

D-SP-Ch9bc-const_volatile_restrict

Signal Mask

D-SP-Ch9bd-Signal_Mask

fork() & exec()

fork()

Properties of Parent Inherited by Child

  • signal mask, disposition

Properties of Parent Changed by Child

  • pending signals are set to empty for child
  • alarm are cleared

exec()

Properties of Parent Inherited by Child

  • signal mask, pending signals, time left until alarm clock

Properties of Parent Changed by Child

  • disposition of caught signals is set to default action

sigaction

sigaction

D-SP-Ch9be-sigaction

Reliable signal Implementation using sigaction

/* Reliable version of signal(), using POSIX sigaction(). */
Sigfunc *
signal(int signo, Sigfunc *func)
{
    struct sigaction act, oact;
 
    act.sa_handler = func;
    sigemptyset(&act.sa_mask);
    act.sa_flags = 0;
 
    if (signo == SIGALRM) {
#ifdef SA_INTERRUPT
        act.sa_flags |= SA_INTERRUPT;
#endif
    } else {
#ifdef SA_RESTART
        act.sa_flags |= SA_RESTART;
#endif
    }
 
    if (sigaction(signo, &act, &oact) < 0)
        return(SIG_ERR);
 
    return(oact.sa_handler);
}

sigsuspend

D-SP-Ch9bf-sigsuspend