qemu-devel@nongnu.org
[Top] [All Lists]

Re: [Qemu-devel] [PATCH] Fix vfork() syscall emulation

Subject: Re: [Qemu-devel] [PATCH] Fix vfork() syscall emulation
From: "Kirill A. Shutemov"
Date: Sat, 20 Sep 2008 09:45:57 +0300
On Sat, Sep 20, 2008 at 04:56:45AM +0200, andrzej zaborowski wrote:
> 2008/9/18 Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>:
> > vfork() is a kind of fork, not thread despite CLONE_VM
> 
> According to clone(2) it can be either, the only difference is that
> vfork() suspends the parent process.  So if CLONE_VM is set, I think
> still the pthread / clone way should be used and the child thread
> should be waited on.

vfork() suspends the parent process until a call of execve(2) or _exit(2).
If child call execnv(2) it replaces whole process, not only the thread.
If child call _exit(2) it stops while process, not only the thread.

> On the other hand the patch makes fork() and vfork() be treated identically?

$ cat usr/klibc/vfork.c
/*
 * vfork.c
 *
 * Emulate vfork() with fork() if necessary
 */

#include <unistd.h>
#include <klibc/compiler.h>
#include <klibc/sysconfig.h>

#if !_KLIBC_NO_MMU && !_KLIBC_REAL_VFORK
int vfork(void)
{
        return fork();
}
#endif

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/
<Prev in Thread] Current Thread [Next in Thread>