Subject: [clisp-list] segfault with sigaction-old SIGCHLD

From: Pascal Bourguignon <[email-masked]>
Date: Tue Dec 24 01:25:03 2002

How comes I get a seg fault for (linux:sigaction-old linux:SIGCHLD nil)
while (linux:sigaction-old linux:SIGINT nil) is ok?

[3]> (lisp-implementation-version)
"2.30 (released 2002-09-15) (built 3247263145) (memory 3247263385)"
[13]> (linux:sigaction-old linux:SIGINT nil)
0 ;
#S(LINUX:sigaction :|sa_handler| #<FOREIGN-FUNCTION #x0807F270>
   :|sa_mask| #S(LINUX:sigset_t :|val| #(2)) :|sa_flags| 335544320
   :|sa_restorer| #<FOREIGN-FUNCTION #x405BC7F8>)
[14]> (linux:sigaction-old linux:SIGCHLD nil)
Segmentation fault

(With a normal C process, both work correctly).
------------------------------------------------------------------------
#include <signal.h>
#include <stdio.h>

    void print_sa(const char* name,int res,const struct sigaction* act)
    {
        printf("%4s sigaction returned %d\n",name,res);
        printf("%4s->sa_handler   = %08x\n",name,act->sa_handler);
        printf("%4s->sa_sigaction = %08x\n",name,act->sa_sigaction);
        printf("%4s->sa_mask      = %08x\n",name,act->sa_mask);
        printf("%4s->sa_flags     = %08x\n",name,act->sa_flags);
        printf("%4s->sa_restorer  = %08x\n",name,act->sa_restorer);
    }/*print_sa*/

int main(void)
{
    int res;
    struct sigaction oldact;
    res=sigaction(SIGINT,0,&oldact);
    print_sa("INT",res,&oldact);
    res=sigaction(SIGCHLD,0,&oldact);
    print_sa("CHLD",res,&oldact);
    return(0);
}/*main*/
------------------------------------------------------------------------
[pascal@thalassa clisp]$ ./sigaction 
 INT sigaction returned 0
 INT->sa_handler   = 00000000
 INT->sa_sigaction = 00000000
 INT->sa_mask      = 00000000
 INT->sa_flags     = 00000000
 INT->sa_restorer  = 400e87f8
CHLD sigaction returned 0
CHLD->sa_handler   = 00000000
CHLD->sa_sigaction = 00000000
CHLD->sa_mask      = 00000000
CHLD->sa_flags     = 00000000
CHLD->sa_restorer  = 400e87f8
------------------------------------------------------------------------

-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. do not adjust your minds. -- Salman Rushdie