qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] osdep: Introduce qemu_dup


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] osdep: Introduce qemu_dup
Date: Wed, 22 Jun 2016 09:21:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/22/2016 06:53 AM, Fam Zheng wrote:
> And use it in qemu_dup_flags.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  include/qemu/osdep.h |  3 +++
>  util/osdep.c         | 23 +++++++++++++++--------
>  2 files changed, 18 insertions(+), 8 deletions(-)
> 

> +int qemu_dup(int fd)
> +{
> +    int ret;
> +#ifdef F_DUPFD_CLOEXEC
> +    ret = fcntl(fd, F_DUPFD_CLOEXEC, 0);
> +#else
> +    ret = dup(fd);
> +    if (ret != -1) {
> +        qemu_set_cloexec(ret);
> +    }

Is it any more efficient to try and use dup3(fd, 0, O_CLOEXEC), or are
we assuming that F_DUPFD_CLOEXEC and dup3() are only likely to both be
present or absent?

Otherwise,
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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