Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5777dca4
Commit
5777dca4
authored
Oct 13, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test_fsync compile on MinGW(win32)
Hiroshi Saito
parent
47df6e7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
19 deletions
+37
-19
src/tools/fsync/Makefile
src/tools/fsync/Makefile
+18
-15
src/tools/fsync/test_fsync.c
src/tools/fsync/test_fsync.c
+19
-4
No files found.
src/tools/fsync/Makefile
View file @
5777dca4
#-------------------------------------------------------------------------
#
# Makefile
# Makefile
for src/tools/fsync
#
# Copyright (c) 2003-2006, PostgreSQL Global Development Group
#
TARGET
=
test_fsync
XFLAGS
=
CFLAGS
=
-O
LIBS
=
# $PostgreSQL: pgsql/src/tools/fsync/Makefile,v 1.3 2006/10/13 14:19:29 momjian Exp $
#
#-------------------------------------------------------------------------
subdir
=
src/tools/fsync
top_builddir
=
../../..
include
$(top_builddir)/src/Makefile.global
override CPPFLAGS
:
= -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
$(TARGET)
:
test_fsync.o
$(CC)
-o
$(TARGET)
$(XFLAGS)
$(CFLAGS)
test_fsync.o
$(LIBS)
OBJS
=
test_fsync.o
test_fsync.o
:
test_fsync.c
$(CC)
-c
$(XFLAGS)
$(CFLAGS)
test_fsync.c
all
:
submake-libpq submake-libpgport test_fsync
clean
:
rm
-f
*
.o
$(TARGET)
log core
test_fsync
:
test_fsync.o $(libpq_builddir)/libpq.a
$(CC)
$(CFLAGS)
test_fsync.o
$(libpq_pgport)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
install
:
make clean
make
CFLAGS
=
-O
install
-s
-o
bin
-g
bin
$(TARGET)
/usr/local/bin
clean distclean maintainer-clean
:
rm
-f
test_fsync
$(X)
$(OBJS)
src/tools/fsync/test_fsync.c
View file @
5777dca4
...
...
@@ -4,6 +4,7 @@
*/
#include "../../include/pg_config.h"
#include "../../include/pg_config_os.h"
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -14,13 +15,19 @@
#include <sys/time.h>
#include <unistd.h>
#ifdef WIN32
#define FSYNC_FILENAME "./test_fsync.out"
#else
#define FSYNC_FILENAME "/var/tmp/test_fsync.out"
#endif
/* O_SYNC and O_FSYNC are the same */
#if defined(O_SYNC)
#define OPEN_SYNC_FLAG O_SYNC
#elif defined(O_FSYNC)
#define OPEN_SYNC_FLAG O_FSYNC
#elif defined(O_DSYNC)
#define OPEN_DATASYNC_FLAG O_DSYNC
#endif
#if defined(OPEN_SYNC_FLAG)
...
...
@@ -122,6 +129,7 @@ main(int argc, char *argv[])
printf
(
"
\n
Compare one o_sync write to two:
\n
"
);
#ifdef OPEN_SYNC_FLAG
/* 16k o_sync write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"Cannot open output file."
);
...
...
@@ -150,6 +158,10 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
Compare file sync methods with one 8k write:
\n
"
);
#else
printf
(
"
\t
(o_sync unavailable) "
);
#endif
printf
(
"
\n
"
);
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
...
...
@@ -162,11 +174,8 @@ main(int argc, char *argv[])
close
(
tmpfile
);
printf
(
"
\t
open o_dsync, write "
);
print_elapse
(
start_t
,
elapse_t
);
#else
printf
(
"
\t
(o_dsync unavailable) "
);
#endif
printf
(
"
\n
"
);
#ifdef OPEN_SYNC_FLAG
/* open_fsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"Cannot open output file."
);
...
...
@@ -177,6 +186,10 @@ main(int argc, char *argv[])
close
(
tmpfile
);
printf
(
"
\t
open o_sync, write "
);
print_elapse
(
start_t
,
elapse_t
);
#endif
#else
printf
(
"
\t
(o_dsync unavailable) "
);
#endif
printf
(
"
\n
"
);
#ifdef HAVE_FDATASYNC
...
...
@@ -234,6 +247,7 @@ main(int argc, char *argv[])
#endif
printf
(
"
\n
"
);
#ifdef OPEN_SYNC_FLAG
/* open_fsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"Cannot open output file."
);
...
...
@@ -248,6 +262,7 @@ main(int argc, char *argv[])
printf
(
"
\t
open o_sync, write "
);
print_elapse
(
start_t
,
elapse_t
);
printf
(
"
\n
"
);
#endif
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment