qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: andrzej zaborowski
Subject: Re: [Qemu-devel] [PATCH] Fix vfork() syscall emulation
Date: Sat, 20 Sep 2008 14:45:57 +0200

2008/9/20 Kirill A. Shutemov <address@hidden>:
> On Sat, Sep 20, 2008 at 04:56:45AM +0200, andrzej zaborowski wrote:
>> 2008/9/18 Kirill A. Shutemov <address@hidden>:
>> > 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.

Do you mean that's the current behavior in qemu?  That's not what clone(2) says.

>
>> 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

Well, that's libc. clone with CLONE_VFORK and without it are still not
the same thing.  CLONE_VM and CLONE_VFORK are ortogonal to one
another, not the opposite of.

Cheers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]