How to handle single in C, RegisterSigSegvHandler


/******************************************************************************
 * Function Name : RegisterSigSegvHandler
 * Parameters    : NULL
 * Description   : Registers the signal (SIGSEGV).
 * Return Value  : NULL
******************************************************************************/

void RegisterSigSegvHandler()
{
        struct sigaction action;

        // empty the signal masking set
        sigemptyset (&action.sa_mask);
        action.sa_flags = 0;

        action.sa_handler = signalhandler; //signalhandler is user define function

        // register for SIGSEGV
        if ((sigaction(SIGSEGV, &action, NULL) == -1)) {
                        TWARN ("main - Registration of Signal SIGSEGV FAILED.");
        }
}



--

Comments

Popular Posts