uname/sysctl support
[nestedvm.git] / src / org / ibex / nestedvm / Runtime.java
index 2a4567f..4d965e7 100644 (file)
@@ -9,6 +9,8 @@ import java.io.*;
 import java.util.Arrays;
 
 public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
 import java.util.Arrays;
 
 public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
+    public static final String VERSION = "1.0";
+    
     /** True to write useful diagnostic information to stderr when things go wrong */
     final static boolean STDERR_DIAG = true;
     
     /** True to write useful diagnostic information to stderr when things go wrong */
     final static boolean STDERR_DIAG = true;
     
@@ -1422,6 +1424,13 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         }
     }
     
         }
     }
     
+    static byte[] getNullTerminatedBytes(String s) {
+        byte[] buf1 = getBytes(s);
+        byte[] buf2 = new byte[buf1.length+1];
+        System.arraycopy(buf1,0,buf2,0,buf1.length);
+        return buf2;
+    }
+    
     final static String toHex(int n) { return "0x" + Long.toString(n & 0xffffffffL, 16); }
     final static int min(int a, int b) { return a < b ? a : b; }
     final static int max(int a, int b) { return a > b ? a : b; }
     final static String toHex(int n) { return "0x" + Long.toString(n & 0xffffffffL, 16); }
     final static int min(int a, int b) { return a < b ? a : b; }
     final static int max(int a, int b) { return a > b ? a : b; }