+extern char **environ;
+
+static UNUSED int w_execl(const char *path, const char *arg, ...)
+{
+ // don't allow exec (for now)
+ strace("execl(%s, %s, ...) = ?\n", path, arg);
+ exit(1);
+}
+
+static UNUSED int w_execlp(const char *file, const char *arg, ...)
+{
+ strace("execlp(%s, %s, ...) = ?\n", file, arg);
+ exit(1);
+}
+
+static UNUSED int w_execle(const char *path, const char *arg, ...)
+{
+ strace("execle(%s, %s, ...) = ?\n", path, arg);
+ exit(1);
+}
+
+static UNUSED int w_execv(const char *path, char *const argv[])
+{
+ strace("execv(%s, %p) = ?\n", path, argv);
+ return emu_do_execve(path, argv, environ);
+}
+
+static UNUSED int w_execvp(const char *file, char *const argv[])
+{
+ strace("execvp(%s, %p) = ?\n", file, argv);
+ return emu_do_execve(file, argv, environ);
+}
+
+// static note: this can't safely return because of the way it's patched in
+// static note2: can't be used, execve hangs?
+static UNUSED int w_execve(const char *filename, char *const argv[],
+ char *const envp[])
+{
+ strace("execve(%s, %p, %p) = ?\n", filename, argv, envp);
+ return emu_do_execve(filename, argv, envp);
+}
+
+static int w_chdir(const char *path)
+{
+ int ret;
+ if (path != NULL && strstr(path, "/usr/gp2x") != NULL)
+ ret = 0;
+ else
+ ret = chdir(path);
+ strace("chdir(%s) = %d\n", path, ret);
+ return ret;
+}
+