[rtems-libbsd commit] ping6: Honor file descriptor maximum

Christian Mauderer christianm at rtems.org
Fri Mar 26 13:10:31 UTC 2021


Module:    rtems-libbsd
Branch:    master
Commit:    7afe0ba8f36c0aed21bdc01d1aee4598f100baac
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=7afe0ba8f36c0aed21bdc01d1aee4598f100baac

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Thu Feb 25 11:29:56 2021 +0100

ping6: Honor file descriptor maximum

This is basically the same as the patch for ping.

Update #4360

---

 freebsd/sbin/ping6/ping6.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c
index a56aae1..2d6e5ad 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);



More information about the vc mailing list