fix #7 switch to using host syscalls in emul.c