From 1e3f6a6e2e11ed43af1a3eba6000f9a5728444c3 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 26 Sep 2012 15:07:44 +0200 Subject: [PATCH] netsniff-ng: trafgen: use bug_on around gettimeofday Signed-off-by: Daniel Borkmann --- src/netsniff-ng.c | 12 ++++++------ src/trafgen.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/netsniff-ng.c b/src/netsniff-ng.c index 21b864d4..1c221b6b 100644 --- a/src/netsniff-ng.c +++ b/src/netsniff-ng.c @@ -241,7 +241,7 @@ static void enter_mode_pcap_to_tx(struct mode *mode) ioprio_print(); printf("\n"); - gettimeofday(&start, NULL); + bug_on(gettimeofday(&start, NULL)); while (likely(sigint == 0)) { while (user_may_pull_from_tx(tx_ring.frames[it].iov_base)) { @@ -285,7 +285,7 @@ static void enter_mode_pcap_to_tx(struct mode *mode) } } out: - gettimeofday(&end, NULL); + bug_on(gettimeofday(&end, NULL)); diff = tv_subtract(end, start); fflush(stdout); @@ -498,7 +498,7 @@ static void enter_mode_read_pcap(struct mode *mode) O_TRUNC | O_LARGEFILE, DEFFILEMODE); } - gettimeofday(&start, NULL); + bug_on(gettimeofday(&start, NULL)); while (likely(sigint == 0)) { do { @@ -561,7 +561,7 @@ static void enter_mode_read_pcap(struct mode *mode) } } out: - gettimeofday(&end, NULL); + bug_on(gettimeofday(&end, NULL)); diff = tv_subtract(end, start); fflush(stdout); @@ -769,7 +769,7 @@ try_file: ioprio_print(); printf("\n"); - gettimeofday(&start, NULL); + bug_on(gettimeofday(&start, NULL)); while (likely(sigint == 0)) { while (user_may_pull_from_rx(rx_ring.frames[it].iov_base)) { @@ -831,7 +831,7 @@ next: poll_error_maybe_die(sock, &rx_poll); } - gettimeofday(&end, NULL); + bug_on(gettimeofday(&end, NULL)); diff = tv_subtract(end, start); if (!(mode->dump_dir && mode->print_mode == FNTTYPE_PRINT_NONE)) { diff --git a/src/trafgen.c b/src/trafgen.c index 601e3eda..9bb0eb84 100644 --- a/src/trafgen.c +++ b/src/trafgen.c @@ -299,7 +299,7 @@ static void tx_slowpath_or_die(struct mode *mode) i = 0; - gettimeofday(&start, NULL); + bug_on(gettimeofday(&start, NULL)); while (likely(sigint == 0) && likely(num > 0)) { apply_counter(i); @@ -326,7 +326,7 @@ static void tx_slowpath_or_die(struct mode *mode) usleep(mode->gap); } - gettimeofday(&end, NULL); + bug_on(gettimeofday(&end, NULL)); diff = tv_subtract(end, start); if (mode->rfraw) @@ -403,7 +403,7 @@ static void tx_fastpath_or_die(struct mode *mode) i = 0; - gettimeofday(&start, NULL); + bug_on(gettimeofday(&start, NULL)); while (likely(sigint == 0) && likely(num > 0)) { while (user_may_pull_from_tx(tx_ring.frames[it].iov_base) && @@ -443,7 +443,7 @@ static void tx_fastpath_or_die(struct mode *mode) } } - gettimeofday(&end, NULL); + bug_on(gettimeofday(&end, NULL)_; diff = tv_subtract(end, start); destroy_tx_ring(sock, &tx_ring); -- 2.11.4.GIT