kern/131506: pipes in forked procs sometimes hang under Linux
emulation 2.6.16
Roman Divacky
rdivacky at FreeBSD.org
Wed Feb 18 06:12:40 PST 2009
On Wed, Feb 18, 2009 at 02:10:05PM +0000, Takahiro Kurosawa wrote:
> The following reply was made to PR kern/131506; it has been noted by GNATS.
>
> From: Takahiro Kurosawa <takahiro.kurosawa at gmail.com>
> To: Kostik Belousov <kostikbel at gmail.com>
> Cc: bug-followup at freebsd.org
> Subject: Re: kern/131506: pipes in forked procs sometimes hang under Linux
> emulation 2.6.16
> Date: Wed, 18 Feb 2009 23:08:05 +0900
>
> 2009/2/18 Kostik Belousov <kostikbel at gmail.com>:
>
> > Please, resend the patch without base64-encoding, best as a plain/text
> > attachment.
>
> Sure. Sending the patch inline...
> The attachment of my previous mail looks broken to me too.
>
> === sys/amd64/linux32/linux32_machdep.c
> ==================================================================
> --- sys/amd64/linux32/linux32_machdep.c (revision 188741)
> +++ sys/amd64/linux32/linux32_machdep.c (local)
> @@ -560,7 +560,7 @@
> /* wait for the children to exit, ie. emulate vfork */
> PROC_LOCK(p2);
> while (p2->p_flag & P_PPWAIT)
> - msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
> + cv_wait(&p2->p_pwait, &p2->p_mtx);
> PROC_UNLOCK(p2);
>
> return (0);
> @@ -749,7 +749,7 @@
> /* wait for the children to exit, ie. emulate vfork */
> PROC_LOCK(p2);
> while (p2->p_flag & P_PPWAIT)
> - msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
> + cv_wait(&p2->p_pwait, &p2->p_mtx);
> PROC_UNLOCK(p2);
> }
>
> === sys/i386/linux/linux_machdep.c
> ==================================================================
> --- sys/i386/linux/linux_machdep.c (revision 188741)
> +++ sys/i386/linux/linux_machdep.c (local)
> @@ -376,7 +376,7 @@
> /* wait for the children to exit, ie. emulate vfork */
> PROC_LOCK(p2);
> while (p2->p_flag & P_PPWAIT)
> - msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
> + cv_wait(&p2->p_pwait, &p2->p_mtx);
> PROC_UNLOCK(p2);
>
> return (0);
> @@ -581,7 +581,7 @@
> /* wait for the children to exit, ie. emulate vfork */
> PROC_LOCK(p2);
> while (p2->p_flag & P_PPWAIT)
> - msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
> + cv_wait(&p2->p_pwait, &p2->p_mtx);
> PROC_UNLOCK(p2);
> }
looks correct to me... fork1() indeed uses cv_wait() instead of msleep().
it should be changed to cv_wait
More information about the freebsd-emulation
mailing list