| 19 |
|
|
| 20 |
/* #define FC_NAMEMANGLE(X) X ## _ */ |
/* #define FC_NAMEMANGLE(X) X ## _ */ |
| 21 |
|
|
| 22 |
|
#ifdef HAVE_SIGREG |
| 23 |
#include <stdlib.h> |
#include <stdlib.h> |
| 24 |
#include <stdio.h> |
#include <stdio.h> |
| 25 |
#include <signal.h> |
#include <signal.h> |
| 26 |
#include <errno.h> |
#include <errno.h> |
| 27 |
#include <ucontext.h> |
#include <ucontext.h> |
| 28 |
|
#endif |
| 29 |
|
|
| 30 |
int * ip; |
int * ip; |
| 31 |
|
|
| 32 |
|
#ifdef HAVE_SIGREG |
| 33 |
static void killhandler( |
static void killhandler( |
| 34 |
unsigned int sn, siginfo_t si, struct ucontext *sc ) |
unsigned int sn, siginfo_t si, struct ucontext *sc ) |
| 35 |
{ |
{ |
| 36 |
*ip = *ip + 1; |
*ip = *ip + 1; |
| 37 |
return; |
return; |
| 38 |
} |
} |
| 39 |
|
#endif |
| 40 |
|
|
| 41 |
/* int main( int argc, char ** argv ) */ |
/* int main( int argc, char ** argv ) */ |
| 42 |
void FC_NAMEMANGLE(sigreg) (int * aip) |
void FC_NAMEMANGLE(sigreg) (int * aip) |
| 43 |
{ |
{ |
|
struct sigaction s; |
|
| 44 |
ip = aip; |
ip = aip; |
| 45 |
|
#ifdef HAVE_SIGREG |
| 46 |
|
struct sigaction s; |
| 47 |
s.sa_flags = SA_SIGINFO; |
s.sa_flags = SA_SIGINFO; |
| 48 |
s.sa_sigaction = (void *)killhandler; |
s.sa_sigaction = (void *)killhandler; |
| 49 |
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) { |
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) { |
| 50 |
printf("Sigaction returned error = %d\n", errno); |
printf("Sigaction returned error = %d\n", errno); |
| 51 |
exit(0); |
exit(0); |
| 52 |
} |
} |
| 53 |
|
#endif |
| 54 |
return; |
return; |
| 55 |
} |
} |
| 56 |
|
|