Home | History | Annotate | Line # | Download | only in common
linux_exec.c revision 1.95.12.2
      1  1.95.12.1    bouyer /*	$NetBSD: linux_exec.c,v 1.95.12.2 2007/11/18 19:35:11 bouyer Exp $	*/
      2       1.29  christos 
      3       1.29  christos /*-
      4       1.91        ad  * Copyright (c) 1994, 1995, 1998, 2000, 2007 The NetBSD Foundation, Inc.
      5       1.29  christos  * All rights reserved.
      6       1.29  christos  *
      7       1.29  christos  * This code is derived from software contributed to The NetBSD Foundation
      8       1.33      fvdl  * by Christos Zoulas, Frank van der Linden, Eric Haszlakiewicz and
      9       1.33      fvdl  * Thor Lancelot Simon.
     10       1.29  christos  *
     11       1.29  christos  * Redistribution and use in source and binary forms, with or without
     12       1.29  christos  * modification, are permitted provided that the following conditions
     13       1.29  christos  * are met:
     14       1.29  christos  * 1. Redistributions of source code must retain the above copyright
     15       1.29  christos  *    notice, this list of conditions and the following disclaimer.
     16       1.29  christos  * 2. Redistributions in binary form must reproduce the above copyright
     17       1.29  christos  *    notice, this list of conditions and the following disclaimer in the
     18       1.29  christos  *    documentation and/or other materials provided with the distribution.
     19       1.29  christos  * 3. All advertising materials mentioning features or use of this software
     20       1.29  christos  *    must display the following acknowledgement:
     21       1.29  christos  *        This product includes software developed by the NetBSD
     22       1.29  christos  *        Foundation, Inc. and its contributors.
     23       1.29  christos  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24       1.29  christos  *    contributors may be used to endorse or promote products derived
     25       1.29  christos  *    from this software without specific prior written permission.
     26       1.29  christos  *
     27       1.29  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28       1.29  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29       1.29  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30       1.29  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31       1.29  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32       1.29  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33       1.29  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34       1.29  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35       1.29  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36       1.29  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37       1.29  christos  * POSSIBILITY OF SUCH DAMAGE.
     38        1.1      fvdl  */
     39       1.54     lukem 
     40       1.54     lukem #include <sys/cdefs.h>
     41  1.95.12.1    bouyer __KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.95.12.2 2007/11/18 19:35:11 bouyer Exp $");
     42        1.1      fvdl 
     43        1.1      fvdl #include <sys/param.h>
     44        1.1      fvdl #include <sys/systm.h>
     45        1.1      fvdl #include <sys/kernel.h>
     46        1.1      fvdl #include <sys/proc.h>
     47        1.1      fvdl #include <sys/malloc.h>
     48        1.1      fvdl #include <sys/namei.h>
     49        1.1      fvdl #include <sys/vnode.h>
     50       1.13  christos #include <sys/mount.h>
     51       1.25  christos #include <sys/exec.h>
     52        1.8      fvdl #include <sys/exec_elf.h>
     53        1.1      fvdl 
     54        1.1      fvdl #include <sys/mman.h>
     55       1.13  christos #include <sys/syscallargs.h>
     56        1.1      fvdl 
     57       1.85      manu #include <sys/ptrace.h>	/* For proc_reparent() */
     58       1.85      manu 
     59       1.73      fvdl #include <uvm/uvm_extern.h>
     60       1.73      fvdl 
     61  1.95.12.1    bouyer #include <sys/cpu.h>
     62        1.1      fvdl #include <machine/reg.h>
     63        1.1      fvdl 
     64       1.32  christos #include <compat/linux/common/linux_types.h>
     65       1.32  christos #include <compat/linux/common/linux_signal.h>
     66       1.32  christos #include <compat/linux/common/linux_util.h>
     67       1.85      manu #include <compat/linux/common/linux_sched.h>
     68       1.85      manu #include <compat/linux/common/linux_machdep.h>
     69       1.32  christos #include <compat/linux/common/linux_exec.h>
     70       1.78      manu #include <compat/linux/common/linux_futex.h>
     71  1.95.12.1    bouyer #include <compat/linux/common/linux_ipc.h>
     72  1.95.12.1    bouyer #include <compat/linux/common/linux_sem.h>
     73       1.32  christos 
     74       1.32  christos #include <compat/linux/linux_syscallargs.h>
     75        1.4  christos #include <compat/linux/linux_syscall.h>
     76       1.38  jdolecek #include <compat/linux/common/linux_misc.h>
     77       1.38  jdolecek #include <compat/linux/common/linux_errno.h>
     78       1.39  jdolecek #include <compat/linux/common/linux_emuldata.h>
     79        1.8      fvdl 
     80       1.38  jdolecek extern struct sysent linux_sysent[];
     81       1.38  jdolecek extern const char * const linux_syscallnames[];
     82       1.38  jdolecek extern char linux_sigcode[], linux_esigcode[];
     83        1.1      fvdl 
     84       1.39  jdolecek static void linux_e_proc_exec __P((struct proc *, struct exec_package *));
     85       1.71  jdolecek static void linux_e_proc_fork __P((struct proc *, struct proc *, int));
     86       1.39  jdolecek static void linux_e_proc_exit __P((struct proc *));
     87       1.71  jdolecek static void linux_e_proc_init __P((struct proc *, struct proc *, int));
     88       1.39  jdolecek 
     89       1.79      manu #ifdef LINUX_NPTL
     90       1.91        ad void linux_userret(void);
     91       1.79      manu #endif
     92       1.77      manu 
     93        1.1      fvdl /*
     94       1.38  jdolecek  * Emulation switch.
     95       1.38  jdolecek  */
     96       1.65       chs 
     97       1.65       chs struct uvm_object *emul_linux_object;
     98       1.65       chs 
     99       1.38  jdolecek const struct emul emul_linux = {
    100       1.38  jdolecek 	"linux",
    101       1.40  jdolecek 	"/emul/linux",
    102       1.44   mycroft #ifndef __HAVE_MINIMAL_EMUL
    103       1.51      manu 	0,
    104       1.76   tsutsui 	(const int *)native_to_linux_errno,
    105       1.38  jdolecek 	LINUX_SYS_syscall,
    106       1.60  jdolecek 	LINUX_SYS_NSYSENT,
    107       1.44   mycroft #endif
    108       1.38  jdolecek 	linux_sysent,
    109       1.38  jdolecek 	linux_syscallnames,
    110       1.44   mycroft 	linux_sendsig,
    111       1.52  christos 	linux_trapsignal,
    112       1.70      fvdl 	NULL,
    113       1.38  jdolecek 	linux_sigcode,
    114       1.38  jdolecek 	linux_esigcode,
    115       1.65       chs 	&emul_linux_object,
    116       1.53  jdolecek 	linux_setregs,
    117       1.39  jdolecek 	linux_e_proc_exec,
    118       1.39  jdolecek 	linux_e_proc_fork,
    119       1.39  jdolecek 	linux_e_proc_exit,
    120       1.69      manu 	NULL,
    121       1.69      manu 	NULL,
    122       1.44   mycroft #ifdef __HAVE_SYSCALL_INTERN
    123       1.44   mycroft 	linux_syscall_intern,
    124       1.42  jdolecek #else
    125       1.62   thorpej #error Implement __HAVE_SYSCALL_INTERN for this platform
    126       1.41  jdolecek #endif
    127       1.67    atatat 	NULL,
    128       1.59      manu 	NULL,
    129       1.73      fvdl 
    130       1.74  christos 	uvm_default_mapaddr,
    131       1.75      fvdl 
    132       1.75      fvdl 	linux_usertrap,
    133       1.90        ad 	0,
    134       1.92      cube 	NULL,		/* e_startlwp */
    135       1.38  jdolecek };
    136       1.39  jdolecek 
    137       1.39  jdolecek static void
    138       1.71  jdolecek linux_e_proc_init(p, parent, forkflags)
    139       1.71  jdolecek 	struct proc *p, *parent;
    140       1.71  jdolecek 	int forkflags;
    141       1.39  jdolecek {
    142       1.71  jdolecek 	struct linux_emuldata *e = p->p_emuldata;
    143       1.71  jdolecek 	struct linux_emuldata_shared *s;
    144       1.77      manu 	struct linux_emuldata *ep = NULL;
    145       1.71  jdolecek 
    146       1.71  jdolecek 	if (!e) {
    147       1.39  jdolecek 		/* allocate new Linux emuldata */
    148       1.71  jdolecek 		MALLOC(e, void *, sizeof(struct linux_emuldata),
    149       1.71  jdolecek 			M_EMULDATA, M_WAITOK);
    150       1.71  jdolecek 	} else  {
    151       1.72  jdolecek 		e->s->refs--;
    152       1.71  jdolecek 		if (e->s->refs == 0)
    153       1.71  jdolecek 			FREE(e->s, M_EMULDATA);
    154       1.71  jdolecek 	}
    155       1.71  jdolecek 
    156       1.71  jdolecek 	memset(e, '\0', sizeof(struct linux_emuldata));
    157       1.71  jdolecek 
    158       1.84      manu 	e->proc = p;
    159       1.84      manu 
    160       1.77      manu 	if (parent)
    161       1.77      manu 		ep = parent->p_emuldata;
    162       1.77      manu 
    163       1.72  jdolecek 	if (forkflags & FORK_SHAREVM) {
    164       1.77      manu #ifdef DIAGNOSTIC
    165       1.77      manu 		if (ep == NULL) {
    166       1.77      manu 			killproc(p, "FORK_SHAREVM while emuldata is NULL\n");
    167       1.87  christos 			FREE(e, M_EMULDATA);
    168       1.77      manu 			return;
    169       1.77      manu 		}
    170       1.77      manu #endif
    171       1.77      manu 		s = ep->s;
    172       1.71  jdolecek 		s->refs++;
    173       1.71  jdolecek 	} else {
    174       1.71  jdolecek 		struct vmspace *vm;
    175       1.71  jdolecek 
    176       1.71  jdolecek 		MALLOC(s, void *, sizeof(struct linux_emuldata_shared),
    177       1.39  jdolecek 			M_EMULDATA, M_WAITOK);
    178       1.71  jdolecek 		s->refs = 1;
    179       1.71  jdolecek 
    180       1.71  jdolecek 		/*
    181       1.71  jdolecek 		 * Set the process idea of the break to the real value.
    182       1.71  jdolecek 		 * For fork, we use parent's vmspace since our's
    183       1.71  jdolecek 		 * is not setup at the time of this call and is going
    184       1.71  jdolecek 		 * to be copy of parent's anyway. For exec, just
    185       1.71  jdolecek 		 * use our own vmspace.
    186       1.71  jdolecek 		 */
    187       1.71  jdolecek 		vm = (parent) ? parent->p_vmspace : p->p_vmspace;
    188       1.93  christos 		s->p_break = (char *)vm->vm_daddr + ctob(vm->vm_dsize);
    189       1.71  jdolecek 
    190       1.77      manu 		/*
    191       1.77      manu 		 * Linux threads are emulated as NetBSD processes (not lwp)
    192       1.77      manu 		 * We use native PID for Linux TID. The Linux TID is the
    193       1.77      manu 		 * PID of the first process in the group. It is stored
    194       1.77      manu 		 * here
    195       1.77      manu 		 */
    196       1.77      manu 		s->group_pid = p->p_pid;
    197       1.84      manu 
    198       1.84      manu 		/*
    199       1.84      manu 		 * Initialize the list of threads in the group
    200       1.84      manu 		 */
    201       1.84      manu 		LIST_INIT(&s->threads);
    202       1.85      manu 
    203       1.85      manu 		s->xstat = 0;
    204       1.85      manu 		s->flags = 0;
    205       1.39  jdolecek 	}
    206       1.39  jdolecek 
    207       1.71  jdolecek 	e->s = s;
    208       1.77      manu 
    209       1.84      manu 	/*
    210       1.84      manu 	 * Add this thread in the group thread list
    211       1.84      manu 	 */
    212       1.84      manu 	LIST_INSERT_HEAD(&s->threads, e, threads);
    213       1.84      manu 
    214       1.79      manu #ifdef LINUX_NPTL
    215       1.77      manu 	if (ep != NULL) {
    216       1.85      manu 		e->parent_tidptr = ep->parent_tidptr;
    217       1.85      manu 		e->child_tidptr = ep->child_tidptr;
    218       1.85      manu 		e->clone_flags = ep->clone_flags;
    219       1.77      manu 	}
    220       1.79      manu #endif /* LINUX_NPTL */
    221       1.77      manu 
    222       1.71  jdolecek 	p->p_emuldata = e;
    223       1.48  jdolecek }
    224       1.48  jdolecek 
    225       1.48  jdolecek /*
    226       1.71  jdolecek  * Allocate new per-process structures. Called when executing Linux
    227       1.48  jdolecek  * process. We can reuse the old emuldata - if it's not null,
    228       1.48  jdolecek  * the executed process is of same emulation as original forked one.
    229       1.48  jdolecek  */
    230       1.48  jdolecek static void
    231       1.89  christos linux_e_proc_exec(struct proc *p, struct exec_package *epp)
    232       1.48  jdolecek {
    233       1.48  jdolecek 	/* exec, use our vmspace */
    234       1.71  jdolecek 	linux_e_proc_init(p, NULL, 0);
    235       1.39  jdolecek }
    236       1.39  jdolecek 
    237       1.39  jdolecek /*
    238       1.39  jdolecek  * Emulation per-process exit hook.
    239       1.39  jdolecek  */
    240       1.39  jdolecek static void
    241       1.39  jdolecek linux_e_proc_exit(p)
    242       1.39  jdolecek 	struct proc *p;
    243       1.39  jdolecek {
    244       1.71  jdolecek 	struct linux_emuldata *e = p->p_emuldata;
    245       1.71  jdolecek 
    246       1.79      manu #ifdef LINUX_NPTL
    247       1.85      manu 	linux_nptl_proc_exit(p);
    248       1.84      manu #endif
    249       1.84      manu 	/* Remove the thread for the group thread list */
    250       1.84      manu 	LIST_REMOVE(e, threads);
    251       1.84      manu 
    252       1.39  jdolecek 	/* free Linux emuldata and set the pointer to null */
    253       1.71  jdolecek 	e->s->refs--;
    254       1.71  jdolecek 	if (e->s->refs == 0)
    255       1.71  jdolecek 		FREE(e->s, M_EMULDATA);
    256       1.71  jdolecek 	FREE(e, M_EMULDATA);
    257       1.39  jdolecek 	p->p_emuldata = NULL;
    258       1.39  jdolecek }
    259       1.39  jdolecek 
    260       1.39  jdolecek /*
    261       1.39  jdolecek  * Emulation fork hook.
    262       1.39  jdolecek  */
    263       1.39  jdolecek static void
    264       1.71  jdolecek linux_e_proc_fork(p, parent, forkflags)
    265       1.39  jdolecek 	struct proc *p, *parent;
    266       1.71  jdolecek 	int forkflags;
    267       1.39  jdolecek {
    268       1.39  jdolecek 	/*
    269       1.71  jdolecek 	 * The new process might share some vmspace-related stuff
    270       1.71  jdolecek 	 * with parent, depending on fork flags (CLONE_VM et.al).
    271       1.71  jdolecek 	 * Force allocation of new base emuldata, and share the
    272       1.71  jdolecek 	 * VM-related parts only if necessary.
    273       1.39  jdolecek 	 */
    274       1.39  jdolecek 	p->p_emuldata = NULL;
    275       1.71  jdolecek 	linux_e_proc_init(p, parent, forkflags);
    276       1.77      manu 
    277       1.79      manu #ifdef LINUX_NPTL
    278       1.91        ad 	linux_nptl_proc_fork(p, parent, linux_userret);
    279       1.79      manu #endif
    280       1.77      manu 
    281       1.77      manu 	return;
    282       1.77      manu }
    283       1.77      manu 
    284       1.79      manu #ifdef LINUX_NPTL
    285       1.85      manu void
    286       1.91        ad linux_userret(void)
    287       1.77      manu {
    288       1.91        ad 	struct lwp *l = curlwp;
    289       1.77      manu 	struct proc *p = l->l_proc;
    290       1.77      manu 	struct linux_emuldata *led = p->p_emuldata;
    291       1.77      manu 	int error;
    292       1.77      manu 
    293       1.85      manu 	/* LINUX_CLONE_CHILD_SETTID: copy child's TID to child's memory  */
    294       1.85      manu 	if (led->clone_flags & LINUX_CLONE_CHILD_SETTID) {
    295       1.85      manu 		if ((error = copyout(&l->l_proc->p_pid,
    296       1.85      manu 		    led->child_tidptr,  sizeof(l->l_proc->p_pid))) != 0)
    297       1.85      manu 			printf("linux_userret: LINUX_CLONE_CHILD_SETTID "
    298       1.85      manu 			    "failed (led->child_tidptr = %p, p->p_pid = %d)\n",
    299       1.85      manu 			    led->child_tidptr, p->p_pid);
    300       1.79      manu 	}
    301       1.79      manu 
    302       1.85      manu 	/* LINUX_CLONE_SETTLS: allocate a new TLS */
    303       1.85      manu 	if (led->clone_flags & LINUX_CLONE_SETTLS) {
    304       1.85      manu 		if (linux_set_newtls(l, linux_get_newtls(l)) != 0)
    305       1.85      manu 			printf("linux_userret: linux_set_tls failed");
    306       1.77      manu 	}
    307       1.77      manu 
    308       1.77      manu 	return;
    309       1.39  jdolecek }
    310       1.85      manu 
    311       1.85      manu void
    312       1.85      manu linux_nptl_proc_exit(p)
    313       1.85      manu 	struct proc *p;
    314       1.85      manu {
    315       1.85      manu 	struct linux_emuldata *e = p->p_emuldata;
    316       1.91        ad 
    317       1.94        ad 	mutex_enter(&proclist_lock);
    318       1.85      manu 
    319       1.85      manu 	/*
    320       1.85      manu 	 * Check if we are a thread group leader victim of another
    321       1.85      manu 	 * thread doing exit_group(). If we are, change the exit code.
    322       1.85      manu 	 */
    323       1.85      manu 	if ((e->s->group_pid == p->p_pid) &&
    324       1.85      manu 	    (e->s->flags & LINUX_LES_INEXITGROUP)) {
    325       1.85      manu 		p->p_xstat = e->s->xstat;
    326       1.85      manu 	}
    327       1.85      manu 
    328       1.85      manu 	/*
    329       1.85      manu 	 * Members of the thread groups others than the leader should
    330       1.85      manu 	 * exit quietely: no zombie stage, no signal. We do that by
    331       1.85      manu 	 * reparenting to init. init will collect us and nobody will
    332       1.85      manu 	 * notice what happened.
    333       1.85      manu 	 */
    334       1.85      manu #ifdef DEBUG_LINUX
    335       1.85      manu 	printf("%s:%d e->s->group_pid = %d, p->p_pid = %d, flags = 0x%x\n",
    336       1.85      manu 	    __func__, __LINE__, e->s->group_pid, p->p_pid, e->s->flags);
    337       1.85      manu #endif
    338       1.85      manu 	if (e->s->group_pid != p->p_pid) {
    339       1.85      manu 		proc_reparent(p, initproc);
    340       1.91        ad 		cv_broadcast(&initproc->p_waitcv);
    341       1.85      manu 	}
    342       1.85      manu 
    343       1.94        ad 	mutex_exit(&proclist_lock);
    344       1.91        ad 
    345       1.85      manu 	/* Emulate LINUX_CLONE_CHILD_CLEARTID */
    346       1.85      manu 	if (e->clear_tid != NULL) {
    347       1.85      manu 		int error;
    348       1.85      manu 		int null = 0;
    349       1.85      manu 		struct linux_sys_futex_args cup;
    350       1.85      manu 		register_t retval;
    351       1.85      manu 
    352       1.85      manu 		error = copyout(&null, e->clear_tid, sizeof(null));
    353       1.85      manu #ifdef DEBUG_LINUX
    354       1.85      manu 		if (error != 0)
    355       1.85      manu 			printf("%s: cannot clear TID\n", __func__);
    356       1.85      manu #endif
    357       1.85      manu 
    358       1.85      manu 		SCARG(&cup, uaddr) = e->clear_tid;
    359       1.85      manu 		SCARG(&cup, op) = LINUX_FUTEX_WAKE;
    360       1.85      manu 		SCARG(&cup, val) = 0x7fffffff; /* Awake everyone */
    361       1.85      manu 		SCARG(&cup, timeout) = NULL;
    362       1.85      manu 		SCARG(&cup, uaddr2) = NULL;
    363       1.85      manu 		SCARG(&cup, val3) = 0;
    364       1.91        ad 		if ((error = linux_sys_futex(curlwp, &cup, &retval)) != 0)
    365       1.85      manu 			printf("%s: linux_sys_futex failed\n", __func__);
    366       1.85      manu 	}
    367       1.85      manu 
    368       1.85      manu 	return;
    369       1.85      manu }
    370       1.85      manu 
    371       1.85      manu void
    372       1.85      manu linux_nptl_proc_fork(p, parent, luserret)
    373       1.85      manu 	struct proc *p;
    374       1.85      manu 	struct proc *parent;
    375       1.91        ad 	void (*luserret)(void);
    376       1.85      manu {
    377       1.85      manu #ifdef LINUX_NPTL
    378       1.85      manu 	struct linux_emuldata *e;
    379       1.85      manu #endif
    380       1.91        ad 
    381       1.85      manu 	e = p->p_emuldata;
    382       1.85      manu 
    383       1.85      manu 	/* LINUX_CLONE_CHILD_CLEARTID: clear TID in child's memory on exit() */
    384       1.85      manu 	if (e->clone_flags & LINUX_CLONE_CHILD_CLEARTID)
    385       1.85      manu 		e->clear_tid = e->child_tidptr;
    386       1.85      manu 
    387       1.85      manu 	/* LINUX_CLONE_PARENT_SETTID: set child's TID in parent's memory */
    388       1.85      manu 	if (e->clone_flags & LINUX_CLONE_PARENT_SETTID) {
    389       1.85      manu 		if (copyout_proc(parent, &p->p_pid,
    390       1.85      manu 		    e->parent_tidptr,  sizeof(p->p_pid)) != 0)
    391       1.85      manu 			printf("%s: LINUX_CLONE_PARENT_SETTID "
    392       1.85      manu 			    "failed (e->parent_tidptr = %p, "
    393       1.85      manu 			    "parent->p_pid = %d, p->p_pid = %d)\n",
    394       1.85      manu 			    __func__, e->parent_tidptr,
    395       1.85      manu 			    parent->p_pid, p->p_pid);
    396       1.85      manu 	}
    397       1.85      manu 
    398       1.85      manu 	/*
    399       1.85      manu 	 * CLONE_CHILD_SETTID and LINUX_CLONE_SETTLS require child's VM
    400       1.85      manu 	 * setup to be completed, we postpone them until userret time.
    401       1.85      manu 	 */
    402       1.85      manu 	if (e->clone_flags &
    403       1.85      manu 	    (LINUX_CLONE_CHILD_CLEARTID | LINUX_CLONE_SETTLS))
    404       1.91        ad 		p->p_userret = luserret;
    405       1.85      manu 
    406       1.85      manu 	return;
    407       1.85      manu }
    408       1.85      manu 
    409       1.85      manu void
    410       1.85      manu linux_nptl_proc_init(p, parent)
    411       1.85      manu 	struct proc *p;
    412       1.85      manu 	struct proc *parent;
    413       1.85      manu {
    414       1.85      manu 	struct linux_emuldata *e = p->p_emuldata;
    415       1.85      manu 	struct linux_emuldata *ep;
    416       1.85      manu 
    417       1.85      manu 	if ((parent != NULL) && (parent->p_emuldata != NULL)) {
    418       1.85      manu 		ep = parent->p_emuldata;
    419       1.85      manu 
    420       1.85      manu 		e->parent_tidptr = ep->parent_tidptr;
    421       1.85      manu 		e->child_tidptr = ep->child_tidptr;
    422       1.85      manu 		e->clone_flags = ep->clone_flags;
    423       1.85      manu 	}
    424       1.85      manu 
    425       1.85      manu 	return;
    426       1.85      manu }
    427       1.85      manu 
    428       1.85      manu 
    429       1.79      manu #endif /* LINUX_NPTL */
    430