aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMaxime Henrion <mux@FreeBSD.org>2005-04-21 19:28:22 +0000
committerMaxime Henrion <mux@FreeBSD.org>2005-04-21 19:28:22 +0000
commit163609768e92c8dbcb40d47349f6d591cb34f7ae (patch)
tree23e4d9acac71b94cc16ceee1d5e953a53bece3ed /tools
parentfaa0a0aa88571e56d779424ecd74f189d0730a97 (diff)
downloadsrc-163609768e92c8dbcb40d47349f6d591cb34f7ae.tar.gz
src-163609768e92c8dbcb40d47349f6d591cb34f7ae.zip
Fix printf() format string errors with 64-bit architectures.
Spotted by: pav
Notes
Notes: svn path=/head/; revision=145367
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/netrate/netsend/netsend.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/tools/netrate/netsend/netsend.c b/tools/tools/netrate/netsend/netsend.c
index 66359eb5c49b..a354fef8ce08 100644
--- a/tools/tools/netrate/netsend/netsend.c
+++ b/tools/tools/netrate/netsend/netsend.c
@@ -35,6 +35,7 @@
#include <arpa/inet.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -131,8 +132,8 @@ timing_loop(int s, struct timespec interval, long duration, u_char *packet,
if (timespec_ge(&tmptime, &interval))
fprintf(stderr,
- "warning: interval less than resolution (%d.%09lu)\n",
- tmptime.tv_sec, tmptime.tv_nsec);
+ "warning: interval less than resolution (%jd.%09ld)\n",
+ (intmax_t)tmptime.tv_sec, tmptime.tv_nsec);
if (clock_gettime(CLOCK_REALTIME, &starttime) == -1) {
perror("clock_gettime");
@@ -184,9 +185,9 @@ done:
}
printf("\n");
- printf("start: %d.%09lu\n", starttime.tv_sec,
+ printf("start: %jd.%09ld\n", (intmax_t)starttime.tv_sec,
starttime.tv_nsec);
- printf("finish: %d.%09lu\n", tmptime.tv_sec,
+ printf("finish: %jd.%09ld\n", (intmax_t)tmptime.tv_sec,
tmptime.tv_nsec);
printf("send calls: %ld\n", send_calls);
printf("send errors: %ld\n", send_errors);
@@ -194,8 +195,8 @@ done:
duration);
printf("approx error rate: %ld\n", (send_errors / send_calls));
printf("waited: %lld\n", waited);
- printf("approx waits/sec: %lld\n", waited / duration);
- printf("approx wait rate: %lld\n", waited / send_calls);
+ printf("approx waits/sec: %lld\n", (long long)(waited / duration));
+ printf("approx wait rate: %lld\n", (long long)(waited / send_calls));
return (0);
}
@@ -267,9 +268,9 @@ main(int argc, char *argv[])
interval.tv_sec = 0;
interval.tv_nsec = ((1 * 1000000000) / rate);
}
- printf("Sending packet of payload size %ld every %d.%09lu for %ld "
- "seconds\n", payloadsize, interval.tv_sec, interval.tv_nsec,
- duration);
+ printf("Sending packet of payload size %ld every %jd.%09ld for %ld "
+ "seconds\n", payloadsize, (intmax_t)interval.tv_sec,
+ interval.tv_nsec, duration);
s = socket(PF_INET, SOCK_DGRAM, 0);
if (s == -1) {