From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFRUc-0003pW-Tk for qemu-devel@nongnu.org; Mon, 17 Feb 2014 11:56:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFRUU-0000jB-CB for qemu-devel@nongnu.org; Mon, 17 Feb 2014 11:56:30 -0500 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:51103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFRUU-0000j0-5O for qemu-devel@nongnu.org; Mon, 17 Feb 2014 11:56:22 -0500 Received: by mail-ea0-f169.google.com with SMTP id h10so7430514eak.28 for ; Mon, 17 Feb 2014 08:56:20 -0800 (PST) Sender: Paolo Bonzini Message-ID: <53023F30.4080701@redhat.com> Date: Mon, 17 Feb 2014 17:56:16 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1392651898-16749-1-git-send-email-stefanha@redhat.com> <1392651898-16749-4-git-send-email-stefanha@redhat.com> <878ut9u1k4.fsf@blackfin.pond.sub.org> In-Reply-To: <878ut9u1k4.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] qtest: kill QEMU process on g_assert() failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , Stefan Hajnoczi Cc: Peter Maydell , qemu-devel@nongnu.org, Anthony Liguori , Laszlo Ersek , Andreas Faerber Il 17/02/2014 17:49, Markus Armbruster ha scritto: > Assumes zero-initialization has the same effect as > sigemptyset(&sigact.sa_mask). Quoting POSIX: > > The implementation of the sigemptyset() (or sigfillset()) function > could quite trivially clear (or set) all the bits in the signal set. > Alternatively, it would be reasonable to initialize part of the > structure, such as a version field, to permit binary-compatibility > between releases where the size of the set varies. For such > reasons, either sigemptyset() or sigfillset() must be called prior > to any other use of the signal set, even if such use is read-only > (for example, as an argument to sigpending()). > > Looks like you better sigemptyset() here, for maximum portability. > Certainly memset of struct sigaction or sigset_t * is common enough that no one in their right minds would do this. Is there really an OS that does it? Also, the above justification is quite feeble; it would work for binary compatibility of sigset_t* arguments, but not for embedded sigset_t structs. I'm CCing our resident POSIX experts in hope that this paragraph can be eliminated from the standard. :) Related to this, there are a bunch of Coverity reports where we use uninitialized fields of a struct sigaction. Paolo