From: Nicholas Nethercote Date: Mon, 16 Mar 2009 03:46:48 +0000 (+0000) Subject: Merge r9426, r9427 ('pending' portability tweaks) from the DARWIN branch. X-Git-Tag: svn/VALGRIND_3_5_0~847 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=272ecb8e5d8ad6770bec84b28c66e7d561a7073e;p=thirdparty%2Fvalgrind.git Merge r9426, r9427 ('pending' portability tweaks) from the DARWIN branch. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9428 --- diff --git a/configure.in b/configure.in index c2021dce37..59f4f2d930 100644 --- a/configure.in +++ b/configure.in @@ -1381,6 +1381,7 @@ AC_CHECK_FUNCS([ \ pthread_spin_lock \ semtimedop \ signalfd \ + sigwaitinfo \ syscall \ strchr \ strdup \ diff --git a/none/tests/pending.c b/none/tests/pending.c index aae53ea1ca..05c449b474 100644 --- a/none/tests/pending.c +++ b/none/tests/pending.c @@ -10,13 +10,15 @@ #include #include #include +#include "config.h" static volatile int gotsig = 0; static volatile int early = 1; static void handler(int sig) { - printf("4: got signal %d\n", sig); + printf("4: got signal %s\n", + ( sig == SIGUSR1 ? "SIGUSR1" : "unexpected signal" )); if (sig != SIGUSR1) { fprintf(stderr, "FAILED: got signal %d instead\n", sig); @@ -35,7 +37,6 @@ int main() { sigset_t all; sigset_t sigusr1; - siginfo_t info; sigfillset(&all); sigemptyset(&sigusr1); @@ -69,15 +70,20 @@ int main() } printf("6: checking SIGUSR2 still pending...\n"); - if (sigwaitinfo(&all, &info) == -1) { - perror("FAILED: sigwaitinfo failed"); - return 1; - } - if (info.si_signo != SIGUSR2) { - fprintf(stderr, "FAILED: SIGUSR2 not still pending; got signal %d\n", - info.si_signo); - return 1; +# if HAVE_SIGWAITINFO + { + siginfo_t info; + if (sigwaitinfo(&all, &info) == -1) { + perror("FAILED: sigwaitinfo failed"); + return 1; + } + if (info.si_signo != SIGUSR2) { + fprintf(stderr, "FAILED: SIGUSR2 not still pending; got signal %d\n", + info.si_signo); + return 1; + } } +# endif printf("OK\n"); return 0; diff --git a/none/tests/pending.stdout.exp b/none/tests/pending.stdout.exp index 5a0210a88d..5494d35059 100644 --- a/none/tests/pending.stdout.exp +++ b/none/tests/pending.stdout.exp @@ -1,7 +1,7 @@ 1: sending signal 2: sleeping 3: unblocking -4: got signal 10 +4: got signal SIGUSR1 5: unblocked... 6: checking SIGUSR2 still pending... OK