Using signal() in SA_OLDSTYLE and Full-Size Core Files


Contents

About this document
Procedure

About this document

This document addresses using signal() in SA_OLDSTYLE and full-size core files. This document applies to AIX Version 3.2.

Procedure

Add the following to your code in some configuration .h file. This will allow you to use signal() in the SA_OLDSTYLE of handling, but also produce full-size core files.

#include <stdio.h> 
#include <sys/types.h> 
#include <sys/signal.h> 
#define signal  SIGNAL 
void (*SIGNAL(int signo, void (*fcn)(int))) 
{ 
        struct  sigaction       act, oact; 
        act.sa_handler = fcn; 
        sigemptyset(&(act.sa_mask)); 
        act.sa_flags = SA_FULLDUMP | SA_OLDSTYLE; 
        if (sigaction(signo, &act, &oact)) 
                return(SIG_ERR); 
        else 
                return(oact.sa_handler); 
} 
/*********************************************************************/ 
main() 
{ 
        int     sigcatch(); 
        signal(SIGQUIT, sigcatch); 
        for (;;) sleep(1);              /* sleep forever */ 
                        /* send two SIGQUIT's to the process and 
                        ** the second one will produce the core file 
                        */ 
} 
int sigcatch() 
{ 
        printf("Caught the signal"); 
} 



[ Doc Ref: 90605222314630     Publish Date: Mar. 13, 2000     4FAX Ref: 8258 ]