]> git.proxmox.com Git - mirror_qemu.git/commit - qga/main.c
qemu-ga: obey LISTEN_PID when using systemd socket activation
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 16 Mar 2017 15:29:45 +0000 (16:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 19 Mar 2017 10:12:12 +0000 (11:12 +0100)
commit53fabd4b86e15869e13fb762686d674c64294385
tree8ffb29b28fd121ab3d695e6e89cdd3bef9a6df4b
parentebedf0f9cd46b617df331eecc857c379d574ac62
qemu-ga: obey LISTEN_PID when using systemd socket activation

qemu-ga's socket activation support was not obeying the LISTEN_PID
environment variable, which avoids that a process uses a socket-activation
file descriptor meant for its parent.

Mess can for example ensue if a process forks a children before consuming
the socket-activation file descriptor and therefore setting O_CLOEXEC
on it.

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.

Cc: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/systemd.h [new file with mode: 0644]
qemu-nbd.c
qga/main.c
util/Makefile.objs
util/systemd.c [new file with mode: 0644]