mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-23 06:52:37 +08:00
PING(8): Use local scope for global variables
This commit is contained in:
parent
c4645e4de4
commit
42c9944f61
@ -122,7 +122,7 @@ struct tv32 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* various options */
|
/* various options */
|
||||||
int options;
|
static int options;
|
||||||
#define F_FLOOD 0x0001
|
#define F_FLOOD 0x0001
|
||||||
#define F_INTERVAL 0x0002
|
#define F_INTERVAL 0x0002
|
||||||
#define F_NUMERIC 0x0004
|
#define F_NUMERIC 0x0004
|
||||||
@ -157,51 +157,51 @@ int options;
|
|||||||
* to 8192 for complete accuracy...
|
* to 8192 for complete accuracy...
|
||||||
*/
|
*/
|
||||||
#define MAX_DUP_CHK (8 * 128)
|
#define MAX_DUP_CHK (8 * 128)
|
||||||
int mx_dup_ck = MAX_DUP_CHK;
|
static int mx_dup_ck = MAX_DUP_CHK;
|
||||||
char rcvd_tbl[MAX_DUP_CHK / 8];
|
static char rcvd_tbl[MAX_DUP_CHK / 8];
|
||||||
|
|
||||||
struct sockaddr_in whereto; /* who to ping */
|
static struct sockaddr_in whereto; /* who to ping */
|
||||||
int datalen = DEFDATALEN;
|
static int datalen = DEFDATALEN;
|
||||||
int maxpayload;
|
static int maxpayload;
|
||||||
int s; /* socket file descriptor */
|
static int s; /* socket file descriptor */
|
||||||
u_char outpackhdr[IP_MAXPACKET], *outpack;
|
static u_char outpackhdr[IP_MAXPACKET], *outpack;
|
||||||
char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */
|
static char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */
|
||||||
char BSPACE = '\b'; /* characters written for flood */
|
static char BSPACE = '\b'; /* characters written for flood */
|
||||||
char DOT = '.';
|
static char DOT = '.';
|
||||||
char *hostname;
|
static char *hostname;
|
||||||
char *shostname;
|
static char *shostname;
|
||||||
int ident; /* process id to identify our packets */
|
static int ident; /* process id to identify our packets */
|
||||||
int uid; /* cached uid for micro-optimization */
|
static int uid; /* cached uid for micro-optimization */
|
||||||
u_char icmp_type = ICMP_ECHO;
|
static u_char icmp_type = ICMP_ECHO;
|
||||||
u_char icmp_type_rsp = ICMP_ECHOREPLY;
|
static u_char icmp_type_rsp = ICMP_ECHOREPLY;
|
||||||
int phdr_len = 0;
|
static int phdr_len = 0;
|
||||||
int send_len;
|
static int send_len;
|
||||||
|
|
||||||
/* counters */
|
/* counters */
|
||||||
long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
||||||
long npackets; /* max packets to transmit */
|
static long npackets; /* max packets to transmit */
|
||||||
long nreceived; /* # of packets we got back */
|
static long nreceived; /* # of packets we got back */
|
||||||
long nrepeats; /* number of duplicates */
|
static long nrepeats; /* number of duplicates */
|
||||||
long ntransmitted; /* sequence # for outbound packets = #sent */
|
static long ntransmitted; /* sequence # for outbound packets = #sent */
|
||||||
long snpackets; /* max packets to transmit in one sweep */
|
static long snpackets; /* max packets to transmit in one sweep */
|
||||||
long snreceived; /* # of packets we got back in this sweep */
|
static long snreceived; /* # of packets we got back in this sweep */
|
||||||
long sntransmitted; /* # of packets we sent in this sweep */
|
static long sntransmitted; /* # of packets we sent in this sweep */
|
||||||
int sweepmax; /* max value of payload in sweep */
|
static int sweepmax; /* max value of payload in sweep */
|
||||||
int sweepmin = 0; /* start value of payload in sweep */
|
static int sweepmin = 0; /* start value of payload in sweep */
|
||||||
int sweepincr = 1; /* payload increment in sweep */
|
static int sweepincr = 1; /* payload increment in sweep */
|
||||||
int interval = 1000; /* interval between packets, ms */
|
static int interval = 1000; /* interval between packets, ms */
|
||||||
int waittime = MAXWAIT; /* timeout for each packet */
|
static int waittime = MAXWAIT; /* timeout for each packet */
|
||||||
long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
static long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
||||||
|
|
||||||
/* timing */
|
/* timing */
|
||||||
int timing; /* flag to do timing */
|
static int timing; /* flag to do timing */
|
||||||
double tmin = 999999999.0; /* minimum round trip time */
|
static double tmin = 999999999.0; /* minimum round trip time */
|
||||||
double tmax = 0.0; /* maximum round trip time */
|
static double tmax = 0.0; /* maximum round trip time */
|
||||||
double tsum = 0.0; /* sum of all times, for doing average */
|
static double tsum = 0.0; /* sum of all times, for doing average */
|
||||||
double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
||||||
|
|
||||||
volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */
|
static volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */
|
||||||
volatile sig_atomic_t siginfo_p;
|
static volatile sig_atomic_t siginfo_p;
|
||||||
|
|
||||||
static void fill(char *, char *);
|
static void fill(char *, char *);
|
||||||
static u_short in_cksum(u_short *, int);
|
static u_short in_cksum(u_short *, int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user