Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120800027
sigreg.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 7, 04:33
Size
1015 B
Mime Type
text/x-c
Expires
Wed, Jul 9, 04:33 (2 d)
Engine
blob
Format
Raw Data
Handle
27227203
Attached To
R2795 mitgcm_lac_leman_abirani
sigreg.c
View Options
/*
* $Header: /u/gcmpack/MITgcm/eesupp/src/sigreg.c,v 1.7 2011/08/10 22:33:32 jahn Exp $
* $Name: $
//BOP
// !ROUTINE: sigreg
// !INTERFACE:
sigreg()
// !DESCRIPTION:
// Register a signal handler
//EOP
*/
#ifdef HAVE_SIGREG
/* Here, we get the definition of the FC_NAMEMANGLE() macro. */
#include "FC_NAMEMANGLE.h"
/* #define FC_NAMEMANGLE(X) X ## _ */
#ifdef HAVE_SIGREG
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <ucontext.h>
int * sigreg_ip;
static void killhandler(
unsigned int sn, siginfo_t si, struct ucontext *sc )
{
*sigreg_ip = *sigreg_ip + 1;
return;
}
#endif
/* int main( int argc, char ** argv ) */
void FC_NAMEMANGLE(sigreg) (int * aip)
{
#ifdef HAVE_SIGREG
struct sigaction s;
sigreg_ip = aip;
s.sa_flags = SA_SIGINFO;
s.sa_sigaction = (void *)killhandler;
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) {
printf("Sigaction returned error = %d\n", errno);
exit(0);
}
#endif
return;
}
#endif
Event Timeline
Log In to Comment