+ for (i = 0; i < NB_REGIONS; i++) {
+ // For privatized, variables we decided it was not necessary to take the snapshot:
+ if (snapshot->regions[i])
+ MC_region_restore(snapshot->regions[i],
+ parent_snapshot ? parent_snapshot->regions[i] : NULL);
+ }
+
+#ifdef HAVE_SMPI
+ if (snapshot->privatization_regions) {
+ // Restore the global variables of the application separately for each
+ // simulated process:
+ for (i = 0; i < smpi_process_count(); i++) {
+ if (snapshot->privatization_regions[i]) {
+ MC_region_restore(snapshot->privatization_regions[i],
+ parent_snapshot ? parent_snapshot->privatization_regions[i] : NULL);
+ }
+ }
+ }
+ if(snapshot->privatization_index >= 0) {
+ // We just rewrote the global variables.
+ // The privatisation segment SMPI thinks
+ // is mapped might be inconsistent with the segment which
+ // is really mapped in memory (kernel state).
+ // We ask politely SMPI to map the segment anyway,
+ // even if it thinks it is the current one:
+ smpi_really_switch_data_segment(snapshot->privatization_index);
+ }
+#endif
+
+ for(i=0; i < snapshot->total_fd; i++){
+
+ new_fd = open(snapshot->current_fd[i]->filename, snapshot->current_fd[i]->flags);
+ if(new_fd != -1 && new_fd != snapshot->current_fd[i]->number){
+ dup2(new_fd, snapshot->current_fd[i]->number);
+ //fprintf(stderr, "%p\n", fdopen(snapshot->current_fd[i]->number, "rw"));
+ lseek(snapshot->current_fd[i]->number, snapshot->current_fd[i]->current_position, SEEK_SET);
+ };
+ }
+
+ if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) {
+ mc_softdirty_reset();
+ }
+
+ MC_snapshot_ignore_restore(snapshot);
+ if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) {
+ mc_model_checker->parent_snapshot = snapshot;