summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-02-25 11:29:56 +0100
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-03-26 14:08:01 +0100
commit33e3cf8eaff0081e74593f8a91edc8e37f732430 (patch)
tree60a47cf5361f59aa744aa1eb3002c3439a580c13
parente7fb073f3a1040847daab3ef917aeade755eb30b (diff)
downloadrtems-libbsd-33e3cf8eaff0081e74593f8a91edc8e37f732430.tar.bz2
ping6: Honor file descriptor maximum
This is basically the same as the patch for ping. Update #4360
-rw-r--r--freebsd/sbin/ping6/ping6.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c
index db3ab05a..96bd60e3 100644
--- a/freebsd/sbin/ping6/ping6.c
+++ b/freebsd/sbin/ping6/ping6.c
@@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <machine/rtems-bsd-program.h>
#include <machine/rtems-bsd-commands.h>
+#include <rtems/libio_.h>
#endif /* __rtems__ */
#include <sys/param.h>
#include <sys/capsicum.h>
@@ -1198,7 +1199,13 @@ main(int argc, char *argv[])
struct timespec now, timeout;
struct msghdr m;
struct iovec iov[2];
+#ifndef __rtems__
fd_set rfds;
+#else /* __rtems__ */
+ fd_set big_enough_rfds[howmany(rtems_libio_number_iops,
+ sizeof(fd_set) * 8)];
+#define rfds (*(fd_set *)(&big_enough_rfds[0]))
+#endif /* __rtems__ */
int n;
/* signal handling */
@@ -1211,7 +1218,11 @@ main(int argc, char *argv[])
continue;
}
#endif
+#ifndef __rtems__
FD_ZERO(&rfds);
+#else /* __rtems__ */
+ memset(big_enough_rfds, 0, sizeof(big_enough_rfds));
+#endif /* __rtems__ */
FD_SET(srecv, &rfds);
clock_gettime(CLOCK_MONOTONIC, &now);
timespecadd(&last, &intvl, &timeout);