\hypertarget{checkpoint_8c}{}\doxysection{checkpoint.\+c File Reference}
\label{checkpoint_8c}\index{checkpoint.c@{checkpoint.c}}
{\ttfamily \#include \char`\"{}form3.\+h\char`\"{}}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{checkpoint_8c_a59e324fa8e9090cc97f7098b05b16c23}\label{checkpoint_8c_a59e324fa8e9090cc97f7098b05b16c23}} 
\#define {\bfseries C\+A\+C\+H\+E\+D\+\_\+\+S\+N\+A\+P\+S\+H\+OT}
\item 
\mbox{\Hypertarget{checkpoint_8c_a8a6befd630ea1c2ab260266f7466540c}\label{checkpoint_8c_a8a6befd630ea1c2ab260266f7466540c}} 
\#define {\bfseries C\+A\+C\+H\+E\+\_\+\+S\+I\+ZE}~4096
\item 
\mbox{\Hypertarget{checkpoint_8c_a5439c54cd4d43dd7ad07885887811260}\label{checkpoint_8c_a5439c54cd4d43dd7ad07885887811260}} 
\#define {\bfseries R\+\_\+\+F\+R\+EE}(A\+RG)~if ( A\+RG ) M\+\_\+free(A\+RG, \#A\+RG);
\item 
\#define {\bfseries R\+\_\+\+F\+R\+E\+E\+\_\+\+N\+A\+M\+E\+T\+R\+EE}(A\+RG)
\item 
\#define {\bfseries R\+\_\+\+F\+R\+E\+E\+\_\+\+S\+T\+R\+E\+AM}(A\+RG)
\item 
\mbox{\Hypertarget{checkpoint_8c_abd1a091f3a7bd9b0a55f5c13728b8236}\label{checkpoint_8c_abd1a091f3a7bd9b0a55f5c13728b8236}} 
\#define {\bfseries R\+\_\+\+S\+ET}(V\+AR,  T\+Y\+PE)~V\+AR = $\ast$((T\+Y\+PE$\ast$)p); p = (unsigned char$\ast$)p + sizeof(T\+Y\+PE);
\item 
\#define {\bfseries R\+\_\+\+C\+O\+P\+Y\+\_\+B}(V\+AR,  S\+I\+ZE,  C\+A\+ST)
\item 
\mbox{\Hypertarget{checkpoint_8c_a048d47b002b544430e73096d7438759b}\label{checkpoint_8c_a048d47b002b544430e73096d7438759b}} 
\#define {\bfseries S\+\_\+\+W\+R\+I\+T\+E\+\_\+B}(B\+UF,  L\+EN)~if ( fwrite\+\_\+cached(B\+UF, 1, L\+EN, fd) != (size\+\_\+t)(L\+EN) ) return(\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+);
\item 
\mbox{\Hypertarget{checkpoint_8c_ac9fa41e9d83a853b62f46a3ce1afba16}\label{checkpoint_8c_ac9fa41e9d83a853b62f46a3ce1afba16}} 
\#define {\bfseries S\+\_\+\+F\+L\+U\+S\+H\+\_\+B}~if ( flush\+\_\+cache(fd) != 1 ) return(\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+);
\item 
\#define {\bfseries R\+\_\+\+C\+O\+P\+Y\+\_\+S}(V\+AR,  C\+A\+ST)
\item 
\#define {\bfseries S\+\_\+\+W\+R\+I\+T\+E\+\_\+S}(S\+TR)
\item 
\#define {\bfseries R\+\_\+\+C\+O\+P\+Y\+\_\+\+L\+I\+ST}(A\+RG)
\item 
\#define {\bfseries S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+L\+I\+ST}(L\+ST)
\item 
\#define {\bfseries R\+\_\+\+C\+O\+P\+Y\+\_\+\+N\+A\+M\+E\+T\+R\+EE}(A\+RG)
\item 
\#define {\bfseries S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+N\+A\+M\+E\+T\+R\+EE}(A\+RG)
\item 
\#define {\bfseries S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+D\+O\+L\+L\+AR}(A\+RG)
\item 
\mbox{\Hypertarget{checkpoint_8c_aea91ff04a10bf50ed7fc5e0e2ba8f42d}\label{checkpoint_8c_aea91ff04a10bf50ed7fc5e0e2ba8f42d}} 
\#define {\bfseries A\+N\+N\+O\+U\+N\+CE}(str)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{checkpoint_8c_a3f2b0b6f1b4c1500869a79bf891e3ee8}{Check\+Recovery\+File}} ()
\item 
void \mbox{\hyperlink{checkpoint_8c_a91b2f05c1f186bee0ad4399d2a033e08}{Delete\+Recovery\+File}} ()
\item 
char $\ast$ \mbox{\hyperlink{checkpoint_8c_af920822abeccc7e5973c07756c324c2f}{Recovery\+Filename}} ()
\item 
void \mbox{\hyperlink{checkpoint_8c_a25f1f729f8d8c3cfb7b90a591cfa72ee}{Init\+Recovery}} ()
\item 
\mbox{\Hypertarget{checkpoint_8c_a8c367e7a3c9c3630ec5df77d969775de}\label{checkpoint_8c_a8c367e7a3c9c3630ec5df77d969775de}} 
size\+\_\+t {\bfseries fwrite\+\_\+cached} (const void $\ast$ptr, size\+\_\+t size, size\+\_\+t nmemb, F\+I\+LE $\ast$fd)
\item 
\mbox{\Hypertarget{checkpoint_8c_a4c17fdd7403ca33182c23ad308fc92b4}\label{checkpoint_8c_a4c17fdd7403ca33182c23ad308fc92b4}} 
size\+\_\+t {\bfseries flush\+\_\+cache} (F\+I\+LE $\ast$fd)
\item 
int \mbox{\hyperlink{checkpoint_8c_a9213bd2589bf698d8ee098f10bf12d65}{Do\+Recovery}} (int $\ast$moduletype)
\item 
void \mbox{\hyperlink{checkpoint_8c_a60d3513a65e83e59f4aa48421f7356e6}{Do\+Checkpoint}} (int moduletype)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{checkpoint_8c_a71a669dc7a8d59ea0863f47f459d3e53}\label{checkpoint_8c_a71a669dc7a8d59ea0863f47f459d3e53}} 
unsigned char {\bfseries cache\+\_\+buffer} \mbox{[}C\+A\+C\+H\+E\+\_\+\+S\+I\+ZE\mbox{]}
\item 
\mbox{\Hypertarget{checkpoint_8c_aaf4151d1fd5c7ef3594ac1e995de4480}\label{checkpoint_8c_aaf4151d1fd5c7ef3594ac1e995de4480}} 
size\+\_\+t {\bfseries cache\+\_\+fill} = 0
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Contains all functions that deal with the recovery mechanism controlled and activated by the On Checkpoint switch.

