Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 049f6b9

Browse files
committed
Properly pass third argument to open() in fsync test program.
Hiroshi Saito
1 parent 11d740e commit 049f6b9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/tools/fsync/test_fsync.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
7272
gettimeofday(&start_t, NULL);
7373
for (i = 0; i < loops; i++)
7474
{
75-
if ((tmpfile = open(filename, O_RDWR)) == -1)
75+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
7676
die("Cannot open output file.");
7777
if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2)
7878
die("write failed");
@@ -90,14 +90,14 @@ main(int argc, char *argv[])
9090
gettimeofday(&start_t, NULL);
9191
for (i = 0; i < loops; i++)
9292
{
93-
if ((tmpfile = open(filename, O_RDWR)) == -1)
93+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
9494
die("Cannot open output file.");
9595
if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2)
9696
die("write failed");
9797
if (fsync(tmpfile) != 0)
9898
die("fsync failed");
9999
close(tmpfile);
100-
if ((tmpfile = open(filename, O_RDWR)) == -1)
100+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
101101
die("Cannot open output file.");
102102
/* do nothing but the open/close the tests are consistent. */
103103
close(tmpfile);
@@ -111,13 +111,13 @@ main(int argc, char *argv[])
111111
gettimeofday(&start_t, NULL);
112112
for (i = 0; i < loops; i++)
113113
{
114-
if ((tmpfile = open(filename, O_RDWR)) == -1)
114+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
115115
die("Cannot open output file.");
116116
if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2)
117117
die("write failed");
118118
close(tmpfile);
119119
/* reopen file */
120-
if ((tmpfile = open(filename, O_RDWR)) == -1)
120+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
121121
die("Cannot open output file.");
122122
if (fsync(tmpfile) != 0)
123123
die("fsync failed");
@@ -132,7 +132,7 @@ main(int argc, char *argv[])
132132

133133
#ifdef OPEN_SYNC_FLAG
134134
/* 16k o_sync write */
135-
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
135+
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1)
136136
die("Cannot open output file.");
137137
gettimeofday(&start_t, NULL);
138138
for (i = 0; i < loops; i++)
@@ -145,7 +145,7 @@ main(int argc, char *argv[])
145145
printf("\n");
146146

147147
/* 2*8k o_sync writes */
148-
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
148+
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1)
149149
die("Cannot open output file.");
150150
gettimeofday(&start_t, NULL);
151151
for (i = 0; i < loops; i++)
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
169169

170170
#ifdef OPEN_DATASYNC_FLAG
171171
/* open_dsync, write */
172-
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
172+
if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1)
173173
die("Cannot open output file.");
174174
gettimeofday(&start_t, NULL);
175175
for (i = 0; i < loops; i++)
@@ -182,7 +182,7 @@ main(int argc, char *argv[])
182182
printf("\n");
183183
#ifdef OPEN_SYNC_FLAG
184184
/* open_fsync, write */
185-
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
185+
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1)
186186
die("Cannot open output file.");
187187
gettimeofday(&start_t, NULL);
188188
for (i = 0; i < loops; i++)
@@ -200,7 +200,7 @@ main(int argc, char *argv[])
200200

201201
#ifdef HAVE_FDATASYNC
202202
/* write, fdatasync */
203-
if ((tmpfile = open(filename, O_RDWR)) == -1)
203+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
204204
die("Cannot open output file.");
205205
gettimeofday(&start_t, NULL);
206206
for (i = 0; i < loops; i++)
@@ -219,7 +219,7 @@ main(int argc, char *argv[])
219219
printf("\n");
220220

221221
/* write, fsync, close */
222-
if ((tmpfile = open(filename, O_RDWR)) == -1)
222+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
223223
die("Cannot open output file.");
224224
gettimeofday(&start_t, NULL);
225225
for (i = 0; i < loops; i++)
@@ -239,7 +239,7 @@ main(int argc, char *argv[])
239239

240240
#ifdef OPEN_DATASYNC_FLAG
241241
/* open_dsync, write */
242-
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
242+
if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1)
243243
die("Cannot open output file.");
244244
gettimeofday(&start_t, NULL);
245245
for (i = 0; i < loops; i++)
@@ -260,7 +260,7 @@ main(int argc, char *argv[])
260260

261261
#ifdef OPEN_SYNC_FLAG
262262
/* open_fsync, write */
263-
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
263+
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1)
264264
die("Cannot open output file.");
265265
gettimeofday(&start_t, NULL);
266266
for (i = 0; i < loops; i++)
@@ -279,7 +279,7 @@ main(int argc, char *argv[])
279279

280280
#ifdef HAVE_FDATASYNC
281281
/* write, fdatasync */
282-
if ((tmpfile = open(filename, O_RDWR)) == -1)
282+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
283283
die("Cannot open output file.");
284284
gettimeofday(&start_t, NULL);
285285
for (i = 0; i < loops; i++)
@@ -300,7 +300,7 @@ main(int argc, char *argv[])
300300
printf("\n");
301301

302302
/* write, fsync, close */
303-
if ((tmpfile = open(filename, O_RDWR)) == -1)
303+
if ((tmpfile = open(filename, O_RDWR, 0)) == -1)
304304
die("Cannot open output file.");
305305
gettimeofday(&start_t, NULL);
306306
for (i = 0; i < loops; i++)

0 commit comments

Comments
 (0)