Changeset 42c9944 in rtems-libbsd


Ignore:
Timestamp:
Oct 31, 2013, 8:42:56 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
Children:
d3d6b08
Parents:
c4645e4d
git-author:
Sebastian Huber <sebastian.huber@…> (10/31/13 08:42:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/31/13 12:18:53)
Message:

PING(8): Use local scope for global variables

File:
1 edited

Legend:

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

    rc4645e4d r42c9944  
    123123
    124124/* various options */
    125 int options;
     125static int options;
    126126#define F_FLOOD         0x0001
    127127#define F_INTERVAL      0x0002
     
    158158 */
    159159#define MAX_DUP_CHK     (8 * 128)
    160 int mx_dup_ck = MAX_DUP_CHK;
    161 char rcvd_tbl[MAX_DUP_CHK / 8];
    162 
    163 struct sockaddr_in whereto;     /* who to ping */
    164 int datalen = DEFDATALEN;
    165 int maxpayload;
    166 int s;                          /* socket file descriptor */
    167 u_char outpackhdr[IP_MAXPACKET], *outpack;
    168 char BBELL = '\a';              /* characters written for MISSED and AUDIBLE */
    169 char BSPACE = '\b';             /* characters written for flood */
    170 char DOT = '.';
    171 char *hostname;
    172 char *shostname;
    173 int ident;                      /* process id to identify our packets */
    174 int uid;                        /* cached uid for micro-optimization */
    175 u_char icmp_type = ICMP_ECHO;
    176 u_char icmp_type_rsp = ICMP_ECHOREPLY;
    177 int phdr_len = 0;
    178 int send_len;
     160static int mx_dup_ck = MAX_DUP_CHK;
     161static char rcvd_tbl[MAX_DUP_CHK / 8];
     162
     163static struct sockaddr_in whereto;      /* who to ping */
     164static int datalen = DEFDATALEN;
     165static int maxpayload;
     166static int s;                           /* socket file descriptor */
     167static u_char outpackhdr[IP_MAXPACKET], *outpack;
     168static char BBELL = '\a';               /* characters written for MISSED and AUDIBLE */
     169static char BSPACE = '\b';              /* characters written for flood */
     170static char DOT = '.';
     171static char *hostname;
     172static char *shostname;
     173static int ident;                       /* process id to identify our packets */
     174static int uid;                 /* cached uid for micro-optimization */
     175static u_char icmp_type = ICMP_ECHO;
     176static u_char icmp_type_rsp = ICMP_ECHOREPLY;
     177static int phdr_len = 0;
     178static int send_len;
    179179
    180180/* counters */
    181 long nmissedmax;                /* max value of ntransmitted - nreceived - 1 */
    182 long npackets;                  /* max packets to transmit */
    183 long nreceived;                 /* # of packets we got back */
    184 long nrepeats;                  /* number of duplicates */
    185 long ntransmitted;              /* sequence # for outbound packets = #sent */
    186 long snpackets;                 /* max packets to transmit in one sweep */
    187 long snreceived;                /* # of packets we got back in this sweep */
    188 long sntransmitted;             /* # of packets we sent in this sweep */
    189 int sweepmax;                   /* max value of payload in sweep */
    190 int sweepmin = 0;               /* start value of payload in sweep */
    191 int sweepincr = 1;              /* payload increment in sweep */
    192 int interval = 1000;            /* interval between packets, ms */
    193 int waittime = MAXWAIT;         /* timeout for each packet */
    194 long nrcvtimeout = 0;           /* # of packets we got back after waittime */
     181static long nmissedmax;         /* max value of ntransmitted - nreceived - 1 */
     182static long npackets;                   /* max packets to transmit */
     183static long nreceived;                  /* # of packets we got back */
     184static long nrepeats;                   /* number of duplicates */
     185static long ntransmitted;               /* sequence # for outbound packets = #sent */
     186static long snpackets;                  /* max packets to transmit in one sweep */
     187static long snreceived;         /* # of packets we got back in this sweep */
     188static long sntransmitted;              /* # of packets we sent in this sweep */
     189static int sweepmax;                    /* max value of payload in sweep */
     190static int sweepmin = 0;                /* start value of payload in sweep */
     191static int sweepincr = 1;               /* payload increment in sweep */
     192static int interval = 1000;             /* interval between packets, ms */
     193static int waittime = MAXWAIT;          /* timeout for each packet */
     194static long nrcvtimeout = 0;            /* # of packets we got back after waittime */
    195195
    196196/* timing */
    197 int timing;                     /* flag to do timing */
    198 double tmin = 999999999.0;      /* minimum round trip time */
    199 double tmax = 0.0;              /* maximum round trip time */
    200 double tsum = 0.0;              /* sum of all times, for doing average */
    201 double tsumsq = 0.0;            /* sum of all times squared, for std. dev. */
    202 
    203 volatile sig_atomic_t finish_up;  /* nonzero if we've been told to finish up */
    204 volatile sig_atomic_t siginfo_p;
     197static int timing;                      /* flag to do timing */
     198static double tmin = 999999999.0;       /* minimum round trip time */
     199static double tmax = 0.0;               /* maximum round trip time */
     200static double tsum = 0.0;               /* sum of all times, for doing average */
     201static double tsumsq = 0.0;             /* sum of all times squared, for std. dev. */
     202
     203static volatile sig_atomic_t finish_up;  /* nonzero if we've been told to finish up */
     204static volatile sig_atomic_t siginfo_p;
    205205
    206206static void fill(char *, char *);
Note: See TracChangeset for help on using the changeset viewer.