aboutsummaryrefslogtreecommitdiffstats
path: root/guts
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2010-12-07 20:43:45 -0600
committerPeter Seebach <peter.seebach@windriver.com>2010-12-07 20:47:19 -0600
commit98f16482f1e5c4b9c9d3b0803d41565a350af53d (patch)
tree4af00226b5b0b3b79ff26b51aedb2c5af15f58fe /guts
parent7b2dd4c7a6e20a8fe78cb892a8406d6d119c415b (diff)
downloadpseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.tar.gz
pseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.tar.bz2
pseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.zip
This is a merge of several commits from a tree which turned out to
be out of sync in a very inconvenient way. Changes include: * Some whitespace fixes, also move the pseudo_variables definition into pseudo_util.c since it's not used anywhere else. * Further improvements in the fork() support: We now recognize both positive and negative forms of PSEUDO_DISABLED, so we can distinguish between "it was removed from the environment by env -i" (restore the old value) and "it was intentionally turned off" (the new value wins). * clone(2) support. This is a little primitive, and programs might still fail horribly due to clone's semantics, but at least it's there and passes easy test cases. Plus a big patch from Mark Hatle: Cleanup fork/clone and PSEUDO_DISABLED guts/fork.c: * cleanup function and make it more robust * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior pseudo_wrappers.c: * fix mismatched type in execl_to_v call via typecast * Simplify fork call via single call to wrap_fork() * be sure to save pseudo_disabled * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior tests: * Add a test of whether pseudo can be disabled/enabled on a fork. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'guts')
-rw-r--r--guts/README16
-rw-r--r--guts/fork.c17
2 files changed, 27 insertions, 6 deletions
diff --git a/guts/README b/guts/README
index 8bfbfe6..0a1fe5f 100644
--- a/guts/README
+++ b/guts/README
@@ -83,7 +83,7 @@ wrappers:
close
dup
dup2
- excl* (all redirect through execve)
+ execl* (no guts implementations; see pseudo_wrappers.c)
execv
execve
execvp
@@ -97,7 +97,6 @@ wrappers:
fcntl
fork
link
- vfork
The following functions don't have any direct database interactions,
but are used to simulate the permissions system:
@@ -206,3 +205,16 @@ needed because we don't actually track or manage extended attributes, but
a few programs attempt to use *setxattr() to set regular permissions,
and only use a regular chmod if the *setxattr() call returns -1 and
sets errno to ENOTSUP.
+
+ fgetxattr
+ flistxattr
+ fremovexattr
+ fsetxattr
+ getxattr
+ lgetxattr
+ listxattr
+ llistxattr
+ lremovexattr
+ lsetxattr
+ removexattr
+ setxattr
diff --git a/guts/fork.c b/guts/fork.c
index 4a91f7b..fa23be1 100644
--- a/guts/fork.c
+++ b/guts/fork.c
@@ -6,10 +6,19 @@
* wrap_fork(void) {
* int rc = -1;
*/
- rc = real_fork();
- if (rc == 0)
- pseudo_client_reset();
-
+ if (real_fork) {
+ rc = real_fork();
+ /* special case: we may want to enable or disable
+ * pseudo in the child process
+ */
+ if (rc == 0) {
+ pseudo_setupenv();
+ pseudo_client_reset();
+ }
+ } else {
+ /* rc was initialized to the "failure" value */
+ pseudo_enosys("fork");
+ }
/* return rc;
* }
*/