void SocketConnList::scanForPreExisting() { // FIXME: Detect stdin/out/err fds to detect duplicates. vector<int> fds = jalib::Filesystem::ListOpenFds(); for (size_t i = 0; i < fds.size(); ++i) { int fd = fds[i]; if (!Util::isValidFd(fd)) continue; if (dmtcp_is_protected_fd(fd)) continue; string device = jalib::Filesystem::GetDeviceName(fd); JTRACE("scanning pre-existing device") (fd) (device); if (device == jalib::Filesystem::GetControllingTerm()) { } else if(dmtcp_is_bq_file && dmtcp_is_bq_file(device.c_str())) { } else if( fd <= 2 ){ } else if (Util::strStartsWith(device, "/")) { } else { JNOTE("found pre-existing socket... will not be restored") (fd) (device); TcpConnection* con = new TcpConnection(0, 0, 0); con->markPreExisting(); add(fd, con); } } }
void SocketConnList::scanForPreExisting() { // TODO: This is a hack when SLURM + MPI are used: // when we use command // srun/ibrun dmtcp_launch a.out // inside the SLURM submission script, the MPI launching // process will not run under the control of DMTCP. Instead, // only the computing processes are. The launching process // will create some sockets, and then create the computing // processes. Hence the sockets are shared among the created // processes at the time when dmtcp_launch is launched. DMTCP // will treat these sockets as pre-existing sockets instead of // shared sockets. // // In the future, we should generalize the processing of // pre-existing fds. For example, at checkpoint time, determine // which sockets are shared, regardless of whether they are // pre-existing or not. This can be done by adding an extra round // of leader election. if (getenv("SLURM_JOBID") || (getenv("SLURM_JOB_ID"))) { return; } // FIXME: Detect stdin/out/err fds to detect duplicates. vector<int>fds = jalib::Filesystem::ListOpenFds(); for (size_t i = 0; i < fds.size(); ++i) { int fd = fds[i]; if (!Util::isValidFd(fd)) { continue; } if (dmtcp_is_protected_fd(fd)) { continue; } string device = jalib::Filesystem::GetDeviceName(fd); JTRACE("scanning pre-existing device") (fd) (device); if (device == jalib::Filesystem::GetControllingTerm()) {} else if (dmtcp_is_bq_file && dmtcp_is_bq_file( device.c_str())) {} else if (fd <= 2) {} else if (Util::strStartsWith(device.c_str(), "/")) {} else { JNOTE("found pre-existing socket... will not be restored") (fd) (device); TcpConnection *con = new TcpConnection(0, 0, 0); con->markPreExisting(); add(fd, con); } } }