[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: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] RFC: delete PID file on exit |
Date: |
Fri, 31 Aug 2018 18:35:45 +0200 |
Hi
On Fri, Aug 31, 2018 at 6:29 PM, Stefan Weil <address@hidden> wrote:
> 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.
Sure, that would require an additional Notifier, but that's not much anyway.
I'll update the patch.