From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFjxx-0007OP-SW for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:21:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFjxw-00036O-Pf for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:21:21 -0400 References: <20160622125320.31279-1-famz@redhat.com> <20160622125320.31279-2-famz@redhat.com> From: Eric Blake Message-ID: <576AACE8.5090506@redhat.com> Date: Wed, 22 Jun 2016 09:21:12 -0600 MIME-Version: 1.0 In-Reply-To: <20160622125320.31279-2-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iqf8PW1fnTrCFhDhJ94roQ0hxePxIDLJA" Subject: Re: [Qemu-devel] [PATCH v2 1/2] osdep: Introduce qemu_dup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iqf8PW1fnTrCFhDhJ94roQ0hxePxIDLJA From: Eric Blake To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Max Reitz Message-ID: <576AACE8.5090506@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/2] osdep: Introduce qemu_dup References: <20160622125320.31279-1-famz@redhat.com> <20160622125320.31279-2-famz@redhat.com> In-Reply-To: <20160622125320.31279-2-famz@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/22/2016 06:53 AM, Fam Zheng wrote: > And use it in qemu_dup_flags. >=20 > Signed-off-by: Fam Zheng > --- > include/qemu/osdep.h | 3 +++ > util/osdep.c | 23 +++++++++++++++-------- > 2 files changed, 18 insertions(+), 8 deletions(-) >=20 > +int qemu_dup(int fd) > +{ > + int ret; > +#ifdef F_DUPFD_CLOEXEC > + ret =3D fcntl(fd, F_DUPFD_CLOEXEC, 0); > +#else > + ret =3D dup(fd); > + if (ret !=3D -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 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --iqf8PW1fnTrCFhDhJ94roQ0hxePxIDLJA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXaqzoAAoJEKeha0olJ0Nqk3gH/i0ST7es08HDHcZfJtbuKFSv nytSEOKcdGrQg6S9k5lTSR9byiefPos51nZnGEQfx2Fepcda+dFzx0pM6scInc1L HBebYVjuMd11Qr4zPTzv5mEN3FAzKjQ4SrxBeXq0KfapWOD8LP8JvBQBefd3yw4o j3GvHANqWINgisl4N/k9HhiFTTM0B8jjP5BdWtqYkHV2I4xRc4siVWR885pyDq0s rVlvIL+xv/9gqj0l8auvSmENrn3qd4dR1rb+sECaQ8hJ8BMbuI6BevfqWhp7KSP0 zxV6EtW75EBO6N1EN9oMAH9WXvdC1P1NR8e8lDO65iKraY+bpWgjRx2aXHcEL4Q= =f9co -----END PGP SIGNATURE----- --iqf8PW1fnTrCFhDhJ94roQ0hxePxIDLJA--