On 02/11/20 16:30, Igor Mammedov wrote: > On Tue, 27 Oct 2020 14:21:20 -0400 > Paolo Bonzini <pbonz...@redhat.com> wrote: > >> Various options affect the global state of QEMU including the rest of >> qemu_init, and they need to be called very early. Group them together >> in a function that is called at the beginning. >> >> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> >> --- >> softmmu/vl.c | 202 ++++++++++++++++++++++++++++----------------------- >> 1 file changed, 113 insertions(+), 89 deletions(-) >> >> diff --git a/softmmu/vl.c b/softmmu/vl.c > [...] >> + >> +static void qemu_maybe_daemonize(const char *pid_file) > > why it's _maybe_ ? > It looks to me as just deamonize (or die which could be omitted)
Because os_daemonize() in turn only daemonize if the corresponding option was set: void os_daemonize(void) { if (daemonize) { pid_t pid; int fds[2]; ... Paolo >> +{ >> + Error *err; >> + >> + os_daemonize(); >> + rcu_disable_atfork(); >> + >> + if (pid_file && !qemu_write_pidfile(pid_file, &err)) { >> + error_reportf_err(err, "cannot create PID file: "); >> + exit(1); >> + } >> + >> + qemu_unlink_pidfile_notifier.notify = qemu_unlink_pidfile; >> + qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier); >> +} > [...] >