private static EnumMap<OpenFileNumStatistics, Integer> getOpenFile(int pid) {
    EnumMap<OpenFileNumStatistics, Integer> resultMap = new EnumMap<>(OpenFileNumStatistics.class);
    // initialize resultMap
    for (OpenFileNumStatistics openFileNumStatistics : OpenFileNumStatistics.values()) {
      resultMap.put(openFileNumStatistics, 0);
    }
    Process pro;
    int lineCount = 0;
    Runtime r = Runtime.getRuntime();
    try {
      String command = String.format(SEARCH_OPEN_DATA_FILE_BY_PID, pid);
      COMMAND_TEMPLATE[2] = command;
      pro = r.exec(COMMAND_TEMPLATE);
      String line;

      try (BufferedReader in = new BufferedReader(new InputStreamReader(pro.getInputStream()))) {
        while ((line = in.readLine()) != null) {
          lineCount++;
          countOneFile(line, pid, resultMap);
        }
      }
      if (lineCount < OpenFileNumStatistics.values().length) {
        isOutputValid = false;
        for (OpenFileNumStatistics statistics : OpenFileNumStatistics.values()) {
          resultMap.put(statistics, UNSUPPORTED_OS_ERROR_CODE);
        }
      } else {
        isOutputValid = true;
      }
      pro.destroy();
    } catch (Exception e) {
      LOGGER.error("Cannot get open file number of IoTDB process because ", e);
    }
    return resultMap;
  }
return statistic Map, whose key belongs to enum OpenFileNumStatistics: TOTAL_OPEN_FILE_NUM is
the current total open file number of IoTDB service process; SEQUENCE_FILE_OPEN_NUM is the
current open file number under data directory; DELTA_OPEN_FILE_NUM is the current open file
number of TsFile; UNSEQUENCE_FILE_OPEN_NUM is the current open file number of unsequence file;
WAL_OPEN_FILE_NUM is the current open file number of WAL file; METADATA_OPEN_FILE_NUM is the
current open file number of metadata; DIGEST_OPEN_FILE_NUM is the current open file number of
fileNodeDir; SOCKET_OPEN_FILE_NUM is the current open socket connection of IoTDB service
process.

@param pid : IoTDB service pid
@return list : statistics list
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/OpenFileNumUtil.java