MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / createProcess

Method createProcess

src/dmtcprestartinternal.cpp:290–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void
291RestoreTarget::createProcess(bool createIndependentRootProcesses)
292{
293 initialize();
294
295 if (allowedModes == COORD_NEW) {
296 allowedModes = COORD_ANY; // we have coord; restore default of COORD_ANY
297 }
298
299 JTRACE("Creating process during restart")(upid())(procname());
300 JTRACE("Creating process during restart")(upid())(procname());
301
302 RestoreTargetMap::iterator it;
303 for (it = targets.begin(); it != targets.end(); it++) {
304 RestoreTarget *t = it->second;
305 if (upid() == t->upid()) {
306 continue;
307 } else if (t->uppid() == upid() && t->sid() != pid()) {
308 t->createDependentChildProcess();
309 }
310 }
311
312 if (createIndependentRootProcesses) {
313 RestoreTargetMap::iterator it;
314 for (it = independentProcessTreeRoots.begin();
315 it != independentProcessTreeRoots.end(); it++) {
316 RestoreTarget *t = it->second;
317 if (t != this) {
318 t->createDependentNonChildProcess();
319 }
320 }
321 }
322
323 // If we were the session leader, become one now.
324 if (sid() == pid()) {
325 if (getsid(0) != pid()) {
326 JWARNING(setsid() != -1)
327 (getsid(0))(JASSERT_ERRNO)
328 .Text("Failed to restore this process as session leader.");
329 }
330 }
331
332 // Now recreate processes with sid == _pid
333 for (it = targets.begin(); it != targets.end(); it++) {
334 RestoreTarget *t = it->second;
335 if (upid() == t->upid()) {
336 continue;
337 } else if (t->sid() == pid()) {
338 if (t->uppid() == upid()) {
339 t->createDependentChildProcess();
340 } else if (t->isRootOfProcessTree()) {
341 t->createDependentNonChildProcess();
342 }
343 }
344 }
345
346 // Now close all open fds except _fd;
347 for (it = targets.begin(); it != targets.end(); it++) {

Callers 1

processCkptImagesMethod · 0.80

Calls 13

getsidFunction · 0.85
setsidFunction · 0.85
runMtcpRestartFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
uppidMethod · 0.80
sidMethod · 0.80
isRootOfProcessTreeMethod · 0.80
closeFunction · 0.70
upidMethod · 0.45

Tested by

no test coverage detected