Merge r9426, r9427 ('pending' portability tweaks) from the DARWIN branch.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9428
This commit is contained in:
Nicholas Nethercote 2009-03-16 03:46:48 +00:00
parent f3630f66e8
commit 272ecb8e5d
3 changed files with 18 additions and 11 deletions

View File

@ -1381,6 +1381,7 @@ AC_CHECK_FUNCS([ \
pthread_spin_lock \
semtimedop \
signalfd \
sigwaitinfo \
syscall \
strchr \
strdup \

View File

@ -10,13 +10,15 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#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;

View File

@ -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