The main function are Do\+Checkpoint, Do\+Recovery, and Do\+Snapshot. If the checkpoints are activated Do\+Checkpoint is called every time a module is finished executing. If the conditions for the creation of a recovery snapshot are met Do\+Checkpoint calls Do\+Snapshot. Do\+Recovery is called once when F\+O\+RM starts up with the command line argument -\/R. Most of the other code contains debugging facilities that are only compiled if the macro P\+R\+I\+N\+T\+D\+E\+B\+UG is defined.

The recovery mechanism is atomic, i.\+e. only if everything went well, the final recovery file is created (and the older one overwritten) in a single step (copying). If some errors occur, a warning is issued and the program continues without having created a new recovery file. The only situation in which the creation of the recovery data leads to a termination of the running program is if not enough disk or memory space is left.

For Par\+F\+O\+RM each slave creates its own recovery file, sends it to the master and then it deletes the recovery file. The master stores all the recovery files and on recovery it feeds these files to the slaves. It is nearly impossible to recover after some M\+PI fault so Par\+F\+O\+RM terminates on any recovery failure.

Do\+Recovery and Do\+Snapshot do the loading and saving of the recovery data, respectively. Every change in one functions needs to be accompanied by the appropriate change in the other function. The structure of both functions is quite similar. They handle the relevant global structs one after the other and then care about the copying of the hide and scratch files.

