Lines 1-52
Link Here
|
1 |
*** fileio.c.orig Mon Sep 10 08:21:01 2001 |
|
|
2 |
--- fileio.c Sun Feb 17 02:06:34 2002 |
3 |
*************** |
4 |
*** 18,23 **** |
5 |
--- 18,27 ---- |
6 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
7 |
*/ |
8 |
|
9 |
+ #if (defined(__unix__) || defined(unix)) && !defined(USG) |
10 |
+ #include <sys/param.h> |
11 |
+ #endif |
12 |
+ |
13 |
#include "dbench.h" |
14 |
|
15 |
#define MAX_FILES 1000 |
16 |
*************** |
17 |
*** 58,64 **** |
18 |
--- 62,73 ---- |
19 |
copy_name, |
20 |
strerror(errno)); |
21 |
} else { |
22 |
+ #ifdef BSD |
23 |
+ if (fsync(dir_fd) == -1) { |
24 |
+ #else |
25 |
if (fdatasync(dir_fd) == -1) { |
26 |
+ #endif /* BSD */ |
27 |
+ |
28 |
printf("datasync directory \"%s\" failed: %s\n", |
29 |
copy_name, |
30 |
strerror(errno)); |
31 |
*************** |
32 |
*** 111,118 **** |
33 |
if (size == 0) flags |= O_TRUNC; |
34 |
|
35 |
if (sync_open) |
36 |
flags |= O_SYNC; |
37 |
! |
38 |
fd = open(fname, flags, 0600); |
39 |
if (fd == -1) { |
40 |
printf("(%d) open %s failed for handle %d (%s)\n", |
41 |
--- 120,130 ---- |
42 |
if (size == 0) flags |= O_TRUNC; |
43 |
|
44 |
if (sync_open) |
45 |
+ #ifdef BSD |
46 |
+ flags |= O_FSYNC; |
47 |
+ #else |
48 |
flags |= O_SYNC; |
49 |
! #endif /* BSD */ |
50 |
fd = open(fname, flags, 0600); |
51 |
if (fd == -1) { |
52 |
printf("(%d) open %s failed for handle %d (%s)\n", |