mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 12:19:20 +08:00
DHCPCD(8): Use select() instead of pselect()
This commit is contained in:
parent
917a78b209
commit
e6d558f7ae
@ -27,6 +27,7 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <poll.h>
|
||||
@ -42,6 +43,8 @@ pollts(struct pollfd *restrict fds, nfds_t nfds,
|
||||
fd_set read_fds;
|
||||
nfds_t n;
|
||||
int maxfd, r;
|
||||
struct timeval tv;
|
||||
struct timeval *tvp;
|
||||
|
||||
FD_ZERO(&read_fds);
|
||||
maxfd = 0;
|
||||
@ -53,7 +56,14 @@ pollts(struct pollfd *restrict fds, nfds_t nfds,
|
||||
}
|
||||
}
|
||||
|
||||
r = pselect(maxfd + 1, &read_fds, NULL, NULL, ts, sigmask);
|
||||
if (ts != NULL) {
|
||||
TIMESPEC_TO_TIMEVAL(&tv, ts);
|
||||
tvp = &tv;
|
||||
} else {
|
||||
tvp = NULL;
|
||||
}
|
||||
|
||||
r = select(maxfd + 1, &read_fds, NULL, NULL, tvp);
|
||||
if (r > 0) {
|
||||
for (n = 0; n < nfds; n++) {
|
||||
fds[n].revents =
|
||||
|
Loading…
x
Reference in New Issue
Block a user