import java.io.*;
import java.util.*;
+// FEATURE: vfork
+
public abstract class UnixRuntime extends Runtime implements Cloneable {
/** The pid of this "process" */
private int pid;
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);
}
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.
}
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();