Пример #1
0
static bool isImportantEnv ( dmtcp::string str )
{
  str = str.substr(0, str.find("="));

  for ( size_t i=0; i<ourImportantEnvsCnt; ++i ) {
    if ( str == ourImportantEnvs[i] )
      return true;
  }
  return false;
}
Пример #2
0
int findLibTorque_maps(dmtcp::string &libpath)
{
  // /proc/self/maps looks like: "<start addr>-<end addr> <mode> <offset> <device> <inode> <libpath>
  // we need to extract libpath
  dmtcp::Util::ProcMapsArea area;
  int ret = -1;

  // we will search for first libpath and first libname
  int fd = _real_open ( "/proc/self/maps", O_RDONLY);

  if( fd < 0 ){
    JTRACE("Cannot open /proc/self/maps file");
    return -1;
  }

  while( dmtcp::Util::readProcMapsLine(fd, &area) ){
    libpath = area.name;
    JNOTE("Inspect new /proc/seft/maps line")(libpath);
    if( libpath.size() == 0 ){
      JNOTE("anonymous region, skip");
      continue;
    }

    if( libpath.find("libtorque") != dmtcp::string::npos ){
      // this is library path that contains libtorque. This is what we need
      JTRACE("Torque PBS libpath")(libpath);
      ret = 0;
      break;
    }else{
      JNOTE("Not a libtorque region")(libpath);
    }
  }

  _real_close(fd);
  return ret;
}