mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 16:10:38 +08:00
ping6: Honor file descriptor maximum
This is basically the same as the patch for ping. Update #4360
This commit is contained in:
parent
a7273c0704
commit
7afe0ba8f3
@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <machine/rtems-bsd-program.h>
|
#include <machine/rtems-bsd-program.h>
|
||||||
#include <machine/rtems-bsd-commands.h>
|
#include <machine/rtems-bsd-commands.h>
|
||||||
|
#include <rtems/libio_.h>
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/capsicum.h>
|
#include <sys/capsicum.h>
|
||||||
@ -1198,7 +1199,13 @@ main(int argc, char *argv[])
|
|||||||
struct timespec now, timeout;
|
struct timespec now, timeout;
|
||||||
struct msghdr m;
|
struct msghdr m;
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
#ifndef __rtems__
|
||||||
fd_set rfds;
|
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;
|
int n;
|
||||||
|
|
||||||
/* signal handling */
|
/* signal handling */
|
||||||
@ -1211,7 +1218,11 @@ main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __rtems__
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
memset(big_enough_rfds, 0, sizeof(big_enough_rfds));
|
||||||
|
#endif /* __rtems__ */
|
||||||
FD_SET(srecv, &rfds);
|
FD_SET(srecv, &rfds);
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
timespecadd(&last, &intvl, &timeout);
|
timespecadd(&last, &intvl, &timeout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user