summaryrefslogtreecommitdiff
path: root/benchmarks/bytebench/patches/patch-ag
blob: 887decc42f7a0eae469c11c6f6965c24937e676d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$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;
 }