summaryrefslogtreecommitdiffstats
path: root/dhcpcd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-20 14:50:14 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-20 14:59:54 +0200
commit7ec4d8760dd98e647977fae76749609a81bdf6d2 (patch)
tree4d2671a60b781a4981762d3d608c1206b0c544f8 /dhcpcd
parent9a583a94d372afba5a2796189b40f8efa16bcfd4 (diff)
downloadrtems-libbsd-7ec4d8760dd98e647977fae76749609a81bdf6d2.tar.bz2
dhcpcd: Honour file descriptor maximum
Diffstat (limited to 'dhcpcd')
-rw-r--r--dhcpcd/compat/pselect.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/dhcpcd/compat/pselect.c b/dhcpcd/compat/pselect.c
index a18e5b3e..0e504e69 100644
--- a/dhcpcd/compat/pselect.c
+++ b/dhcpcd/compat/pselect.c
@@ -35,18 +35,32 @@
#include <unistd.h>
#include "pollts.h"
+#ifdef __rtems__
+#include <string.h>
+#include <rtems/libio_.h>
+#endif /* __rtems__ */
int
pollts(struct pollfd *restrict fds, nfds_t nfds,
const struct timespec *restrict ts, const sigset_t *restrict sigmask)
{
+#ifndef __rtems__
fd_set read_fds;
+#else /* __rtems__ */
+ fd_set big_enough_read_fs[howmany(rtems_libio_number_iops,
+ sizeof(fd_set) * 8)];
+#define read_fds (*(fd_set *)(&big_enough_read_fs[0]))
+#endif /* __rtems__ */
nfds_t n;
int maxfd, r;
struct timeval tv;
struct timeval *tvp;
+#ifndef __rtems__
FD_ZERO(&read_fds);
+#else /* __rtems__ */
+ memset(big_enough_read_fs, 0, sizeof(big_enough_read_fs));
+#endif /* __rtems__ */
maxfd = 0;
for (n = 0; n < nfds; n++) {
if (fds[n].events & POLLIN) {