devfs fixes
authorbrian <brian@brianweb.net>
Mon, 24 May 2004 03:13:02 +0000 (20:13 -0700)
committerbrian <brian@brianweb.net>
Mon, 24 May 2004 03:13:02 +0000 (20:13 -0700)
darcs-hash:20040524031302-24bed-fafc76dd4692189d0c88acf6e3f68a323b292d50.gz

src/org/ibex/nestedvm/Runtime.java
src/org/ibex/nestedvm/UnixRuntime.java

index d6db76d..ff33ba9 100644 (file)
@@ -1236,7 +1236,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         public TerminalFD(OutputStream os) { this(null,os); }
         public TerminalFD(InputStream is, OutputStream os) { super(is,os); }
         public void _close() { /* noop */ }
         public TerminalFD(OutputStream os) { this(null,os); }
         public TerminalFD(InputStream is, OutputStream os) { super(is,os); }
         public void _close() { /* noop */ }
-        public FStat _fstat() { return new FStat() { public int type() { return S_IFCHR; } }; }
+        public FStat _fstat() { return new FStat() { public int type() { return S_IFCHR; } public int mode() { return 0600; } }; }
     }
     
     // FEATURE: TextInputStream: This is pretty inefficient but it is only used for reading from the console on win32
     }
     
     // FEATURE: TextInputStream: This is pretty inefficient but it is only used for reading from the console on win32
index a4b1991..491a486 100644 (file)
@@ -1059,7 +1059,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
                 for(int i=0;i<list.length;i++) {
                     MP mp = list[i];
                     int mpl = mp.path.length();
                 for(int i=0;i<list.length;i++) {
                     MP mp = list[i];
                     int mpl = mp.path.length();
-                    if(normalizedPath.startsWith(mp.path) && (pl == mpl || (pl < mpl && normalizedPath.charAt(mpl) == '/')))
+                    if(normalizedPath.startsWith(mp.path) && (pl == mpl || normalizedPath.charAt(mpl) == '/'))
                         return dispatch(mp.fs,op,r,pl == mpl ? "" : normalizedPath.substring(mpl+1),arg1,arg2);
                 }
             }
                         return dispatch(mp.fs,op,r,pl == mpl ? "" : normalizedPath.substring(mpl+1),arg1,arg2);
                 }
             }
@@ -1517,7 +1517,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
             if(path.startsWith("fd/")) {
                 int n;
                 try {
             if(path.startsWith("fd/")) {
                 int n;
                 try {
-                    n = Integer.parseInt(path.substring(4));
+                    n = Integer.parseInt(path.substring(3));
                 } catch(NumberFormatException e) {
                     return null;
                 }
                 } catch(NumberFormatException e) {
                     return null;
                 }