Re: [PATCH] lxc: handle SIGCHLD from exiting container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave Leskovec <dlesko@xxxxxxxxxxxxxxxxxx> wrote:
> Jim Meyering wrote:
>> Dave Leskovec <dlesko@xxxxxxxxxxxxxxxxxx> wrote:
>> ...
>>>>> +#ifndef	_SIGNAL_H
>>>>> +#include <signal.h>
>>>>> +#endif
>>>> In practice it's fine to include <signal.h> unconditionally,
>>>> and even multiple times.  Have you encountered a version of <signal.h>
>>>> that may not be included twice?  If so, it probably deserves a comment
>>>> with the details.
>>> No, I don't have any special condition here.  This is probably some past
>>> conditioning resurfacing briefly.  If I remember correctly, it had more to do
>>> with compile efficiency rather than avoiding compile failures from multiple
>>> inclusions.
>>
>> Then don't bother.
>> gcc performs a handy optimization whereby it doesn't even open
>> the header file the second (and subsequent) time it's included, as
>> long as it's entire contents is wrapped in the usual sort of guard:
>>
>>   #ifndef SYM
>>   #define SYM
>>   ...
>>   #endif
>
> Thanks Jim.  I've attached an updated patch with those two changes.  While
> making these changes, I noticed that I missed updating the storage drivers state
> driver table.  I've fixed that as well.
>
> --
...
> Index: b/qemud/qemud.c
> ===================================================================
...
> +static void sig_handler(int sig, siginfo_t * siginfo,
> +                        void* context ATTRIBUTE_UNUSED) {
...
> -    unsigned char sigc;
> +    siginfo_t siginfo;
>      int ret;
>
> -    if (read(server->sigread, &sigc, 1) != 1) {
> +    if (read(server->sigread, &siginfo, sizeof(siginfo)) != sizeof(siginfo)) {

Looks good, but that should be saferead instead of "read".
Now that it's reading more than one byte, EINTR can make a difference.

Also, it'd make it a tiny bit easier for people who reply to you
if you did not put code after your signature.
Or at least not after the "-- " signature-introducer.
Some mail clients (at least Gnus) ">"-quote only the part
of your message that comes before the signature.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]