Received: from eggs.gnu.org ([2001:4830:134:3::10]:51357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1s0z-0003VU-Jv for qemu-devel@nongnu.org; Wed, 02 Nov 2016 05:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1s0t-0007Fn-Tl for qemu-devel@nongnu.org; Wed, 02 Nov 2016 05:39:25 -0400 From: Markus Armbruster References: <1477728462-16774-1-git-send-email-mjt@msgid.tls.msk.ru> Date: Wed, 02 Nov 2016 10:39:13 +0100 In-Reply-To: <1477728462-16774-1-git-send-email-mjt@msgid.tls.msk.ru> (Michael Tokarev's message of "Sat, 29 Oct 2016 11:07:42 +0300") Message-ID: <87ziliqkzi.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] vl.c: move pidfile creation up List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Michael Tokarev writes: > With current code, pid file is open after various > sockets, chardevs, fsdevs and the like. This causes > interesting effects, for example when monitor is a > unix-socket, and another qemu instance is already > running, new qemu first "damages" the socket and > next complain that it can't acquire the pid file and > exits, making running qemu unreachable. > > Move pid file creation a bit earlier. Makes sense, but ... > Signed-off-by: Michael Tokarev > --- > vl.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/vl.c b/vl.c > index 55763f7..7989f75 100644 > --- a/vl.c > +++ b/vl.c > @@ -4305,6 +4305,11 @@ int main(int argc, char **argv, char **envp) > exit(1); > } > > + if (pid_file && qemu_create_pidfile(pid_file) != 0) { > + error_report("could not acquire pid file: %s", strerror(errno)); > + exit(1); > + } > + > page_size_init(); > socket_init(); > ... is this early enough? For instance, we clobber the log file another 200 lines further up. A "don't clobber anything externally visible before this spot" comment could be useful. > @@ -4326,11 +4331,6 @@ int main(int argc, char **argv, char **envp) > } > #endif > > - if (pid_file && qemu_create_pidfile(pid_file) != 0) { > - error_report("could not acquire pid file: %s", strerror(errno)); > - exit(1); > - } > - > if (qemu_opts_foreach(qemu_find_opts("device"), > device_help_func, NULL, NULL)) { > exit(0);