From 3f4afbeedb1828b239fb880bb79fd06399977194 Mon Sep 17 00:00:00 2001 From: wmarcusm Date: Wed, 1 May 2002 21:30:59 +0000 Subject: [PATCH] WMM difftime() macro causing general protect faults when type int is promoted to double. Perhaps a gcc code generation bug. --- lustre/utils/obdctl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/utils/obdctl.c b/lustre/utils/obdctl.c index 31fbfc3..ce3b768 100644 --- a/lustre/utils/obdctl.c +++ b/lustre/utils/obdctl.c @@ -146,9 +146,14 @@ int getfd(char *func) return 0; } +/* #define difftime(a, b) \ ((double)(a)->tv_sec - (b)->tv_sec + \ ((double)((a)->tv_usec - (b)->tv_usec) / 1000000)) +*/ + +#define difftime(a, b) (((a)->tv_sec - (b)->tv_sec) + \ + (((a)->tv_usec - (b)->tv_usec) / 1000000)) static int be_verbose(int verbose, struct timeval *next_time, int num, int *next_num, int num_total) @@ -193,7 +198,9 @@ static int get_verbose(const char *arg) else if (arg[0] == 's' || arg[0] == 'q') verbose = 0; else - verbose = strtoul(arg, NULL, 0); + verbose = (int) strtoul(arg, NULL, 0); + + printf("Verbose = %d\n",verbose); return verbose; } @@ -758,9 +765,11 @@ static int jt_test_getattr(int argc, char **argv) fprintf(stderr, "error: %s: #%d - %s\n", cmdname(argv[0]), i, strerror(rc = errno)); break; - } else if (be_verbose(verbose, &next_time, i,&next_count,count)) + } else { + if (be_verbose(verbose, &next_time, i,&next_count,count)) printf("%s: got attr #%d\n", cmdname(argv[0]), i); - } + } + } if (!rc) { struct timeval end; -- 1.8.3.1