public static boolean isMacOSX(ExecutionEnvironment execEnv) { try { HostInfo info = HostInfoUtils.getHostInfo(execEnv); return info.getOSFamily() == HostInfo.OSFamily.MACOSX; } catch (IOException ex) { } catch (CancellationException ex) { } return false; }
private String getRemoteDir(ExecutionEnvironment env, File localFile, String dirname) { if (env.isLocal()) { return localFile.getParentFile().getAbsolutePath(); } else { String tmpDir; try { tmpDir = HostInfoUtils.getHostInfo(env).getTempDir(); } catch (Throwable ex) { tmpDir = "/var/tmp"; // NOI18N } return tmpDir + "/tools/" + dirname; // NOI18N } }
@Override public Map<String, String> getEnv() { Map<String, String> result = null; if (HostInfoUtils.isHostInfoAvailable(execEnv)) { try { result = HostInfoUtils.getHostInfo(execEnv).getEnvironment(); } catch (IOException ex) { } catch (CancellationException ex) { } } if (result == null) { result = System.getenv(); } return result; }
public MacroConverter(ExecutionEnvironment env) { envVariables = new HashMap<>(); if (HostInfoUtils.isHostInfoAvailable(env)) { try { HostInfo hostInfo = HostInfoUtils.getHostInfo(env); envVariables.putAll(hostInfo.getEnvironment()); } catch (IOException | CancellationException ex) { // should never == null occur if isHostInfoAvailable(env) => report Exceptions.printStackTrace(ex); } } BrokenReferencesSupport.addTemporaryEnv(env, envVariables); this.expander = (envVariables == null) ? null : MacroExpanderFactory.getExpander(env, false); }
public LDErrorParser(Project project, CompilerFlavor flavor, ExecutionEnvironment execEnv, FileObject relativeTo) { this.execEnv = execEnv; this.project = project; try { HostInfo hostInfo = HostInfoUtils.getHostInfo(execEnv); switch (hostInfo.getOSFamily()) { case MACOSX: isMac = true; checkBuildTrace = true; checkRfs = false; break; case LINUX: case SUNOS: checkBuildTrace = true; checkRfs = execEnv.isRemote(); break; case UNKNOWN: case WINDOWS: // unsuported break; } } catch (IOException ex) { Exceptions.printStackTrace(ex); } catch (CancellationException ex) { // don't report cancellation exception } }
public ValidationStatus compute(final DLightTarget target) throws InterruptedException { ValidationStatus result = ValidationStatus.initialStatus(); try { if (HostInfoUtils.getHostInfo(target.getExecEnv()).getOSFamily() == OSFamily.SUNOS) { result = ValidationStatus.validStatus(); } else { result = ValidationStatus.invalidStatus(NbBundle.getMessage(ProcFSDataCollectorValidator.class, "SunOSIsSupportedPlatform")); // NOI18N } } catch (IOException ex) { Exceptions.printStackTrace(ex); } catch (CancellationException ex) { Exceptions.printStackTrace(ex); } return result; } }
public static String getDefaultProjectFolder(ExecutionEnvironment env) { try { if (env.isLocal()) { return getDefaultProjectFolder(); } else { return HostInfoUtils.getHostInfo(env).getUserDir() + '/' + ProjectChooser.getProjectsFolder().getName(); //NOI18N } } catch (IOException ex) { ex.printStackTrace(System.err); // it doesn't make sense to disturb user } catch (CancellationException ex) { ex.printStackTrace(System.err); // it doesn't make sense to disturb user } return null; }
private DLightScheduledTask startMonitor() { try { // Will monitor the process with PID == pid HostInfo hinfo = HostInfoUtils.getHostInfo(execEnv); boolean isSolaris = hinfo.getOSFamily() == HostInfo.OSFamily.SUNOS; Runnable verifier = isSolaris ? new SolarisVerifier() : new LinuxVerifier(); return DLightExecutorService.scheduleAtFixedRate( verifier, 200, TimeUnit.MILLISECONDS, "Monitoring process " + pid + "@" + execEnv.toString() + // NOI18N " for THA pause/resume readiness"); // NOI18N } catch (IOException ex) { } catch (CancellationException ex) { } return null; }
public MacroConverter(ExecutionEnvironment env) { envVariables = new HashMap<>(); if (HostInfoUtils.isHostInfoAvailable(env)) { try { HostInfo hostInfo = HostInfoUtils.getHostInfo(env); envVariables.putAll(hostInfo.getEnvironment()); homeDir = hostInfo.getUserDir(); pathName = getPathName(env, hostInfo); pathSeparator = getPathSeparator(hostInfo); } catch (IOException | ConnectionManager.CancellationException ex) { // should never == null occur if isHostInfoAvailable(env) => report Exceptions.printStackTrace(ex); } } this.expander = MacroExpanderFactory.getExpander(env, false); }
@Override public String call() throws Exception { String tmpDir; try { tmpDir = HostInfoUtils.getHostInfo(execEnv).getTempDir(); } catch (Exception iOException) { tmpDir = "/tmp"; // NOI18N } String name = tmpDir + '/' + FILENAME_PREFIX + "$$" + FILENAME_EXTENSION; // NOI18N ExitStatus status = ProcessUtils.execute(execEnv, "sh", "-c", "mkfifo " + name + ";echo " + name); //NOI18N if (status.isOK()) { return status.output; } return null; } });
private synchronized void checkDemanglerIfNeeded() { if (!demanglerChecked) { String exeSuffix = ""; // NOI18N try { HostInfo hostinfo = HostInfoUtils.getHostInfo(env); if (hostinfo.getOSFamily() == HostInfo.OSFamily.WINDOWS) { exeSuffix = ".exe"; // NOI18N } } catch (CancellationException ex) { // TODO:CancellationException error processing } catch (IOException ex) { Exceptions.printStackTrace(ex); } String absPath = HostInfoUtils.searchFile(env, searchPaths, demanglerTool + exeSuffix, true); if (absPath == null) { absPath = HostInfoUtils.searchFile(env, searchPaths, CPPFILT + exeSuffix, true); if (absPath == null) { demanglerTool = null; } else { demanglerTool = absPath; } } else { demanglerTool = absPath; } demanglerChecked = true; } }
public final boolean isLinux64() { if (!isLinux()) { return false; } try { HostInfo hostInfo = HostInfoUtils.getHostInfo(executionEnvironment()); return hostInfo.getOS().getBitness() == HostInfo.Bitness._64; } catch (CancellationException ex) { } catch (IOException ex) { } return false; }
public void start() { if (isBlank()) { return; } boolean linuxMode; try { linuxMode = HostInfoUtils.getHostInfo(execEnv).getOSFamily() == HostInfo.OSFamily.LINUX; } catch (CancellationException ex) { linuxMode = false; } catch (IOException ex) { linuxMode = false; } synchronized (updaterLock) { if (updater != null) { return; } updater = new Updater(linuxMode); DLightExecutorService.submit(updater, MonitorsUpdateService.class.getName()); } }
public boolean isInstrumentationNeeded(ExecutionEnvironment env, THAConfiguration configuration) { try { if (!configuration.collectDataRaces() && configuration.collectDeadlocks() && HostInfoUtils.getHostInfo(env).getCpuFamily().equals(CpuFamily.SPARC)) { return false; } return true; } catch (IOException ex) { } catch (CancellationException ex) { } return true; }
public static String getDefaultDirectory(ExecutionEnvironment env) { String home; if (env.isLocal()) { home = System.getProperty("user.home"); // NOI18N } else if (!(HostInfoUtils.isHostInfoAvailable(env) && ConnectionManager.getInstance().isConnectedTo(env))) { home = null; } else { try { home = HostInfoUtils.getHostInfo(env).getUserDir(); } catch (IOException | ConnectionManager.CancellationException ex) { home = null; } } return home == null ? "" : home; // NOI18N }
private String getDefaultProjectDir(ExecutionEnvironment env) { String res = null; try { if (env.isLocal()) { res = ProjectChooser.getProjectsFolder().getPath(); } else if (HostInfoUtils.isHostInfoAvailable(env)) { res = HostInfoUtils.getHostInfo(env).getUserDir() + fsFileSeparator + ProjectChooser.getProjectsFolder().getName(); } } catch (IOException ex) { } catch (ConnectionManager.CancellationException ex) { } return res == null ? fileSystem.getRoot().getPath() : res; } // Variables declaration - do not modify//GEN-BEGIN:variables
public static String getDefaultDirectory(ExecutionEnvironment env) { String seed; if (env.isLocal()) { seed = System.getProperty("user.home"); // NOI18N } else if (!(HostInfoUtils.isHostInfoAvailable(env) && ConnectionManager.getInstance().isConnectedTo(env))) { seed = null; } else { try { seed = HostInfoUtils.getHostInfo(env).getUserDir(); } catch (IOException ex) { seed = null; } catch (ConnectionManager.CancellationException ex) { seed = null; } } return seed; } }
public static String getDefaultDirectory(ExecutionEnvironment env) { String seed; if (env.isLocal()) { seed = System.getProperty("user.home"); // NOI18N } else if (!(HostInfoUtils.isHostInfoAvailable(env) && ConnectionManager.getInstance().isConnectedTo(env))) { seed = null; } else { try { seed = HostInfoUtils.getHostInfo(env).getUserDir(); } catch (IOException ex) { seed = null; } catch (ConnectionManager.CancellationException ex) { seed = null; } } return seed; } }
public static String getLdLibraryPath(MakeConfiguration activeConfiguration) { String ldLibraryPathName = getLdLibraryPathName(activeConfiguration); String ldLibPath = activeConfiguration.getProfile().getEnvironment().getenv(ldLibraryPathName); ExecutionEnvironment eenv = activeConfiguration.getDevelopmentHost().getExecutionEnvironment(); if (ldLibPath != null) { try { ldLibPath = MacroExpanderFactory.getExpander(eenv).expandMacros(ldLibPath, HostInfoUtils.getHostInfo(eenv).getEnvironment()); } catch (Exception ex) { Exceptions.printStackTrace(ex); } } if (ldLibPath == null) { ldLibPath = HostInfoProvider.getEnv(eenv).get(ldLibraryPathName); // NOI18N } if (ldLibPath == null) { ldLibPath = ""; // NOI18N } return appendDefaultPaths(eenv, ldLibPath); }
@Override protected synchronized void targetStarted(DLightTarget target) { ExecutionEnvironment env = target.getExecEnv(); HostInfo hostInfo = null; try { hostInfo = HostInfoUtils.getHostInfo(env); } catch (IOException ex) { } catch (CancellationException ex) { } if (hostInfo == null) { return; } int pid = ((AttachableTarget) target).getPID(); Engine engine; switch (hostInfo.getOSFamily()) { case LINUX: engine = new ProcDataProviderLinux(this, getServiceInfoDataStorage()); break; case SUNOS: engine = new ProcDataProviderSolaris(this, getServiceInfoDataStorage(), hostInfo.getCpuNum()); break; default: DLightLogger.instance.severe("Called ProcDataProvider.targetStarted() on unsupported OS"); // NOI18N return; } NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(env); npb = npb.setExecutable("sh").setArguments("-c", engine.getCommand(pid)); // NOI18N procReaderTask = NativeProcessExecutionService.newService(npb, engine, null, "procreader").start(); // NOI18N }