aboutsummaryrefslogtreecommitdiffstats
path: root/guts/clone.c
blob: 61c8bf9c60009b12121701013b8acb293eb534e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
 * }
 */