/[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.7 - (hide annotations) (download)
Wed Aug 10 22:33:32 2011 UTC (13 years, 1 month ago) by jahn
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.6: +4 -4 lines
File MIME type: text/plain
make name of global variable a little more unique

1 edhill 1.1 /*
2 jahn 1.7 * $Header: /u/gcmpack/MITgcm/eesupp/src/sigreg.c,v 1.6 2007/07/31 22:48:34 ce107 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 jahn 1.7 int * sigreg_ip;
30 edhill 1.1
31     static void killhandler(
32     unsigned int sn, siginfo_t si, struct ucontext *sc )
33     {
34 jahn 1.7 *sigreg_ip = *sigreg_ip + 1;
35 edhill 1.1 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 jahn 1.7 sigreg_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