*BSD News Article 24662


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!sunic!psinntp!psinntp!relay1!rsvl_ns!unirsvl!sybesma
From: sybesma@unirsvl.rsvl.unisys.com (Eric Sybesma)
Subject: Memory fault in a unix signal handler (SIGIO)
Summary: Memory fault in Unix signal handler (SIGIO)
Message-ID: <CHF2E7.FHB@unirsvl.rsvl.unisys.com>
Date: Thu, 2 Dec 1993 16:42:07 GMT
Organization: Unisys
Keywords: SIGIO signal memory fault
Lines: 40

I have a problem with a signal handler.  This is  a c and Unix
question.  (let me know what group would be better to post this in).

I have signal set up as follows for SIGIO:
int sigsocket = SIGIO;

    if (signal(sigsocket,handle_socket_signal) == (void (*)()) -1) {
        status = 1;
    } /* signal failed */


and the signal handler is

void handle_socket_signal(signum)
    int signum;
{ /* handle_socket_signal */
    register int status = 0;
    if (signal(signum,handle_socket_signal) == (void(*)()) -1) {
        log_system_error();
    } /* signal failed */
    have_socket_traffic = 1;
    printf("return from signal handler \n"); /* this statement IS executed */
    return;

} /* handle_socket_signal */

/*  When the signal handler returns, the program gets a segmentation violation
    and the core file lists the bomb out at this line

0x804fa74       (sigvechandler+164:)       andl   $0xfffffffe,0x20(%edi)

(Intel X86)

    Evidently, I am stomping on something, but why would a signal handler do
this..  NOTE:  IF I use another signal (say SIGURG), I don't have the same
problem.

Eric Sybesma