On Fri, Mar 17, 2017 at 11:57:38AM +0100, Paolo Bonzini wrote: > > > 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).
Good point, I thought it would exec for some reason but it doesn't need to! Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>
signature.asc
Description: PGP signature