/[MITgcm]/MITgcm/eesupp/src/sigreg.c
ViewVC logotype

Annotation of /MITgcm/eesupp/src/sigreg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (hide annotations) (download)
Tue Jul 31 22:48:34 2007 UTC (17 years, 2 months ago) by ce107
Branch: MAIN
CVS Tags: checkpoint63a, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59g, checkpoint59f, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.5: +3 -3 lines
File MIME type: text/plain
Add check for SIGREG

1 edhill 1.1 /*
2 ce107 1.6 * $Header: /u/gcmpack/MITgcm/eesupp/src/sigreg.c,v 1.5 2006/06/20 03:13:54 edhill Exp $
3 edhill 1.1 * $Name: $
4    
5     //BOP
6     // !ROUTINE: sigreg
7     // !INTERFACE:
8     sigreg()
9    
10     // !DESCRIPTION:
11     // Register a signal handler
12    
13     //EOP
14    
15     */
16 ce107 1.6 #ifdef HAVE_SIGREG
17 edhill 1.1 /* Here, we get the definition of the FC_NAMEMANGLE() macro. */
18     #include "FC_NAMEMANGLE.h"
19    
20     /* #define FC_NAMEMANGLE(X) X ## _ */
21    
22 edhill 1.3 #ifdef HAVE_SIGREG
23 edhill 1.1 #include <stdlib.h>
24     #include <stdio.h>
25     #include <signal.h>
26     #include <errno.h>
27     #include <ucontext.h>
28    
29     int * ip;
30    
31     static void killhandler(
32     unsigned int sn, siginfo_t si, struct ucontext *sc )
33     {
34     *ip = *ip + 1;
35     return;
36     }
37 edhill 1.3 #endif
38 edhill 1.1
39     /* int main( int argc, char ** argv ) */
40     void FC_NAMEMANGLE(sigreg) (int * aip)
41     {
42 edhill 1.3 #ifdef HAVE_SIGREG
43 edhill 1.2 struct sigaction s;
44 edhill 1.4 ip = aip;
45 edhill 1.1 s.sa_flags = SA_SIGINFO;
46     s.sa_sigaction = (void *)killhandler;
47     if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) {
48     printf("Sigaction returned error = %d\n", errno);
49     exit(0);
50     }
51 edhill 1.3 #endif
52 edhill 1.1 return;
53     }
54 ce107 1.6 #endif
55 edhill 1.1

  ViewVC Help
Powered by ViewVC 1.1.22