/[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.5 - (hide annotations) (download)
Tue Jun 20 03:13:54 2006 UTC (18 years, 3 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint58l_post, mitgcm_mapl_00, checkpoint58u_post, checkpoint58w_post, checkpoint58r_post, checkpoint58n_post, checkpoint58x_post, checkpoint58t_post, checkpoint58q_post, checkpoint59e, checkpoint59d, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59, checkpoint58o_post, checkpoint58y_post, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint58p_post, checkpoint58m_post
Changes since 1.4: +1 -3 lines
File MIME type: text/plain
hopefully fix sigreg problems for Martin

1 edhill 1.1 /*
2 edhill 1.5 * $Header: /u/gcmpack/MITgcm/eesupp/src/sigreg.c,v 1.4 2006/05/23 14:55:19 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    
17     /* 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    
55    

  ViewVC Help
Powered by ViewVC 1.1.22