linux_machdep.c (169458) | linux_machdep.c (170307) |
---|---|
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 169458 2007-05-11 01:25:51Z kan $"); | 30__FBSDID("$FreeBSD: head/sys/i386/linux/linux_machdep.c 170307 2007-06-05 00:00:57Z jeff $"); |
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> --- 281 unchanged lines hidden (view full) --- 320 if (error) 321 return (error); 322 323 td2 = FIRST_THREAD_IN_PROC(p2); 324 325 /* 326 * Make this runnable after we are finished with it. 327 */ | 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> --- 281 unchanged lines hidden (view full) --- 320 if (error) 321 return (error); 322 323 td2 = FIRST_THREAD_IN_PROC(p2); 324 325 /* 326 * Make this runnable after we are finished with it. 327 */ |
328 mtx_lock_spin(&sched_lock); | 328 thread_lock(td2); |
329 TD_SET_CAN_RUN(td2); 330 sched_add(td2, SRQ_BORING); | 329 TD_SET_CAN_RUN(td2); 330 sched_add(td2, SRQ_BORING); |
331 mtx_unlock_spin(&sched_lock); | 331 thread_unlock(td2); |
332 333 return (0); 334} 335 336int 337linux_vfork(struct thread *td, struct linux_vfork_args *args) 338{ 339 int error; --- 23 unchanged lines hidden (view full) --- 363 p2->p_flag |= P_PPWAIT; 364 PROC_UNLOCK(p2); 365 366 td2 = FIRST_THREAD_IN_PROC(p2); 367 368 /* 369 * Make this runnable after we are finished with it. 370 */ | 332 333 return (0); 334} 335 336int 337linux_vfork(struct thread *td, struct linux_vfork_args *args) 338{ 339 int error; --- 23 unchanged lines hidden (view full) --- 363 p2->p_flag |= P_PPWAIT; 364 PROC_UNLOCK(p2); 365 366 td2 = FIRST_THREAD_IN_PROC(p2); 367 368 /* 369 * Make this runnable after we are finished with it. 370 */ |
371 mtx_lock_spin(&sched_lock); | 371 thread_lock(td2); |
372 TD_SET_CAN_RUN(td2); 373 sched_add(td2, SRQ_BORING); | 372 TD_SET_CAN_RUN(td2); 373 sched_add(td2, SRQ_BORING); |
374 mtx_unlock_spin(&sched_lock); | 374 thread_unlock(td2); |
375 376 /* wait for the children to exit, ie. emulate vfork */ 377 PROC_LOCK(p2); 378 while (p2->p_flag & P_PPWAIT) 379 msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0); 380 PROC_UNLOCK(p2); 381 382 return (0); --- 181 unchanged lines hidden (view full) --- 564 PROC_LOCK(p2); 565 p2->p_flag |= P_PPWAIT; 566 PROC_UNLOCK(p2); 567 } 568 569 /* 570 * Make this runnable after we are finished with it. 571 */ | 375 376 /* wait for the children to exit, ie. emulate vfork */ 377 PROC_LOCK(p2); 378 while (p2->p_flag & P_PPWAIT) 379 msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0); 380 PROC_UNLOCK(p2); 381 382 return (0); --- 181 unchanged lines hidden (view full) --- 564 PROC_LOCK(p2); 565 p2->p_flag |= P_PPWAIT; 566 PROC_UNLOCK(p2); 567 } 568 569 /* 570 * Make this runnable after we are finished with it. 571 */ |
572 mtx_lock_spin(&sched_lock); | 572 thread_lock(td2); |
573 TD_SET_CAN_RUN(td2); 574 sched_add(td2, SRQ_BORING); | 573 TD_SET_CAN_RUN(td2); 574 sched_add(td2, SRQ_BORING); |
575 mtx_unlock_spin(&sched_lock); | 575 thread_unlock(td2); |
576 577 td->td_retval[0] = p2->p_pid; 578 td->td_retval[1] = 0; 579 580 if (args->flags & LINUX_CLONE_VFORK) { 581 /* wait for the children to exit, ie. emulate vfork */ 582 PROC_LOCK(p2); 583 while (p2->p_flag & P_PPWAIT) --- 741 unchanged lines hidden --- | 576 577 td->td_retval[0] = p2->p_pid; 578 td->td_retval[1] = 0; 579 580 if (args->flags & LINUX_CLONE_VFORK) { 581 /* wait for the children to exit, ie. emulate vfork */ 582 PROC_LOCK(p2); 583 while (p2->p_flag & P_PPWAIT) --- 741 unchanged lines hidden --- |