From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMLMi-0006oL-BS for qemu-devel@nongnu.org; Thu, 11 Oct 2012 12:12:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMLMY-0002zu-RL for qemu-devel@nongnu.org; Thu, 11 Oct 2012 12:12:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18806) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMLMY-0002zn-Hl for qemu-devel@nongnu.org; Thu, 11 Oct 2012 12:11:54 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9BGBrLA031724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Oct 2012 12:11:53 -0400 Message-ID: <5076EFC3.1040005@redhat.com> Date: Thu, 11 Oct 2012 10:11:47 -0600 From: Eric Blake MIME-Version: 1.0 References: <1349878805-16352-1-git-send-email-coreyb@linux.vnet.ibm.com> <1349878805-16352-4-git-send-email-coreyb@linux.vnet.ibm.com> <5075F727.1060608@redhat.com> <5076EDF4.1010301@redhat.com> In-Reply-To: <5076EDF4.1010301@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig13F5EB508F9E9B591C36305B" Subject: Re: [Qemu-devel] [libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, libvir-list@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig13F5EB508F9E9B591C36305B Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/11/2012 10:04 AM, Eric Blake wrote: > Another idea: a hybrid approach - the _first_ -add-fd 4 directly adds 4= > to the set, all other -add-fd 4 end up adding dup(4) instead (well, > fcntl(F_DUPFD_CLOEXEC), but you get the picture). That is, do the > duplicate scanning, and if there is no duplicate, use the fd directly; > if there IS a duplicate, then put a unique fd number as a copy into the= > remaining sets. That way, you don't have to do a final close() sweep > across the -add-fd arguments passed on the command line, and you still > don't have to worry about duplicated fds across multiple sets causing > mayhem in qemu_close(). Hmm, you may also need to be careful of corner cases. If I do: qemu -add-fd fd=3D4,set=3D1 -add-fd fd=3D4,set=3D2 -add-fd fd=3D5,set=3D3= 5<&- with fd 5 not inherited, then a dup(4) would give 5; you don't want to accidentally add a copy of fd 4 into set 3, but rather fail because fd 5 was not inherited. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig13F5EB508F9E9B591C36305B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQdu/DAAoJEKeha0olJ0Nq2U8H/iF9/uEKMq41q2JGFA+/mhXJ ppDZqG4NehU5Vd2wCDy0m8l3H2r1ZiXCfK8/zp2ihSESxiJeKa4qwDhO5Rk9bSCW 8UNEFeZExkrMvtBF8OLxb0wHa/jWmL8v7FEUoLvDL3IurkK93Ay6+e60hHkIvofI k7ggoS700NeidPE+aZOkRfl7BFgPq/YyUNP9WGggYnD5a4YXls0048oKg6sBPUwe vGkgGbst0y+HQ2LvGKIazHZfIMa9+Xha5FoGgrxZY/b+2jAQNg78IIkAAS1bWMwS OmS7Au2EKfFu/AWfWADVkCLCYQLZisNS6Nlw29T8XMdcNVglPIPl39/nITzGhFA= =4j9M -----END PGP SIGNATURE----- --------------enig13F5EB508F9E9B591C36305B--