From: Paolo Bonzini <pbonzini@redhat.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] Use sigwait instead of sigwaitinfo.
Date: Fri, 18 Feb 2011 15:09:11 +0100 [thread overview]
Message-ID: <4D5E7D87.6010000@redhat.com> (raw)
In-Reply-To: <1298035036-51807-1-git-send-email-gingold@adacore.com>
On 02/18/2011 02:17 PM, Tristan Gingold wrote:
> Fix compilation failure on Darwin.
>
> Signed-off-by: Tristan Gingold<gingold@adacore.com>
> ---
> compatfd.c | 36 ++++++++++++++++++------------------
> 1 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/compatfd.c b/compatfd.c
> index a7cebc4..bd377c4 100644
> --- a/compatfd.c
> +++ b/compatfd.c
> @@ -26,45 +26,45 @@ struct sigfd_compat_info
> static void *sigwait_compat(void *opaque)
> {
> struct sigfd_compat_info *info = opaque;
> - int err;
> sigset_t all;
>
> sigfillset(&all);
> sigprocmask(SIG_BLOCK,&all, NULL);
>
> - do {
> - siginfo_t siginfo;
> + while (1) {
> + int sig;
> + int err;
>
> - err = sigwaitinfo(&info->mask,&siginfo);
> - if (err == -1&& errno == EINTR) {
> - err = 0;
> - continue;
> - }
> -
> - if (err> 0) {
> - char buffer[128];
> + err = sigwait(&info->mask,&sig);
> + if (err != 0) {
> + if (errno == EINTR) {
> + continue;
> + } else {
> + return NULL;
> + }
> + } else {
> + struct qemu_signalfd_siginfo buffer;
> size_t offset = 0;
>
> - memcpy(buffer,&err, sizeof(err));
> + memset(&buffer, 0, sizeof(buffer));
> + buffer.ssi_signo = sig;
> +
> while (offset< sizeof(buffer)) {
> ssize_t len;
>
> - len = write(info->fd, buffer + offset,
> + len = write(info->fd, (char *)&buffer + offset,
> sizeof(buffer) - offset);
> if (len == -1&& errno == EINTR)
> continue;
>
> if (len<= 0) {
> - err = -1;
> - break;
> + return NULL;
> }
>
> offset += len;
> }
> }
> - } while (err>= 0);
> -
> - return NULL;
> + }
> }
>
> static int qemu_signalfd_compat(const sigset_t *mask)
Looks good.
Paolo
next prev parent reply other threads:[~2011-02-18 14:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 16:24 [Qemu-devel] [PATCH] Use sigwait instead og sigwaitinfo Tristan Gingold
2011-02-17 17:06 ` [Qemu-devel] " Paolo Bonzini
2011-02-18 13:17 ` [Qemu-devel] [PATCH] Use sigwait instead of sigwaitinfo Tristan Gingold
2011-02-18 14:09 ` Paolo Bonzini [this message]
2011-02-18 15:34 ` [Qemu-devel] " Jan Kiszka
2011-02-18 15:50 ` Tristan Gingold
2011-02-18 16:16 ` Jan Kiszka
2011-02-18 18:15 ` [Qemu-devel] " Blue Swirl
2011-02-25 20:58 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D5E7D87.6010000@redhat.com \
--to=pbonzini@redhat.com \
--cc=gingold@adacore.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.