The names of the recovery, scratch and hide files are hard-\/coded in the variables in fold \char`\"{}filenames and system commands\char`\"{}.

If the global structs AM,AP,AC,AR are changed, Do\+Recovery and Do\+Snapshot usually also have to be changed. Some structs are read/written as a whole (AP,AC), some are read/written only partly as a selection of their individual elements (AM,AR). If AM or AR have been changed by adding or removing an element that is important for the runtime status, then the reading/writing statements have to be added to or removed from Do\+Recovery and Do\+Snapshot. If AP or AC are changed, then for non-\/pointer variables (in the case of a struct it also means that none of its elements is a pointer) nothing has to be changed in the functions here. If pointers are involved, extra code has to be added (or removed). See the comments of Do\+Recovery and Do\+Snapshot. 

\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{checkpoint_8c_a0a709458f6856f7af5ef422d76304aa8}\label{checkpoint_8c_a0a709458f6856f7af5ef422d76304aa8}} 
\index{checkpoint.c@{checkpoint.c}!R\_FREE\_NAMETREE@{R\_FREE\_NAMETREE}}
\index{R\_FREE\_NAMETREE@{R\_FREE\_NAMETREE}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_FREE\_NAMETREE}{R\_FREE\_NAMETREE}}
{\footnotesize\ttfamily \#define R\+\_\+\+F\+R\+E\+E\+\_\+\+N\+A\+M\+E\+T\+R\+EE(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{R\_FREE(ARG-\/>namenode); \(\backslash\)}
\DoxyCodeLine{    R\_FREE(ARG-\/>namebuffer); \(\backslash\)}
\DoxyCodeLine{    R\_FREE(ARG);}

\end{DoxyCode}


Definition at line 1281 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_abab3e4236015c7bb93ae99d5e4b7e9ae}\label{checkpoint_8c_abab3e4236015c7bb93ae99d5e4b7e9ae}} 
\index{checkpoint.c@{checkpoint.c}!R\_FREE\_STREAM@{R\_FREE\_STREAM}}
\index{R\_FREE\_STREAM@{R\_FREE\_STREAM}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_FREE\_STREAM}{R\_FREE\_STREAM}}
{\footnotesize\ttfamily \#define R\+\_\+\+F\+R\+E\+E\+\_\+\+S\+T\+R\+E\+AM(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{R\_FREE(ARG.buffer); \(\backslash\)}
\DoxyCodeLine{    R\_FREE(ARG.FoldName); \(\backslash\)}
\DoxyCodeLine{    R\_FREE(ARG.name);}

\end{DoxyCode}


Definition at line 1286 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a125cb83a56272d67140eaaf488a6b1de}\label{checkpoint_8c_a125cb83a56272d67140eaaf488a6b1de}} 
\index{checkpoint.c@{checkpoint.c}!R\_COPY\_B@{R\_COPY\_B}}
\index{R\_COPY\_B@{R\_COPY\_B}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_COPY\_B}{R\_COPY\_B}}
{\footnotesize\ttfamily \#define R\+\_\+\+C\+O\+P\+Y\+\_\+B(\begin{DoxyParamCaption}\item[{}]{V\+AR,  }\item[{}]{S\+I\+ZE,  }\item[{}]{C\+A\+ST }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{VAR = (CAST)Malloc1(SIZE,\#VAR); \(\backslash\)}
\DoxyCodeLine{    memcpy(VAR, p, SIZE); p = (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}*)p + SIZE;}

\end{DoxyCode}


