[rtems-libbsd commit] dhcpcd: Honour file descriptor maximum
Sebastian Huber
sebh at rtems.org
Mon Oct 23 07:27:50 UTC 2017
Module: rtems-libbsd
Branch: master
Commit: 7ec4d8760dd98e647977fae76749609a81bdf6d2
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=7ec4d8760dd98e647977fae76749609a81bdf6d2
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Oct 20 14:50:14 2017 +0200
dhcpcd: Honour file descriptor maximum
---
dhcpcd/compat/pselect.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dhcpcd/compat/pselect.c b/dhcpcd/compat/pselect.c
index a18e5b3..0e504e6 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) {
More information about the vc
mailing list