From 4ed887824c95de8f6d94f4457b5e7b81c0df0707 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 7 Jun 2005 01:28:29 -0700 Subject: [PATCH] new filesystem stuff darcs-hash:20050607082829-24bed-fbb9c135cab41f12171dff880544a32d2b1a9c03.gz --- src/org/ibex/nestedvm/Runtime.java | 4 +++- src/org/ibex/nestedvm/UnixRuntime.java | 34 +++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index e909b81..74b3a12 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -1031,9 +1031,11 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { protected final int syscall(int syscall, int a, int b, int c, int d, int e, int f) { try { int n = _syscall(syscall,a,b,c,d,e,f); - //if(n < 0) System.err.println("syscall: " + syscall + " returned " + n); + //if(n<0) throw new ErrnoException(-n); return n; } catch(ErrnoException ex) { + //System.err.println("While executing syscall: " + syscall + ":"); + //if(syscall == SYS_open) try { System.err.println("Failed to open " + cstring(a) + " errno " + ex.errno); } catch(Exception e2) { } //ex.printStackTrace(); return -ex.errno; } catch(FaultException ex) { diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index c88cf24..adf27f8 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -174,6 +174,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { case SYS_fchown: return sys_fchown(a,b,c); case SYS_chmod: return sys_chmod(a,b,c); case SYS_fchmod: return sys_fchmod(a,b,c); + case SYS_umask: return sys_umask(a); default: return super._syscall(syscall,a,b,c,d,e,f); } @@ -202,7 +203,9 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { private int sys_fchmod(int fd, int uid, int gid) { return 0; } - + private int sys_umask(int mask) { + return 0; + } private int sys_access(int cstring, int mode) throws ErrnoException, ReadFaultException { // FEATURE: sys_access @@ -505,13 +508,16 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { if(p == buf.length) break OUTER; n = s.read(buf,p,buf.length-p); } - int arg; - for(arg=2;arg 0 && out[outp-1] == '/') outp--; //System.err.println("normalize: " + path + " -> " + new String(out,0,outp) + " (cwd: " + cwd + ")"); - return new String(out,0,outp); + int outStart = out[0] == '/' ? 1 : 0; + return new String(out,outStart,outp - outStart); } FStat hostFStat(final File f, Object data) { -- 1.7.10.4