[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] RFC: delete PID file on exit
From: |
Stefan Weil |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] RFC: delete PID file on exit |
Date: |
Fri, 31 Aug 2018 18:29:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
Am 31.08.2018 um 16:53 schrieb Marc-André Lureau:
[...]
> +static const char *pid_file;
> +
> +static void qemu_unlink_pidfile(void)
> +{
> + if (pid_file) {
> + unlink(pid_file);
> + }
> +}
> +
> bool machine_init_done;
>
> void qemu_add_machine_init_done_notifier(Notifier *notify)
> @@ -2927,7 +2936,6 @@ int main(int argc, char **argv, char **envp)
> const char *vga_model = NULL;
> const char *qtest_chrdev = NULL;
> const char *qtest_log = NULL;
> - const char *pid_file = NULL;
> const char *incoming = NULL;
> bool userconfig = true;
> bool nographic = false;
> @@ -4000,6 +4008,7 @@ int main(int argc, char **argv, char **envp)
> error_reportf_err(err, "cannot create PID file: ");
> exit(1);
> }
> + atexit(qemu_unlink_pidfile);
Could qemu_unlink_pidfile be combined with qemu_run_exit_notifiers to
avoid an additional call of atexit from the same function (main)?
Even if there is support for 32 or more atexit calls, it might be good
to be a little bit more restrictive.
Regards
Stefan