5 #include <sys/select.h>
9 static volatile int handler_called
;
22 sa
.sa_handler
= handler
;
24 sigemptyset (&sa
.sa_mask
);
26 if (sigaction (SIGUSR1
, &sa
, NULL
) != 0)
28 puts ("sigaction failed");
32 if (sigblock (SIGUSR1
) != 0)
34 puts ("sigblock failed");
40 if (pipe (fds
[0]) != 0 || pipe (fds
[1]) != 0)
50 sigprocmask (SIG_SETMASK
, NULL
, &ss
);
51 sigdelset (&ss
, SIGUSR1
);
53 struct timespec to
= { .tv_sec
= 0, .tv_nsec
= 500000000 };
61 FD_SET (fds
[0][0], &rfds
);
67 e
= pselect (fds
[0][0] + 1, &rfds
, NULL
, NULL
, &to
, &ss
);
73 puts ("child: pselect did not fail");
78 puts ("child: pselect did not set errno to EINTR");
82 TEMP_FAILURE_RETRY (write (fds
[1][1], "foo", 3));
90 FD_SET (fds
[1][0], &rfds
);
94 int e
= pselect (fds
[1][0] + 1, &rfds
, NULL
, NULL
, NULL
, &ss
);
97 puts ("parent: pselect failed");
102 puts ("parent: pselect did not report readable fd");
105 if (!FD_ISSET (fds
[1][0], &rfds
))
107 puts ("parent: pselect reports wrong fd");
111 if (TEMP_FAILURE_RETRY (waitpid (p
, NULL
, 0)) != p
)
113 puts ("waitpid failed");
120 #define TEST_FUNCTION do_test ()
121 #include "../test-skeleton.c"