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

Method getState

src/processinfo.cpp:630–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630void
631ProcessInfo::getState()
632{
633 JASSERT(pid == getpid()) (pid) (getpid());
634
635 gid = getpgid(0);
636 sid = getsid(0);
637
638 fgid = -1;
639
640 // Try to open the controlling terminal
641 int tfd = _real_open("/dev/tty", O_RDWR);
642 if (tfd != -1) {
643 fgid = tcgetpgrp(tfd);
644 _real_close(tfd);
645 }
646
647 if (ppid != getppid()) {
648 // Our original parent died; we are the root of the process tree now.
649 //
650 // On older systems, a process is inherited by init (pid = 1) after its
651 // parent dies. However, with the new per-user init process, the parent
652 // pid is no longer "1"; it's the pid of the user-specific init process.
653 ppid = getppid();
654 isRootOfProcessTree = true;
655 uppid = UniquePid();
656 } else {
657 uppid = UniquePid::ParentProcess();
658 }
659
660 string procSelfExeStr = jalib::Filesystem::ResolveSymlink("/proc/self/exe");
661 strncpy(procSelfExe, procSelfExeStr.c_str(), sizeof(procSelfExe) - 1);
662
663 strncpy(procname, jalib::Filesystem::GetProgramName().c_str(), sizeof(procname) -1);
664 _hostname = jalib::Filesystem::GetCurrentHostname();
665 upid = UniquePid::ThisProcess();
666
667 char buf[PATH_MAX];
668 JASSERT(getcwd(buf, sizeof buf) != NULL);
669 _ckptCWD = buf;
670
671 savedBrk = (uint64_t) sbrk(0);
672
673 JTRACE("CHECK GROUP PID")(gid)(fgid)(ppid)(pid);
674}
675
676// NOTE: ProcessInfo object acts as the checkpoint header for DMTCP.
677void

Callers 2

checkpointFunction · 0.80
processInfo_EventHookFunction · 0.80

Calls 8

getpgidFunction · 0.85
getsidFunction · 0.85
tcgetpgrpFunction · 0.85
getppidFunction · 0.85
UniquePidClass · 0.85
_real_openFunction · 0.70
_real_closeFunction · 0.70
getpidFunction · 0.50

Tested by

no test coverage detected