aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-10-26 16:51:34 -0500
committerPeter Seebach <peter.seebach@windriver.com>2011-11-02 13:31:41 -0500
commit6177474388f243c9ff783da074a531ef8fd173fd (patch)
tree8f3df61d79586d6a737e08d4a12f25b606871b5e /ports
parent4a646c8bbe73ca830cb8c2e80be4b457d925cdd4 (diff)
downloadpseudo-6177474388f243c9ff783da074a531ef8fd173fd.tar.gz
pseudo-6177474388f243c9ff783da074a531ef8fd173fd.tar.bz2
pseudo-6177474388f243c9ff783da074a531ef8fd173fd.zip
Implement PSEUDO_UNLOAD, replacing existing PSEUDO_RELOADED semantics.
Change from internal PSEUDO_RELOADED to external PSEUDO_UNLOAD environment variable. Enable external programs to have a safe and reliable way to unload pseudo on the next exec*. PSEUDO_UNLOAD also will disable pseudo if we're in a fork/clone situation in the same way PSEUDO_DISABLED=1 would. Rename the PSEUDO_DISABLED tests, and create a similar set for the new PSEUDO_UNLOAD. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'ports')
-rw-r--r--ports/common/guts/execv.c7
-rw-r--r--ports/common/guts/execve.c7
-rw-r--r--ports/common/guts/execvp.c7
-rw-r--r--ports/common/guts/fork.c5
-rw-r--r--ports/linux/newclone/guts/clone.c5
-rw-r--r--ports/linux/oldclone/guts/clone.c5
6 files changed, 12 insertions, 24 deletions
diff --git a/ports/common/guts/execv.c b/ports/common/guts/execv.c
index 15ad51e..763e1f9 100644
--- a/ports/common/guts/execv.c
+++ b/ports/common/guts/execv.c
@@ -18,12 +18,9 @@
free(path_guess);
}
- if (!pseudo_get_value("PSEUDO_RELOADED"))
- pseudo_setupenv();
- else {
- pseudo_setupenv();
+ pseudo_setupenv();
+ if (pseudo_get_value("PSEUDO_UNLOAD"))
pseudo_dropenv();
- }
/* if exec() fails, we may end up taking signals unexpectedly...
* not much we can do about that.
diff --git a/ports/common/guts/execve.c b/ports/common/guts/execve.c
index a47b9a7..a003657 100644
--- a/ports/common/guts/execve.c
+++ b/ports/common/guts/execve.c
@@ -19,12 +19,9 @@
free(path_guess);
}
- if (!pseudo_get_value("PSEUDO_RELOADED"))
- new_environ = pseudo_setupenvp(envp);
- else {
- new_environ = pseudo_setupenvp(envp);
+ new_environ = pseudo_setupenvp(envp);
+ if (pseudo_get_value("PSEUDO_UNLOAD"))
new_environ = pseudo_dropenvp(new_environ);
- }
/* if exec() fails, we may end up taking signals unexpectedly...
* not much we can do about that.
diff --git a/ports/common/guts/execvp.c b/ports/common/guts/execvp.c
index 419f41b..5e75be7 100644
--- a/ports/common/guts/execvp.c
+++ b/ports/common/guts/execvp.c
@@ -19,12 +19,9 @@
free(path_guess);
}
- if (!pseudo_get_value("PSEUDO_RELOADED"))
- pseudo_setupenv();
- else {
- pseudo_setupenv();
+ pseudo_setupenv();
+ if (pseudo_get_value("PSEUDO_UNLOAD"))
pseudo_dropenv();
- }
/* if exec() fails, we may end up taking signals unexpectedly...
* not much we can do about that.
diff --git a/ports/common/guts/fork.c b/ports/common/guts/fork.c
index 76cac6f..df8abd7 100644
--- a/ports/common/guts/fork.c
+++ b/ports/common/guts/fork.c
@@ -11,11 +11,10 @@
* pseudo in the child process
*/
if (rc == 0) {
- if (!pseudo_get_value("PSEUDO_RELOADED")) {
- pseudo_setupenv();
+ pseudo_setupenv();
+ if (!pseudo_get_value("PSEUDO_UNLOAD")) {
pseudo_reinit_libpseudo();
} else {
- pseudo_setupenv();
pseudo_dropenv();
}
}
diff --git a/ports/linux/newclone/guts/clone.c b/ports/linux/newclone/guts/clone.c
index b3400c7..4b65036 100644
--- a/ports/linux/newclone/guts/clone.c
+++ b/ports/linux/newclone/guts/clone.c
@@ -12,11 +12,10 @@
* undo it later. UGH!
*/
pseudo_debug(1, "client resetting for clone(2) call\n");
- if (!pseudo_get_value("PSEUDO_RELOADED")) {
- pseudo_setupenv();
+ pseudo_setupenv();
+ if (!pseudo_get_value("PSEUDO_UNLOAD")) {
pseudo_reinit_libpseudo();
} else {
- pseudo_setupenv();
pseudo_dropenv();
}
/* call the real syscall */
diff --git a/ports/linux/oldclone/guts/clone.c b/ports/linux/oldclone/guts/clone.c
index 58ff4ad..e8b87e8 100644
--- a/ports/linux/oldclone/guts/clone.c
+++ b/ports/linux/oldclone/guts/clone.c
@@ -12,11 +12,10 @@
* undo it later. UGH!
*/
pseudo_debug(1, "client resetting for clone(2) call\n");
- if (!pseudo_get_value("PSEUDO_RELOADED")) {
- pseudo_setupenv();
+ pseudo_setupenv();
+ if (!pseudo_get_value("PSEUDO_UNLOAD")) {
pseudo_reinit_libpseudo();
} else {
- pseudo_setupenv();
pseudo_dropenv();
}
/* call the real syscall */