aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_wrappers.c
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-12-08 14:12:46 -0600
committerPeter Seebach <peter.seebach@windriver.com>2010-12-13 15:01:41 -0600
commit048cd003f3330f0811a48f79cd9d65bf022757a9 (patch)
tree64d3bc0c6fee0a13def42b47563d2e60181e2379 /pseudo_wrappers.c
parent98f16482f1e5c4b9c9d3b0803d41565a350af53d (diff)
downloadpseudo-048cd003f3330f0811a48f79cd9d65bf022757a9.tar.gz
pseudo-048cd003f3330f0811a48f79cd9d65bf022757a9.tar.bz2
pseudo-048cd003f3330f0811a48f79cd9d65bf022757a9.zip
2010-12-08:
* (mhatle) Add guts/clone.c to cleanup the clone support * (mhatle) guts/clone.c only run setupenv and reinit when NOT PSEUDO_RELOADED * (mhatle) guts/execve.c whitespace fixe * (mhatle) guts/fork.c similar to guts/clone.c change * (mhatle) pseudo_client.c add reinit function * (mhatle) pseudo_client.c revise client reset, include code from pseudo_wrappers.c * (mhatle) pseudo_server.c move the pid writing to the parent * (mhatle) pseudo_wrappers.c clone cleanup and populate cleanup Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'pseudo_wrappers.c')
-rw-r--r--pseudo_wrappers.c72
1 files changed, 12 insertions, 60 deletions
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index 0321fe2..ee1d3ea 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -144,7 +144,6 @@ pseudo_populate_wrappers(void) {
int i;
char *debug;
static int done = 0;
- char *pseudo_path = 0;
char *no_symlink_exp;
if (done)
@@ -206,40 +205,6 @@ pseudo_populate_wrappers(void) {
* value for cwd.
*/
pseudo_client_reset();
- pseudo_path = pseudo_prefix_path(NULL);
- if (pseudo_prefix_dir_fd == -1) {
- if (pseudo_path) {
- pseudo_prefix_dir_fd = open(pseudo_path, O_RDONLY);
- pseudo_prefix_dir_fd = pseudo_fd(pseudo_prefix_dir_fd, MOVE_FD);
- } else {
- pseudo_diag("No prefix available to to find server.\n");
- exit(1);
- }
- if (pseudo_prefix_dir_fd == -1) {
- pseudo_diag("Can't open prefix path (%s) for server: %s\n",
- pseudo_path,
- strerror(errno));
- exit(1);
- }
- }
- free(pseudo_path);
- pseudo_path = pseudo_localstatedir_path(NULL);
- if (pseudo_localstate_dir_fd == -1) {
- if (pseudo_path) {
- pseudo_localstate_dir_fd = open(pseudo_path, O_RDONLY);
- pseudo_localstate_dir_fd = pseudo_fd(pseudo_localstate_dir_fd, MOVE_FD);
- } else {
- pseudo_diag("No prefix available to to find server.\n");
- exit(1);
- }
- if (pseudo_localstate_dir_fd == -1) {
- pseudo_diag("Can't open prefix path (%s) for server: %s\n",
- pseudo_path,
- strerror(errno));
- exit(1);
- }
- }
- free(pseudo_path);
pseudo_debug(2, "(%s) set up wrappers\n", program_invocation_short_name);
pseudo_magic();
pseudo_droplock();
@@ -537,32 +502,17 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) {
* 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) {
- pseudo_setupenv();
- pseudo_client_reset();
- /* call the real syscall */
- rc = (*real_clone)(fn, child_stack, flags, arg, pid, tls, ctid);
-
- /* if we got here, we're the parent process. And if we changed
- * pseudo_disabled because of the environment, now we want to
- * bring it back. We can't use the normal path for this in
- * pseudo_client_reset() because that would trust the environment
- * variable, which was intended only to modify the behavior of
- * the child process.
- */
- if (save_disabled != pseudo_disabled) {
- if (pseudo_disabled) {
- pseudo_disabled = 0;
- pseudo_magic();
- } else {
- pseudo_disabled = 1;
- pseudo_antimagic();
- }
+
+#include "guts/clone.c"
+
+ if (save_disabled != pseudo_disabled) {
+ if (pseudo_disabled) {
+ pseudo_disabled = 0;
+ pseudo_magic();
+ } else {
+ pseudo_disabled = 1;
+ pseudo_antimagic();
}
- } else {
- /* rc was initialized to the "failure" value */
- pseudo_enosys("clone");
}
save_errno = errno;
@@ -583,9 +533,11 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) {
}
static int (*real_fork)(void) = NULL;
+#if 0
static int (*real_execlp)(const char *file, const char *arg, ...) = NULL;
static int (*real_execl)(const char *file, const char *arg, ...) = NULL;
static int (*real_execle)(const char *file, const char *arg, ...) = NULL;
+#endif
static int (*real_clone)(int (*)(void *), void *, int, void *, ...) = NULL;
static int