@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2010-2014 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
@@ -43,13 +43,11 @@ public class Linux extends OS {
|
||||
return "linux";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderBinaryPath() {
|
||||
@Override public String getRenderBinaryPath() {
|
||||
return "rend.exe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPU getCPU() {
|
||||
@Override public CPU getCPU() {
|
||||
CPU ret = new CPU();
|
||||
try {
|
||||
String filePath = "/proc/cpuinfo";
|
||||
@@ -89,8 +87,7 @@ public class Linux extends OS {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMemory() {
|
||||
@Override public long getMemory() {
|
||||
try {
|
||||
String filePath = "/proc/meminfo";
|
||||
Scanner scanner = new Scanner(new File(filePath));
|
||||
@@ -118,8 +115,7 @@ public class Linux extends OS {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFreeMemory() {
|
||||
@Override public long getFreeMemory() {
|
||||
try {
|
||||
String filePath = "/proc/meminfo";
|
||||
Scanner scanner = new Scanner(new File(filePath));
|
||||
@@ -138,7 +134,8 @@ public class Linux extends OS {
|
||||
scanner.close();
|
||||
}
|
||||
catch (java.lang.NoClassDefFoundError e) {
|
||||
System.err.println("OS::Linux::getFreeMemory error " + e + " mostly because Scanner class was introducted by Java 5 and you are running a lower version");
|
||||
System.err.println(
|
||||
"OS::Linux::getFreeMemory error " + e + " mostly because Scanner class was introducted by Java 5 and you are running a lower version");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -147,13 +144,11 @@ public class Linux extends OS {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCUDALib() {
|
||||
@Override public String getCUDALib() {
|
||||
return "cuda";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
||||
@Override public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
||||
Map<String, String> new_env = new HashMap<String, String>();
|
||||
new_env.putAll(java.lang.System.getenv()); // clone the env
|
||||
|
||||
@@ -201,13 +196,12 @@ public class Linux extends OS {
|
||||
return builder.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSupportHighPriority() {
|
||||
@Override public boolean getSupportHighPriority() {
|
||||
// only the root user can create process with high (negative nice) value
|
||||
String logname = System.getenv("LOGNAME");
|
||||
String user = System.getenv("USER");
|
||||
|
||||
if ((logname != null && logname.equals("root")) || (user != null && user.equals("root"))) {
|
||||
if ((logname != null && logname.equals("root")) || (user != null && user.equals("root"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user