Patchwork Use sigwait instead og sigwaitinfo.

login
register
mail settings
Submitter Tristan Gingold
Date Feb. 17, 2011, 4:24 p.m.
Message ID <1297959841-41235-1-git-send-email-gingold@adacore.com>
Download mbox | patch
Permalink /patch/83458/
State New
Headers show

Comments

Tristan Gingold - Feb. 17, 2011, 4:24 p.m.
Fix compilation failure on Darwin.

Signed-off-by: Tristan Gingold <gingold@adacore.com>
---
 compatfd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Paolo Bonzini - Feb. 17, 2011, 5:06 p.m.
On 02/17/2011 05:24 PM, Tristan Gingold wrote:
> -        siginfo_t siginfo;
> +        int sig;
>
> -        err = sigwaitinfo(&info->mask,&siginfo);
> +        err = sigwait(&info->mask,&sig);

This is doable but the patch is wrong, after sigwaitinfo "err" is the 
signal number, so you should replace

             memcpy(buffer, &err, sizeof(err));

further down with

             memcpy(buffer, &sig, sizeof(sig));

Paolo

Patch

diff --git a/compatfd.c b/compatfd.c
index a7cebc4..5f7f355 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -33,9 +33,9 @@  static void *sigwait_compat(void *opaque)
     sigprocmask(SIG_BLOCK, &all, NULL);
 
     do {
-        siginfo_t siginfo;
+        int sig;
 
-        err = sigwaitinfo(&info->mask, &siginfo);
+        err = sigwait(&info->mask, &sig);
         if (err == -1 && errno == EINTR) {
             err = 0;
             continue;