diff options
Diffstat (limited to 'guts')
-rw-r--r-- | guts/clone.c | 33 | ||||
-rw-r--r-- | guts/execve.c | 1 | ||||
-rw-r--r-- | guts/fork.c | 9 |
3 files changed, 41 insertions, 2 deletions
diff --git a/guts/clone.c b/guts/clone.c new file mode 100644 index 0000000..61c8bf9 --- /dev/null +++ b/guts/clone.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008-2010 Wind River Systems; see + * guts/COPYRIGHT for information. + * + * static int + * clone(...) { + * .... + */ + /* because clone() doesn't actually continue in this function, we + * can't check the return and fix up environment variables in the + * child. Instead, we have to temporarily do any fixup, then possibly + * undo it later. UGH! + */ + pseudo_debug(1, "client resetting for clone(2) call\n"); + if (real_clone) { + if (!pseudo_get_value("PSEUDO_RELOADED")) { + pseudo_setupenv(); + pseudo_client_reinit(); + } else { + pseudo_setupenv(); + pseudo_dropenv(); + } + /* call the real syscall */ + rc = (*real_clone)(fn, child_stack, flags, arg, pid, tls, ctid); + } else { + /* rc was initialized to the "failure" value */ + pseudo_enosys("clone"); + } + +/* ... + * return rc; + * } + */ diff --git a/guts/execve.c b/guts/execve.c index 36d4bfd..febcf80 100644 --- a/guts/execve.c +++ b/guts/execve.c @@ -14,6 +14,7 @@ * design will likely be revisited. */ pseudo_client_op(OP_EXEC, PSA_EXEC, -1, -1, file, 0); + if (!pseudo_get_value("PSEUDO_RELOADED")) new_environ = pseudo_setupenvp(envp); else { diff --git a/guts/fork.c b/guts/fork.c index fa23be1..8febd13 100644 --- a/guts/fork.c +++ b/guts/fork.c @@ -12,8 +12,13 @@ * pseudo in the child process */ if (rc == 0) { - pseudo_setupenv(); - pseudo_client_reset(); + if (!pseudo_get_value("PSEUDO_RELOADED")) { + pseudo_setupenv(); + pseudo_client_reinit(); + } else { + pseudo_setupenv(); + pseudo_dropenv(); + } } } else { /* rc was initialized to the "failure" value */ |