Annotation of embedaddon/hping2/signal.c, revision 1.1

1.1     ! misho       1: /* protable signal() like */
        !             2: 
        !             3: #include <signal.h>
        !             4: 
        !             5: /* Portable signal() from R.Stevens,
        !             6:  * modified to reset the handler */
        !             7: void (*Signal(int signo, void (*func)(int)))(int)
        !             8: {
        !             9:        struct sigaction act, oact;
        !            10: 
        !            11:        act.sa_handler = func;
        !            12:        sigemptyset(&act.sa_mask);
        !            13:        act.sa_flags = 0; /* So if set SA_RESETHAND is cleared */
        !            14:        if (signo == SIGALRM)
        !            15:        {
        !            16: #ifdef SA_INTERRUPT
        !            17:                act.sa_flags |= SA_INTERRUPT;   /* SunOS 4.x */
        !            18: #endif
        !            19:        }
        !            20:        else
        !            21:        {
        !            22: #ifdef SA_RESTART
        !            23:                act.sa_flags |= SA_RESTART;     /* SVR4, 4.4BSD, Linux */
        !            24: #endif
        !            25:        }
        !            26:        if (sigaction(signo, &act, &oact) == -1)
        !            27:                return SIG_ERR;
        !            28:        return (oact.sa_handler);
        !            29: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>