Am 11.10.2012 17:04, schrieb Corey Bryant:
On 10/11/2012 07:25 AM, Kevin Wolf wrote:
> Am 10.10.2012 16:20, schrieb Corey Bryant:
>> qmp_add_fd() gets an fd that was received over a socket with
>> SCM_RIGHTS and adds it to an fd set. This patch adds support
>> that will enable adding an fd that was inherited on the
>> command line to an fd set.
>>
>> This patch also prevents removal of an fd from an fd set during
>> initialization. This allows the fd to remain in the fd set after
>> probing of the image file.
>
> "This patch also..." usually means that it should be split in two
> patches. Though in this case I'd vote for immediately dropping the
> second patch again: This makes the probing work with file descriptors
> using a hack for a certain situation (namely qemu startup) and leaves
> other cases (like hotplug) broken.
I don't think hotplug is broken. In that case the fd will only be
removed from the fd set if the following is true:
(mon_fdset_fd->removed || (QLIST_EMPTY(&mon_fdset->dup_fds) &&
mon_refcount == 0))
We can ignore the removed part for now. What's important here is that
if there are no dup_fd references and there is at least one monitor
connected, an fd will *not* be removed.
Ah yes, that's the part I missed.
Then your approach of special-casing the command line is probably okay,
though I'd still want to change the probing mechanism to avoid the
reopen. Seems I need to find a better excuse to make someone do it. Meh. ;-)
Kevin