strout[i] = 'a';
if ((tmpfile = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
write(tmpfile, strout, WAL_FILE_SIZE);
fsync(tmpfile); /* fsync so later fsync's don't have to do it */
close(tmpfile);
for (i = 0; i < loops; i++)
{
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
write(tmpfile, strout, 8192);
close(tmpfile);
}
for (i = 0; i < loops; i++)
{
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
write(tmpfile, strout, 8192);
fsync(tmpfile);
close(tmpfile);
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
/* do nothing but the open/close the tests are consistent. */
close(tmpfile);
}
for (i = 0; i < loops; i++)
{
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
write(tmpfile, strout, 8192);
close(tmpfile);
/* reopen file */
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
fsync(tmpfile);
close(tmpfile);
}
/* 16k o_sync write */
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
write(tmpfile, strout, 16384);
/* 2*8k o_sync writes */
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
write(tmpfile, strout, 8192);
/* open_fsync, write */
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
write(tmpfile, strout, 8192);
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
/* write, fsync, close */
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
/* open_fsync, write */
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
/* write, fsync, close */
if ((tmpfile = open(filename, O_RDWR)) == -1)
- die("can't open /var/tmp/test_fsync.out");
+ die("Cannot open output file.");
gettimeofday(&start_t, NULL);
for (i = 0; i < loops; i++)
{
void
die(char *str)
{
- fprintf(stderr, "%s", str);
+ fprintf(stderr, "%s\n", str);
exit(1);
}