Definition at line 1298 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a7ea833cf244d1c1fefdb878949c5ae5b}\label{checkpoint_8c_a7ea833cf244d1c1fefdb878949c5ae5b}} 
\index{checkpoint.c@{checkpoint.c}!R\_COPY\_S@{R\_COPY\_S}}
\index{R\_COPY\_S@{R\_COPY\_S}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_COPY\_S}{R\_COPY\_S}}
{\footnotesize\ttfamily \#define R\+\_\+\+C\+O\+P\+Y\+\_\+S(\begin{DoxyParamCaption}\item[{}]{V\+AR,  }\item[{}]{C\+A\+ST }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} ( VAR ) \{ \(\backslash\)}
\DoxyCodeLine{        VAR = (CAST)Malloc1(strlen(p)+1,\textcolor{stringliteral}{"R\_COPY\_S"}); \(\backslash\)}
\DoxyCodeLine{        strcpy((\textcolor{keywordtype}{char}*)VAR, p); p = (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}*)p + strlen(p) + 1; \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1310 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_aa194cbb0b10d0ff081badacbc637d7e2}\label{checkpoint_8c_aa194cbb0b10d0ff081badacbc637d7e2}} 
\index{checkpoint.c@{checkpoint.c}!S\_WRITE\_S@{S\_WRITE\_S}}
\index{S\_WRITE\_S@{S\_WRITE\_S}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{S\_WRITE\_S}{S\_WRITE\_S}}
{\footnotesize\ttfamily \#define S\+\_\+\+W\+R\+I\+T\+E\+\_\+S(\begin{DoxyParamCaption}\item[{}]{S\+TR }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} ( STR ) \{ \(\backslash\)}
\DoxyCodeLine{        l = strlen((\textcolor{keywordtype}{char}*)STR) + 1; \(\backslash\)}
\DoxyCodeLine{        if ( fwrite\_cached(STR, 1, l, fd) != (\textcolor{keywordtype}{size\_t})l ) \textcolor{keywordflow}{return}(\_\_LINE\_\_); \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1316 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a640a5982578c2c61c3bd97b206bd476a}\label{checkpoint_8c_a640a5982578c2c61c3bd97b206bd476a}} 
\index{checkpoint.c@{checkpoint.c}!R\_COPY\_LIST@{R\_COPY\_LIST}}
\index{R\_COPY\_LIST@{R\_COPY\_LIST}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_COPY\_LIST}{R\_COPY\_LIST}}
{\footnotesize\ttfamily \#define R\+\_\+\+C\+O\+P\+Y\+\_\+\+L\+I\+ST(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} ( ARG.maxnum ) \{ \(\backslash\)}
\DoxyCodeLine{        R\_COPY\_B(ARG.lijst, ARG.size*ARG.maxnum, \textcolor{keywordtype}{void}*) \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1324 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a93a3e305b899d2db3c1be75c840c7d0d}\label{checkpoint_8c_a93a3e305b899d2db3c1be75c840c7d0d}} 
\index{checkpoint.c@{checkpoint.c}!S\_WRITE\_LIST@{S\_WRITE\_LIST}}
\index{S\_WRITE\_LIST@{S\_WRITE\_LIST}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{S\_WRITE\_LIST}{S\_WRITE\_LIST}}
{\footnotesize\ttfamily \#define S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+L\+I\+ST(\begin{DoxyParamCaption}\item[{}]{L\+ST }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} ( LST.maxnum ) \{ \(\backslash\)}
\DoxyCodeLine{        S\_WRITE\_B((\textcolor{keywordtype}{char}*)LST.lijst, LST.maxnum*LST.size) \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1329 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a994234e3b7777517566c0ea4335417d3}\label{checkpoint_8c_a994234e3b7777517566c0ea4335417d3}} 
\index{checkpoint.c@{checkpoint.c}!R\_COPY\_NAMETREE@{R\_COPY\_NAMETREE}}
\index{R\_COPY\_NAMETREE@{R\_COPY\_NAMETREE}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{R\_COPY\_NAMETREE}{R\_COPY\_NAMETREE}}
{\footnotesize\ttfamily \#define R\+\_\+\+C\+O\+P\+Y\+\_\+\+N\+A\+M\+E\+T\+R\+EE(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{R\_COPY\_B(ARG, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structNaMeTree}{NAMETREE}}), \mbox{\hyperlink{structNaMeTree}{NAMETREE}}*); \(\backslash\)}
\DoxyCodeLine{    if ( ARG-\/>namenode ) \{ \(\backslash\)}
\DoxyCodeLine{        R\_COPY\_B(ARG-\/>namenode, ARG-\/>nodesize*\textcolor{keyword}{sizeof}(\mbox{\hyperlink{structNaMeNode}{NAMENODE}}), \mbox{\hyperlink{structNaMeNode}{NAMENODE}}*); \(\backslash\)}
\DoxyCodeLine{    \} \(\backslash\)}
\DoxyCodeLine{    if ( ARG-\/>namebuffer ) \{ \(\backslash\)}
\DoxyCodeLine{        R\_COPY\_B(ARG-\/>namebuffer, ARG-\/>namesize, UBYTE*); \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1336 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a31526179ed05e2fed04ca7496b840e5b}\label{checkpoint_8c_a31526179ed05e2fed04ca7496b840e5b}} 
\index{checkpoint.c@{checkpoint.c}!S\_WRITE\_NAMETREE@{S\_WRITE\_NAMETREE}}
\index{S\_WRITE\_NAMETREE@{S\_WRITE\_NAMETREE}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{S\_WRITE\_NAMETREE}{S\_WRITE\_NAMETREE}}
{\footnotesize\ttfamily \#define S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+N\+A\+M\+E\+T\+R\+EE(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{S\_WRITE\_B(ARG, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structNaMeTree}{NAMETREE}})); \(\backslash\)}
\DoxyCodeLine{    if ( ARG-\/>namenode ) \{ \(\backslash\)}
\DoxyCodeLine{        S\_WRITE\_B(ARG-\/>namenode, ARG-\/>nodesize*\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structNaMeNode}{NaMeNode}})); \(\backslash\)}
\DoxyCodeLine{    \} \(\backslash\)}
\DoxyCodeLine{    if ( ARG-\/>namebuffer ) \{ \(\backslash\)}
\DoxyCodeLine{        S\_WRITE\_B(ARG-\/>namebuffer, ARG-\/>namesize); \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1345 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_abd2a76c8a193eef25c9760e59cc6ee66}\label{checkpoint_8c_abd2a76c8a193eef25c9760e59cc6ee66}} 
\index{checkpoint.c@{checkpoint.c}!S\_WRITE\_DOLLAR@{S\_WRITE\_DOLLAR}}
\index{S\_WRITE\_DOLLAR@{S\_WRITE\_DOLLAR}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{S\_WRITE\_DOLLAR}{S\_WRITE\_DOLLAR}}
{\footnotesize\ttfamily \#define S\+\_\+\+W\+R\+I\+T\+E\+\_\+\+D\+O\+L\+L\+AR(\begin{DoxyParamCaption}\item[{}]{A\+RG }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} ( ARG.size \&\& ARG.where \&\& ARG.where != \&(AM.dollarzero) ) \{ \(\backslash\)}
\DoxyCodeLine{        S\_WRITE\_B(ARG.where, ARG.size*\textcolor{keyword}{sizeof}(WORD)) \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 1356 of file checkpoint.\+c.



\doxysubsection{Function Documentation}
\mbox{\Hypertarget{checkpoint_8c_a3f2b0b6f1b4c1500869a79bf891e3ee8}\label{checkpoint_8c_a3f2b0b6f1b4c1500869a79bf891e3ee8}} 
\index{checkpoint.c@{checkpoint.c}!CheckRecoveryFile@{CheckRecoveryFile}}
\index{CheckRecoveryFile@{CheckRecoveryFile}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{CheckRecoveryFile()}{CheckRecoveryFile()}}
{\footnotesize\ttfamily int Check\+Recovery\+File (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Checks whether a snapshot/recovery file exists. Returns 1 if it exists, 0 otherwise. 

Definition at line 278 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a91b2f05c1f186bee0ad4399d2a033e08}\label{checkpoint_8c_a91b2f05c1f186bee0ad4399d2a033e08}} 
\index{checkpoint.c@{checkpoint.c}!DeleteRecoveryFile@{DeleteRecoveryFile}}
\index{DeleteRecoveryFile@{DeleteRecoveryFile}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{DeleteRecoveryFile()}{DeleteRecoveryFile()}}
{\footnotesize\ttfamily void Delete\+Recovery\+File (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Deletes the recovery files. It is called by Clean\+Up() in the case of a successful completion. 

Definition at line 333 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_af920822abeccc7e5973c07756c324c2f}\label{checkpoint_8c_af920822abeccc7e5973c07756c324c2f}} 
\index{checkpoint.c@{checkpoint.c}!RecoveryFilename@{RecoveryFilename}}
\index{RecoveryFilename@{RecoveryFilename}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{RecoveryFilename()}{RecoveryFilename()}}
{\footnotesize\ttfamily char$\ast$ Recovery\+Filename (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Returns pointer to recovery filename. 

Definition at line 364 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a25f1f729f8d8c3cfb7b90a591cfa72ee}\label{checkpoint_8c_a25f1f729f8d8c3cfb7b90a591cfa72ee}} 
\index{checkpoint.c@{checkpoint.c}!InitRecovery@{InitRecovery}}
\index{InitRecovery@{InitRecovery}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{InitRecovery()}{InitRecovery()}}
{\footnotesize\ttfamily void Init\+Recovery (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Sets up the strings for the filenames of the recovery files. This functions should only be called once to avoid memory leaks and after A\+M.\+Temp\+Dir has been initialized. 

Definition at line 399 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a9213bd2589bf698d8ee098f10bf12d65}\label{checkpoint_8c_a9213bd2589bf698d8ee098f10bf12d65}} 
\index{checkpoint.c@{checkpoint.c}!DoRecovery@{DoRecovery}}
\index{DoRecovery@{DoRecovery}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{DoRecovery()}{DoRecovery()}}
{\footnotesize\ttfamily int Do\+Recovery (\begin{DoxyParamCaption}\item[{int $\ast$}]{moduletype }\end{DoxyParamCaption})}

Reads from the recovery file and restores all necessary variables and states in F\+O\+RM, so that the execution can recommence in preprocessor() as if no restart of F\+O\+RM had occurred.

The recovery file is read into memory as a whole. The pointer p then points into this memory at the next non-\/processed data. The macros by which variables are restored, like R\+\_\+\+S\+ET, automatically increase p appropriately.

If something goes wrong, the function returns with a non-\/zero value.

Allocated memory that would be lost when overwriting the global structs with data from the file is freed first. A major part of the code deals with the restoration of pointers. The idiom we use is to memorize the original pointer value (org), allocate new memory and copy the data from the file into this memory, calculate the offset between the old pointer value and the new allocated memory position (ofs), and then correct all affected pointers (+=ofs).

We rely on the fact that several variables (especially in AM) are already assigned the correct values by the startup functions. That means, in principle, that a change in the setup files between snapshot creation and recovery will be noticed. 

Definition at line 1399 of file checkpoint.\+c.

\mbox{\Hypertarget{checkpoint_8c_a60d3513a65e83e59f4aa48421f7356e6}\label{checkpoint_8c_a60d3513a65e83e59f4aa48421f7356e6}} 
\index{checkpoint.c@{checkpoint.c}!DoCheckpoint@{DoCheckpoint}}
\index{DoCheckpoint@{DoCheckpoint}!checkpoint.c@{checkpoint.c}}
\doxysubsubsection{\texorpdfstring{DoCheckpoint()}{DoCheckpoint()}}
{\footnotesize\ttfamily void Do\+Checkpoint (\begin{DoxyParamCaption}\item[{int}]{moduletype }\end{DoxyParamCaption})}

Checks whether a snapshot should be done. Calls Do\+Snapshot() to create the snapshot. 

Definition at line 3102 of file checkpoint.\+c.



References Time\+Wall\+Clock().

