Changeset 5c3f0b7 in rtems-libbsd


Ignore:
Timestamp:
Oct 31, 2013, 10:31:56 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
c8ee0d8
Parents:
30ff989
git-author:
Sebastian Huber <sebastian.huber@…> (10/31/13 10:31:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/31/13 12:20:14)
Message:

PING6(8): Add RTEMS support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sbin/ping6/ping6.c

    r30ff989 r5c3f0b7  
    108108#define __need_getopt_newlib
    109109#include <getopt.h>
     110#include <machine/rtems-bsd-program.h>
     111#include <machine/rtems-bsd-commands.h>
    110112
    111113#define USE_RFC2292BIS
     
    221223static struct sockaddr_in6 src; /* src addr of this packet */
    222224static socklen_t srclen;
    223 static int datalen = DEFDATALEN;
     225static int datalen;
    224226static int s;                           /* socket file descriptor */
    225227static u_char outpack[MAXPACKETLEN];
     
    230232static int ident;                       /* process id to identify our packets */
    231233static u_int8_t nonce[8];               /* nonce field for node information */
    232 static int hoplimit = -1;               /* hoplimit */
     234static int hoplimit;                    /* hoplimit */
    233235
    234236/* counters */
     
    238240static long nrepeats;                   /* number of duplicates */
    239241static long ntransmitted;               /* sequence # for outbound packets = #sent */
    240 static struct timeval interval = {1, 0}; /* interval between packets */
     242static struct timeval interval;         /* interval between packets */
    241243
    242244/* timing */
    243245static int timing;                      /* flag to do timing */
    244 static double tmin = 999999999.0;       /* minimum round trip time */
    245 static double tmax = 0.0;               /* maximum round trip time */
    246 static double tsum = 0.0;               /* sum of all times, for doing average */
    247 static double tsumsq = 0.0;             /* sum of all times squared, for std. dev. */
     246static double tmin;                     /* minimum round trip time */
     247static double tmax;                     /* maximum round trip time */
     248static double tsum;                     /* sum of all times, for doing average */
     249static double tsumsq;                   /* sum of all times squared, for std. dev. */
    248250
    249251/* for node addresses */
     
    296298static void      usage(void);
    297299
    298 
     300#ifdef __rtems__
     301int rtems_bsd_command_ping6(int argc, char **argv)
     302{
     303        int exit_code;
     304
     305        rtems_bsd_program_lock();
     306
     307        memset(&rcvd_tbl[0], 0, sizeof(rcvd_tbl));
     308        srclen = 0;
     309        datalen = DEFDATALEN;
     310        memset(&outpack[0], 0, sizeof(outpack));
     311        hoplimit = -1;
     312        nmissedmax = 0;
     313        npackets = 0;
     314        nreceived = 0;
     315        nrepeats = 0;
     316        ntransmitted = 0;
     317        interval.tv_sec = 1;
     318        interval.tv_usec = 0;
     319        timing = 0;
     320        tmin = 999999999.0;
     321        tmax = 0.0;
     322        tsum = 0.0;
     323        tsumsq = 0.0;
     324        naflags = 0;
     325        scmsg = NULL;
     326        seenalrm = 0;
     327        seenint = 0;
     328#ifdef SIGINFO
     329        seeninfo = 0;
     330#endif
     331
     332        exit_code = rtems_bsd_program_call_main("ping6", main, argc, argv);
     333
     334        rtems_bsd_program_unlock();
     335
     336        return exit_code;
     337}
     338#endif /* __rtems__ */
    299339int
    300 #ifdef __rtems__
    301 main_ping6(argc, argv)
    302 #else
    303340main(argc, argv)
    304 #endif
    305341        int argc;
    306342        char *argv[];
Note: See TracChangeset for help on using the changeset viewer.