On 06/22/2016 06:53 AM, Fam Zheng wrote: > And use it in qemu_dup_flags. > > Signed-off-by: Fam Zheng <[email protected]> > --- > 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 <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
