}
}
- InputStream stdin = Boolean.valueOf(getSystemProperty("nestedvm.textstdin")).booleanValue() ? new TextInputStream(System.in) : System.in;
+ InputStream stdin = Boolean.valueOf(Platform.getProperty("nestedvm.textstdin")).booleanValue() ? new TextInputStream(System.in) : System.in;
addFD(new TerminalFD(stdin));
addFD(new TerminalFD(System.out));
addFD(new TerminalFD(System.err));
return _byteBuf;
}
- static String getSystemProperty(String key) {
- try {
- return System.getProperty(key);
- } catch(SecurityException e) {
- return null;
- }
- }
-
/** Decode a packed string */
protected static final int[] decodeData(String s, int words) {
if(s.length() % 8 != 0) throw new IllegalArgumentException("string length must be a multiple of 8");
super(pageSize,totalPages);
// FEATURE: Do the proper mangling for non-unix hosts
- String userdir = getSystemProperty("user.dir");
+ String userdir = Platform.getProperty("user.dir");
cwd =
- userdir != null && userdir.startsWith("/") && File.separatorChar == '/' && getSystemProperty("nestedvm.root") == null
+ userdir != null && userdir.startsWith("/") && File.separatorChar == '/' && Platform.getProperty("nestedvm.root") == null
? userdir.substring(1) : "";
}
String[] defaults = new String[6];
int n=0;
if(extra == null) extra = new String[0];
- if(!envHas("USER",extra) && getSystemProperty("user.name") != null)
- defaults[n++] = "USER=" + getSystemProperty("user.name");
- if(!envHas("HOME",extra) && getSystemProperty("user.home") != null)
- defaults[n++] = "HOME=" + getSystemProperty("user.home");
+ if(!envHas("USER",extra) && Platform.getProperty("user.name") != null)
+ defaults[n++] = "USER=" + Platform.getProperty("user.name");
+ if(!envHas("HOME",extra) && Platform.getProperty("user.home") != null)
+ defaults[n++] = "HOME=" + Platform.getProperty("user.home");
if(!envHas("SHELL",extra)) defaults[n++] = "SHELL=/bin/sh";
if(!envHas("TERM",extra)) defaults[n++] = "TERM=vt100";
if(!envHas("TZ",extra)) defaults[n++] = "TZ=" + posixTZ();
public synchronized Object exec(UnixRuntime r, String path) throws ErrnoException {
// HACK: Hideous hack to make a standalone busybox possible
- if(path.equals("bin/busybox") && Boolean.valueOf(getSystemProperty("nestedvm.busyboxhack")).booleanValue())
+ if(path.equals("bin/busybox") && Boolean.valueOf(Platform.getProperty("nestedvm.busyboxhack")).booleanValue())
return r.getClass();
FStat fstat = stat(r,path);
if(fstat == null) return null;
public File getRoot() { return root; }
private static File hostRootDir() {
- if(getSystemProperty("nestedvm.root") != null) {
- File f = new File(getSystemProperty("nestedvm.root"));
+ if(Platform.getProperty("nestedvm.root") != null) {
+ File f = new File(Platform.getProperty("nestedvm.root"));
if(f.isDirectory()) return f;
// fall through to case below
}
- String cwd = getSystemProperty("user.dir");
+ String cwd = Platform.getProperty("user.dir");
File f = new File(cwd != null ? cwd : ".");
if(!f.exists()) throw new Error("Couldn't get File for cwd");
f = new File(f.getAbsolutePath());
while(f.getParent() != null) f = new File(f.getParent());
+ // HACK: This works around a bug in some versions of ClassPath
+ if(f.getPath().length() == 0) f = new File("/");
return f;
}
static {
float version;
try {
- version = Float.valueOf(System.getProperty("java.specification.version")).floatValue();
+ if(getProperty("java.vm.name").equals("SableVM"))
+ version = 1.2f;
+ else
+ version = Float.valueOf(getProperty("java.specification.version")).floatValue();
} catch(Exception e) {
System.err.println("WARNING: " + e + " while trying to find jvm version - assuming 1.1");
version = 1.1f;
}
}
+ public static String getProperty(String key) {
+ try {
+ return System.getProperty(key);
+ } catch(SecurityException e) {
+ return null;
+ }
+ }
+
+
abstract boolean _atomicCreateFile(File f) throws IOException;
public static boolean atomicCreateFile(File f) throws IOException { return p._atomicCreateFile(f); }