summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin/ping6/ping6.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sbin/ping6/ping6.c')
-rw-r--r--freebsd/sbin/ping6/ping6.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c
index a56aae1d..921797d0 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>
@@ -286,7 +287,9 @@ static void fill(char *, char *);
static int get_hoplim(struct msghdr *);
static int get_pathmtu(struct msghdr *);
static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
+#ifndef __rtems__
static void onsignal(int);
+#endif /* __rtems__ */
static void onint(int);
static size_t pingerlen(void);
static int pinger(void);
@@ -346,7 +349,9 @@ main(int argc, char *argv[])
struct timespec last, intvl;
struct sockaddr_in6 from, *sin6;
struct addrinfo hints, *res;
+#ifndef __rtems__
struct sigaction si_sa;
+#endif /* __rtems__ */
int cc, i;
int almost_done, ch, hold, packlen, preload, optval, error;
int nig_oldmcprefix = -1;
@@ -373,7 +378,9 @@ main(int argc, char *argv[])
char *policy_out = NULL;
#endif
double t;
+#ifndef __rtems__
u_long alarmtimeout;
+#endif /* __rtems__ */
size_t rthlen;
#ifdef IPV6_USE_MIN_MTU
int mflag = 0;
@@ -399,7 +406,9 @@ main(int argc, char *argv[])
intvl.tv_sec = interval / 1000;
intvl.tv_nsec = interval % 1000 * 1000000;
+#ifndef __rtems__
alarmtimeout = preload = 0;
+#endif /* __rtems__ */
datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN];
capdns = capdns_setup();
#ifndef IPSEC
@@ -627,6 +636,7 @@ main(int argc, char *argv[])
options |= F_WAITTIME;
waittime = (int)t;
break;
+#ifndef __rtems__
case 't':
alarmtimeout = strtoul(optarg, &e, 0);
if ((alarmtimeout < 1) || (alarmtimeout == ULONG_MAX))
@@ -637,6 +647,7 @@ main(int argc, char *argv[])
optarg, MAXALARM);
alarm((int)alarmtimeout);
break;
+#endif /* __rtems__ */
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
case 'P':
@@ -1173,6 +1184,7 @@ main(int argc, char *argv[])
}
clock_gettime(CLOCK_MONOTONIC, &last);
+#ifndef __rtems__
sigemptyset(&si_sa.sa_mask);
si_sa.sa_flags = 0;
si_sa.sa_handler = onsignal;
@@ -1188,6 +1200,7 @@ main(int argc, char *argv[])
if (sigaction(SIGALRM, &si_sa, 0) == -1)
err(EX_OSERR, "sigaction SIGALRM");
}
+#endif /* __rtems__ */
if (options & F_FLOOD) {
intvl.tv_sec = 0;
intvl.tv_nsec = 10000000;
@@ -1198,7 +1211,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 +1230,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);
@@ -1299,11 +1322,13 @@ main(int argc, char *argv[])
}
}
}
+#ifndef __rtems__
sigemptyset(&si_sa.sa_mask);
si_sa.sa_flags = 0;
si_sa.sa_handler = SIG_IGN;
sigaction(SIGINT, &si_sa, 0);
sigaction(SIGALRM, &si_sa, 0);
+#endif /* __rtems__ */
summary();
if(packet != NULL)
@@ -1312,6 +1337,7 @@ main(int argc, char *argv[])
exit(nreceived == 0 ? 2 : 0);
}
+#ifndef __rtems__
static void
onsignal(int sig)
{
@@ -1328,6 +1354,7 @@ onsignal(int sig)
#endif
}
}
+#endif /* __rtems__ */
/*
* pinger --