X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FUnixRuntime.java;h=e3afe98e3ae4e319fe310dfc36937603e3ced802;hp=6c986e5be9ded348f8caf271de28cc13eee6ebee;hb=119cb20e2b9d594032653c8464717b1420b6abc7;hpb=94617ade62211d11c80b1e87b2a4c822297dd43f diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index 6c986e5..e3afe98 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -4,6 +4,8 @@ import org.ibex.nestedvm.util.*; import java.io.*; import java.util.*; +// FEATURE: vfork + public abstract class UnixRuntime extends Runtime implements Cloneable { /** The pid of this "process" */ private int pid; @@ -114,6 +116,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { case SYS_exec: return sys_exec(a,b,c); case SYS_getdents: return sys_getdents(a,b,c,d); case SYS_unlink: return sys_unlink(a); + case SYS_getppid: return sys_getppid(); default: return super._syscall(syscall,a,b,c,d); } @@ -122,6 +125,10 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { FD _open(String path, int flags, int mode) throws ErrnoException { return gs.open(this,normalizePath(path),flags,mode); } + + private int sys_getppid() { + return parent == null ? 1 : parent.pid; + } /** The kill syscall. SIGSTOP, SIGTSTO, SIGTTIN, and SIGTTOUT pause the process. @@ -635,6 +642,9 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { } public synchronized Object exec(UnixRuntime r, String path) throws ErrnoException { + // FIXME: Hideous hack to make a standalone busybox possible + if(path.equals("bin/busybox") && r.getClass().getName().endsWith("BusyBox")) + return r.getClass(); FStat fstat = stat(r,path); if(fstat == null) return null; long mtime = fstat.mtime();