<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Thanks for your replies Pavel.</div><div class="gmail_default" style="font-family:verdana,sans-serif">Please see inline!</div><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">My 1st try on restore:</div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
><br>
> criu_set_log_file("restore.log");<br>
> pid = criu_restore_child();<br>
> if (pid <=0){ what_err_ret_mean(pid);<br>
> exit(-1);<br>
> }<br>
><br>
> if(waitpid(pid, &ret, 0)<0){<br>
> perror("Can't wait for restore");<br>
> kill(pid,SIGKILL);<br>
> exit(-1);<br>
> }<br>
> return chk_exit(ret,SUCC_DUMP_ECODE);<br>
><br>
><br>
> chk_exit was printing the "exit 43" message. It is the function found here:<br>
> <a href="https://github.com/xemul/criu/blob/master/test/libcriu/lib.c" target="_blank">https://github.com/xemul/criu/blob/master/test/libcriu/lib.c</a><br>
<br>
</div></div>Ah, I see :) Then everything seem to be OK. Look, when you call the criu_dump()<br>
with zero pid what gets dumped is the process that does this call in the state<br>
when it has just sent the dump request to service. And this particular state<br>
is written in the images.<br>
<br>
Thus, when you call criu_restore_child() the restored process gets restored in<br>
a state where it "thinks" as if it has just received the response from the "dump"<br>
request.<br>
<br>
Then, in the code above, this situation ends up in ret = SUCC_RSTR_ECODE (which<br>
is 43) and exit(ret) which thus is exit(43). Then the parent wait()-s for the<br>
kid checks it exit code, sees it being the 43 one a prints on the screen.<br>
<br>
And this is what I see in your logs :) So, for now, everything looks to work as<br>
expected. If you think it's not, let's discuss how you expect it to work, we'll<br>
try to help.<br>
<span><br></span></blockquote><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">My second try on restore:</div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>
> Then I changed the restore code simply:<br>
><br>
> criu_set_log_file("restore.log");<br>
> criu_restore();<br>
><br>
><br>
> This produces a similar restore.log, with success messages, but the program does not seem to continue.<br>
<br>
</span>But according to the code you have shown the program continues with returning<br>
from the criu_dump() call, then sets ret to SUCC_RSTR_ECODE == 43, then calls<br>
exit().<br>
<span><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"></div></span></blockquote><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">On my 1st try, the restore function was calling "chk_exit". But this function never calls "exit". Where did the exit occurred?</div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">Also, ehon the second try, I simply call criu_restore(). After the restore, I simply return 0, and then the execution flow goes to the main function, which then simply returns.</div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">But I do not see anything being replayed, e.g.</div><span style="font-family:verdana,sans-serif"> output of the initial execution<div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"> (that I captured earlier)</div> does not show up again<div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">. What am I doing wrong here?</div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">My main function is very simple, like this:</div></span></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"> if(crMode==CAPTURE){<br> runLinpack();<br> // in above function, at some point of execution,<br> // I <span style="font-family:arial,sans-serif">initialise_criu, and then I dump the application<br></span><span style="font-family:arial,sans-serif"> }</span><br> else if(crMode==REPLAY){<br> initialise_criu(CRIU_IMG_DIR);<br> restoreApplication();<br> }<br> return 0;</blockquote></div><div class="gmail_quote"><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"> </div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">I run the main function two separate times. One to capture, but still continue playing the application, and another one to replay the application from the earlier snapshot!</div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">Cheers,</div></span></div><div><span style="font-family:verdana,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">Paschalis</div></span></div></div></div></div>