|
|
@ -304,6 +304,7 @@ int hints_ai_family = AF_UNSPEC;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
volatile sig_atomic_t status_snapshot = 0;
|
|
|
|
volatile sig_atomic_t status_snapshot = 0;
|
|
|
|
|
|
|
|
volatile sig_atomic_t finish_requested = 0;
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int debugging = 0;
|
|
|
|
unsigned int debugging = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -383,7 +384,7 @@ void print_per_system_splits(void);
|
|
|
|
void print_netdata(void);
|
|
|
|
void print_netdata(void);
|
|
|
|
void print_global_stats(void);
|
|
|
|
void print_global_stats(void);
|
|
|
|
void main_loop();
|
|
|
|
void main_loop();
|
|
|
|
void sigstatus();
|
|
|
|
void signal_handler(int);
|
|
|
|
void finish();
|
|
|
|
void finish();
|
|
|
|
const char* sprint_tm(int64_t t);
|
|
|
|
const char* sprint_tm(int64_t t);
|
|
|
|
void ev_enqueue(struct event_queue *queue, struct event *event);
|
|
|
|
void ev_enqueue(struct event_queue *queue, struct event *event);
|
|
|
@ -1110,8 +1111,8 @@ int main(int argc, char** argv)
|
|
|
|
init_ping_buffer_ipv6(ping_data_size);
|
|
|
|
init_ping_buffer_ipv6(ping_data_size);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
signal(SIGINT, finish);
|
|
|
|
signal(SIGINT, signal_handler);
|
|
|
|
signal(SIGQUIT, sigstatus);
|
|
|
|
signal(SIGQUIT, signal_handler);
|
|
|
|
setlinebuf(stdout);
|
|
|
|
setlinebuf(stdout);
|
|
|
|
|
|
|
|
|
|
|
|
if (report_interval) {
|
|
|
|
if (report_interval) {
|
|
|
@ -1375,6 +1376,11 @@ void main_loop()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* end of loop was requested by interrupt signal handler */
|
|
|
|
|
|
|
|
if (finish_requested) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Receive replies */
|
|
|
|
/* Receive replies */
|
|
|
|
/* (this is what sleeps during each loop iteration) */
|
|
|
|
/* (this is what sleeps during each loop iteration) */
|
|
|
|
dbg_printf("waiting up to %ld ms\n", wait_time/100);
|
|
|
|
dbg_printf("waiting up to %ld ms\n", wait_time/100);
|
|
|
@ -1405,21 +1411,30 @@ void main_loop()
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
Function: sigstatus
|
|
|
|
Function: signal_handler
|
|
|
|
|
|
|
|
|
|
|
|
*************************************************************
|
|
|
|
*************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
Inputs: void (none)
|
|
|
|
Inputs: int signum
|
|
|
|
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Description:
|
|
|
|
|
|
|
|
|
|
|
|
SIGQUIT signal handler - set flag and return
|
|
|
|
SIGQUIT signal handler - set flag and return
|
|
|
|
|
|
|
|
SIGINT signal handler - set flag and return
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************/
|
|
|
|
************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void sigstatus()
|
|
|
|
void signal_handler(int signum)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (signum) {
|
|
|
|
|
|
|
|
case SIGINT:
|
|
|
|
|
|
|
|
finish_requested = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SIGQUIT:
|
|
|
|
status_snapshot = 1;
|
|
|
|
status_snapshot = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|