[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V3 06/22] vl: add helper to request re-exec
From: |
Steven Sistare |
Subject: |
Re: [PATCH V3 06/22] vl: add helper to request re-exec |
Date: |
Thu, 13 May 2021 16:19:22 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 5/7/2021 10:31 AM, Eric Blake wrote:
> On 5/7/21 7:25 AM, Steve Sistare wrote:
>> Add a qemu_exec_requested() hook that causes the main loop to exit and
>> re-exec qemu using the same initial arguments. If /usr/bin/qemu-exec
>> exists, exec that instead. This is an optional site-specific trampoline
>> that may alter the environment before exec'ing the qemu binary.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>> ---
>
>> +static void qemu_exec(void)
>> +{
>> + const char *helper = "/usr/bin/qemu-exec";
>> + const char *bin = !access(helper, X_OK) ? helper : argv_main[0];
>
> Reads awkwardly; I would have used '...= access(helper, X_OK) == 0 ?...'
Will fix.
>> +
>> + execvp(bin, argv_main);
>> + error_report("execvp failed, errno %d.", errno);
>
> error_report should not be used with a trailing dot.
Will fix. I was not sure because I see examples both ways, though no dot
prevails.
Perhaps it should be added to the style guide and checkpatch.
> Also, %d for errno is awkward, better is:
>
> error_report("execvp failed: %s", strerror(errno));
I shy away from strerror because it is not thread safe, but I see qemu uses it
extensively. Will fix.
>
>> + exit(1);
>
> We aren't consistent about use of EXIT_FAILED.
OK, I will use EXIT_FAILURE.
Thanks for reviewing.
- Steve
- [PATCH V3 00/22] Live Update, Steve Sistare, 2021/05/07
- [PATCH V3 03/22] oslib: qemu_clr_cloexec, Steve Sistare, 2021/05/07
- [PATCH V3 05/22] machine: memfd-alloc option, Steve Sistare, 2021/05/07
- [PATCH V3 01/22] as_flat_walk, Steve Sistare, 2021/05/07
- [PATCH V3 02/22] qemu_ram_volatile, Steve Sistare, 2021/05/07
- [PATCH V3 07/22] cpr, Steve Sistare, 2021/05/07