diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index a1cc231e3b..a9334730be 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -1232,10 +1232,11 @@ impl Pal for Sys { } let path = format!("/scheme/time/{clock_id}"); - let timerfd = FdGuard::open(&path, syscall::O_RDWR)?; + let timerfd = FdGuard::open(&path, syscall::O_RDWR)?.to_upper()?; let eventfd = FdGuard::new(Error::demux(unsafe { event::redox_event_queue_create_v1(0) - })?); + })?) + .to_upper()?; let caller_thread = Self::current_os_tid(); let timer_buf = unsafe { diff --git a/tests/signals/ppoll-block.c b/tests/signals/ppoll-block.c new file mode 100644 index 0000000000..c56cd07638 --- /dev/null +++ b/tests/signals/ppoll-block.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "../test_helpers.h" +#include "signals_list.h" +static void handler(int signum) +{ + (void) signum; + int errnum = errno; + printf("SIGUSR1\n"); + fflush(stdout); + errno = errnum; +} + +int main(void) +{ + signal(SIGUSR1, handler); + sigset_t sigusr1; + sigemptyset(&sigusr1); + sigaddset(&sigusr1, SIGUSR1); + sigprocmask(SIG_BLOCK, &sigusr1, NULL); + sigset_t empty; + sigemptyset(&empty); + int fds[2]; + if ( pipe(fds) ) + err(1, "pipe"); + close(fds[0]); + alarm(1); + struct pollfd pfd = { .fd = fds[0], .events = POLLIN }; + // POSIX requires EINTR or returning the pending events. + int ret = ppoll(&pfd, 1, NULL, &empty); + if ( ret < 0 ) + ERROR_IF(ppoll, ret, <0); + if ( pfd.revents & POLLIN ) + ERROR_IF(ppoll, pfd.revents, & POLLIN); + if ( pfd.revents & POLLOUT ) + ERROR_IF(ppoll, pfd.revents, & POLLOUT); + if ( pfd.revents & POLLERR ) + ERROR_IF(ppoll, pfd.revents, & POLLERR); + if ( pfd.revents & POLLHUP ) + ERROR_IF(ppoll, pfd.revents, & POLLHUP); + if ( pfd.revents & POLLNVAL ){ + return EXIT_SUCCESS; + } + return 0; +} \ No newline at end of file