diff options
Diffstat (limited to 'src/Startup.c')
-rw-r--r-- | src/Startup.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/Startup.c b/src/Startup.c index 44f82ef..4dc619c 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -80,6 +80,21 @@ static int DumpParameters (FILE *outfile); CCTK_ParameterFilename IOUtil_AdvertiseFile @@*/ +typedef void (*signal_handler_t) (int sig); +static signal_handler_t old_signal_handler[32]; + +static void new_signal_handler (int sig) +{ + fprintf (stderr, "called new_signal_handler with signal %d calling %p\n", sig, old_signal_handler[sig]); + if (old_signal_handler[sig]) + { + old_signal_handler[sig] (sig); + } + exit (0); +} + +#include <signal.h> + void IOUtil_Startup (void) { char parfile[256]; @@ -87,6 +102,15 @@ void IOUtil_Startup (void) DECLARE_CCTK_PARAMETERS +#if 0 +{ +int i; +for (i = 0; i < 32; i++) +{ + old_signal_handler[i] = signal (i, new_signal_handler); +} +} +#endif CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("IO"), SetupGH); /* advertise the parameter file */ @@ -139,6 +163,43 @@ int IOUtil_UpdateParFile (const cGH *GH) } + /*@@ + @routine IOUtil_TruncateOutputFiles + @date Wed 17 November 2004 + @author Thomas Radke + @desc + Aliased function 'IO_TruncateOutputFiles' which can be called + by I/O methods to check whether to truncate existing output + files or not. + @enddesc + + @var GH + @vdesc pointer to grid hierarchy + @vtype const cGH * + @vio in + @endvar + + @returntype CCTK_INT + @returndesc 1 or 0 for truncate or not + -1 in case of an error (wrong value for GH parameter) + @endreturndesc +@@*/ +CCTK_INT IOUtil_TruncateOutputFiles (const CCTK_POINTER_TO_CONST GH) +{ + const ioGH *myGH; + DECLARE_CCTK_PARAMETERS + + + myGH = CCTK_GHExtension (GH, "IO"); + if (! myGH) + { + return (-1); + } + + return (! myGH->recovered || truncate_files_after_recovering); +} + + /******************************************************************** *********************** Local Functions *********************** ********************************************************************/ |