qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] qemu-ga: obey LISTEN_PID when using systemd


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2] qemu-ga: obey LISTEN_PID when using systemd socket activation
Date: Fri, 17 Mar 2017 11:57:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0


On 17/03/2017 10:41, Stefan Hajnoczi wrote:
>> Luckily, qemu-nbd also got socket activation code, and its copy does
>> support LISTEN_PID.  Some extra fixups are needed to ensure that the
>> code can be used for both, but that's what this patch does.  The
>> main change is to replace get_listen_fds's "consume" argument with
>> the FIRST_SOCKET_ACTIVATION_FD macro from the qemu-nbd code.
> 
> I intentionally wrote qga socket activation this way.  It allows socket
> activation to work together with daemonization.  That combination is
> probably not very useful so it's fine to get rid of it.

This works with my patch (and I've tested it now), because it looks up
LISTEN_FDS only once, way before daemonization.

The run_agent function grew a parameter that tells it to use
FIRST_SOCKET_ACTIVATION_FD as the file descriptor, without requiring
another look at the environment.  (And because daemonization forks but
doesn't exec, setting the cloexec flag doesn't get in the way either).

Thanks,

Paolo

> Please add an error message in qga/main.c if socket activation is used
> in combination with the -d/--daemonize flag.



reply via email to

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