$NetBSD: patch-ag,v 1.2 2005/11/07 15:46:26 joerg Exp $ --- src/fstime.c.orig 1999-07-28 21:47:02.000000000 +0000 +++ src/fstime.c @@ -88,7 +88,7 @@ int g; int i; void stop_count(); void clean_up(); -int sigalarm = 0; +static volatile sig_atomic_t sigalarm = 0; /******************** MAIN ****************************/ @@ -149,13 +149,14 @@ int w_test(void) unsigned long counted = 0L; unsigned long tmp; long f_blocks; - extern int sigalarm; +#ifndef __INTERIX /* Sync and let it settle */ sync(); sleep(2); sync(); sleep(1); +#endif signal(SIGALRM,stop_count); sigalarm = 0; /* reset alarm flag */ @@ -176,6 +177,8 @@ int w_test(void) lseek(f, 0L, 0); /* rewind */ } + fsync(f); + /* stop clock */ fprintf(stderr, "%d second sample\n", seconds); write_score = counted/((long)seconds * COUNTPERK); @@ -191,14 +194,14 @@ int r_test(void) { unsigned long counted = 0L; unsigned long tmp; - extern int sigalarm; - extern int errno; +#ifndef __INTERIX /* Sync and let it settle */ sync(); sleep(2 + seconds/4); sync(); sleep(1 + seconds/4); +#endif /* rewind */ errno = 0; @@ -229,6 +232,8 @@ int r_test(void) counted += COUNTPERBUF; } + fsync(f); + /* stop clock */ fprintf(stderr, "%d second sample\n", seconds); read_score = counted / ((long)seconds * COUNTPERK); @@ -244,7 +249,6 @@ int c_test(void) { unsigned long counted = 0L; unsigned long tmp; - extern int sigalarm; sync(); sleep(2 + seconds/4); @@ -309,7 +313,6 @@ int c_test(void) void stop_count(void) { - extern int sigalarm; sigalarm = 1; }