Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5777dca

Browse files
committed
Fix test_fsync compile on MinGW(win32)
Hiroshi Saito
1 parent47df6e7 commit5777dca

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

‎src/tools/fsync/Makefile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1+
#-------------------------------------------------------------------------
12
#
2-
# Makefile
3+
# Makefile for src/tools/fsync
34
#
5+
# Copyright (c) 2003-2006, PostgreSQL Global Development Group
46
#
5-
TARGET = test_fsync
6-
XFLAGS =
7-
CFLAGS = -O
8-
LIBS =
7+
# $PostgreSQL: pgsql/src/tools/fsync/Makefile,v 1.3 2006/10/13 14:19:29 momjian Exp $
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
subdir = src/tools/fsync
12+
top_builddir = ../../..
13+
include$(top_builddir)/src/Makefile.global
14+
15+
overrideCPPFLAGS := -DFRONTEND -I$(libpq_srcdir)$(CPPFLAGS)
916

10-
$(TARGET) : test_fsync.o
11-
$(CC) -o$(TARGET)$(XFLAGS)$(CFLAGS) test_fsync.o$(LIBS)
17+
OBJS= test_fsync.o
1218

13-
test_fsync.o: test_fsync.c
14-
$(CC) -c$(XFLAGS)$(CFLAGS) test_fsync.c
19+
all: submake-libpq submake-libpgport test_fsync
1520

16-
clean:
17-
rm -f*.o$(TARGET) log core
21+
test_fsync: test_fsync.o$(libpq_builddir)/libpq.a
22+
$(CC)$(CFLAGS) test_fsync.o$(libpq_pgport)$(LDFLAGS)$(LIBS) -o$@$(X)
1823

19-
install:
20-
make clean
21-
make CFLAGS=-O
22-
install -s -o bin -g bin$(TARGET) /usr/local/bin
24+
cleandistcleanmaintainer-clean:
25+
rm -f test_fsync$(X)$(OBJS)

‎src/tools/fsync/test_fsync.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include"../../include/pg_config.h"
7+
#include"../../include/pg_config_os.h"
78

89
#include<sys/types.h>
910
#include<sys/stat.h>
@@ -14,13 +15,19 @@
1415
#include<sys/time.h>
1516
#include<unistd.h>
1617

18+
#ifdefWIN32
19+
#defineFSYNC_FILENAME"./test_fsync.out"
20+
#else
1721
#defineFSYNC_FILENAME"/var/tmp/test_fsync.out"
22+
#endif
1823

1924
/* O_SYNC and O_FSYNC are the same */
2025
#if defined(O_SYNC)
2126
#defineOPEN_SYNC_FLAGO_SYNC
2227
#elif defined(O_FSYNC)
2328
#defineOPEN_SYNC_FLAGO_FSYNC
29+
#elif defined(O_DSYNC)
30+
#defineOPEN_DATASYNC_FLAGO_DSYNC
2431
#endif
2532

2633
#if defined(OPEN_SYNC_FLAG)
@@ -122,6 +129,7 @@ main(int argc, char *argv[])
122129

123130
printf("\nCompare one o_sync write to two:\n");
124131

132+
#ifdefOPEN_SYNC_FLAG
125133
/* 16k o_sync write */
126134
if ((tmpfile=open(filename,O_RDWR |OPEN_SYNC_FLAG))==-1)
127135
die("Cannot open output file.");
@@ -150,6 +158,10 @@ main(int argc, char *argv[])
150158
printf("\n");
151159

152160
printf("\nCompare file sync methods with one 8k write:\n");
161+
#else
162+
printf("\t(o_sync unavailable) ");
163+
#endif
164+
printf("\n");
153165

154166
#ifdefOPEN_DATASYNC_FLAG
155167
/* open_dsync, write */
@@ -162,11 +174,8 @@ main(int argc, char *argv[])
162174
close(tmpfile);
163175
printf("\topen o_dsync, write ");
164176
print_elapse(start_t,elapse_t);
165-
#else
166-
printf("\t(o_dsync unavailable) ");
167-
#endif
168177
printf("\n");
169-
178+
#ifdefOPEN_SYNC_FLAG
170179
/* open_fsync, write */
171180
if ((tmpfile=open(filename,O_RDWR |OPEN_SYNC_FLAG))==-1)
172181
die("Cannot open output file.");
@@ -177,6 +186,10 @@ main(int argc, char *argv[])
177186
close(tmpfile);
178187
printf("\topen o_sync, write ");
179188
print_elapse(start_t,elapse_t);
189+
#endif
190+
#else
191+
printf("\t(o_dsync unavailable) ");
192+
#endif
180193
printf("\n");
181194

182195
#ifdefHAVE_FDATASYNC
@@ -234,6 +247,7 @@ main(int argc, char *argv[])
234247
#endif
235248
printf("\n");
236249

250+
#ifdefOPEN_SYNC_FLAG
237251
/* open_fsync, write */
238252
if ((tmpfile=open(filename,O_RDWR |OPEN_SYNC_FLAG))==-1)
239253
die("Cannot open output file.");
@@ -248,6 +262,7 @@ main(int argc, char *argv[])
248262
printf("\topen o_sync, write ");
249263
print_elapse(start_t,elapse_t);
250264
printf("\n");
265+
#endif
251266

252267
#ifdefHAVE_FDATASYNC
253268
/* write, fdatasync */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp