mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
parent
257b3b6775
commit
bed531b604
@ -374,18 +374,22 @@ extern "C" __attribute__((weak))
|
|||||||
int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||||
const struct timespec *timeout, const sigset_t *sigmask)
|
const struct timespec *timeout, const sigset_t *sigmask)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv { 0, 0 };
|
||||||
|
struct timeval *tv_ptr = nullptr;
|
||||||
sigset_t origmask;
|
sigset_t origmask;
|
||||||
int nready;
|
int nready;
|
||||||
|
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
tv.tv_usec = timeout->tv_nsec / 1000;
|
tv.tv_usec = timeout->tv_nsec / 1000;
|
||||||
tv.tv_sec = timeout->tv_sec;
|
tv.tv_sec = timeout->tv_sec;
|
||||||
|
tv_ptr = &tv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sigmask)
|
if (sigmask)
|
||||||
sigprocmask(SIG_SETMASK, sigmask, &origmask);
|
sigprocmask(SIG_SETMASK, sigmask, &origmask);
|
||||||
nready = select(nfds, readfds, writefds, exceptfds, &tv);
|
|
||||||
|
nready = select(nfds, readfds, writefds, exceptfds, tv_ptr);
|
||||||
|
|
||||||
if (sigmask)
|
if (sigmask)
|
||||||
sigprocmask(SIG_SETMASK, &origmask, NULL);
|
sigprocmask(SIG_SETMASK, &origmask, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user