linux_machdep.c (166188) | linux_machdep.c (166395) |
---|---|
1/*- 2 * Copyright (c) 2000 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/i386/linux/linux_machdep.c 166188 2007-01-23 08:46:51Z jeff $"); | 30__FBSDID("$FreeBSD: head/sys/i386/linux/linux_machdep.c 166395 2007-02-01 13:27:52Z kib $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/file.h> 35#include <sys/fcntl.h> 36#include <sys/imgact.h> 37#include <sys/lock.h> 38#include <sys/malloc.h> --- 394 unchanged lines hidden (view full) --- 433 * between those processes and fd locking. 434 */ 435 if ((args->flags & 0xffffff00) == THREADING_FLAGS) 436 ff |= RFTHREAD; 437 438 error = fork1(td, ff, 0, &p2); 439 if (error) 440 return (error); | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/file.h> 35#include <sys/fcntl.h> 36#include <sys/imgact.h> 37#include <sys/lock.h> 38#include <sys/malloc.h> --- 394 unchanged lines hidden (view full) --- 433 * between those processes and fd locking. 434 */ 435 if ((args->flags & 0xffffff00) == THREADING_FLAGS) 436 ff |= RFTHREAD; 437 438 error = fork1(td, ff, 0, &p2); 439 if (error) 440 return (error); |
441 442 if (args->flags & (CLONE_PARENT|CLONE_THREAD)) { 443 sx_xlock(&proctree_lock); 444 PROC_LOCK(p2); 445 proc_reparent(p2, td->td_proc->p_pptr); 446 PROC_UNLOCK(p2); 447 sx_xunlock(&proctree_lock); 448 } |
|
441 442 /* create the emuldata */ 443 error = linux_proc_init(td, p2->p_pid, args->flags); 444 /* reference it - no need to check this */ 445 em = em_find(p2, EMUL_DOLOCK); 446 KASSERT(em != NULL, ("clone: emuldata not found.\n")); 447 /* and adjust it */ 448 if (args->flags & CLONE_PARENT_SETTID) { 449 if (args->parent_tidptr == NULL) { 450 EMUL_UNLOCK(&emul_lock); 451 return (EINVAL); 452 } 453 error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); 454 if (error) { 455 EMUL_UNLOCK(&emul_lock); 456 return (error); 457 } 458 } 459 | 449 450 /* create the emuldata */ 451 error = linux_proc_init(td, p2->p_pid, args->flags); 452 /* reference it - no need to check this */ 453 em = em_find(p2, EMUL_DOLOCK); 454 KASSERT(em != NULL, ("clone: emuldata not found.\n")); 455 /* and adjust it */ 456 if (args->flags & CLONE_PARENT_SETTID) { 457 if (args->parent_tidptr == NULL) { 458 EMUL_UNLOCK(&emul_lock); 459 return (EINVAL); 460 } 461 error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); 462 if (error) { 463 EMUL_UNLOCK(&emul_lock); 464 return (error); 465 } 466 } 467 |
460 if (args->flags & (CLONE_PARENT|CLONE_THREAD)) { 461 sx_xlock(&proctree_lock); 462 PROC_LOCK(p2); 463 proc_reparent(p2, td->td_proc->p_pptr); 464 PROC_UNLOCK(p2); 465 sx_xunlock(&proctree_lock); 466 } 467 | |
468 if (args->flags & CLONE_THREAD) { 469 /* XXX: linux mangles pgrp and pptr somehow 470 * I think it might be this but I am not sure. 471 */ 472#ifdef notyet 473 PROC_LOCK(p2); 474 p2->p_pgrp = td->td_proc->p_pgrp; 475 PROC_UNLOCK(p2); --- 836 unchanged lines hidden --- | 468 if (args->flags & CLONE_THREAD) { 469 /* XXX: linux mangles pgrp and pptr somehow 470 * I think it might be this but I am not sure. 471 */ 472#ifdef notyet 473 PROC_LOCK(p2); 474 p2->p_pgrp = td->td_proc->p_pgrp; 475 PROC_UNLOCK(p2); --- 836 unchanged lines hidden --- |