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

Commit558bc25

Browse files
committed
Fix fsync code to test whether F_FULLFSYNC is available, instead of
assuming it always is on Darwin. Per report from Neil Brandt.
1 parentf3dda5b commit558bc25

File tree

5 files changed

+90
-4
lines changed

5 files changed

+90
-4
lines changed

‎configure

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13230,6 +13230,81 @@ fi
1323013230

1323113231
fi
1323213232

13233+
# This is probably only present on Darwin, but may as well check always
13234+
echo "$as_me:$LINENO: checking whether F_FULLFSYNC is declared" >&5
13235+
echo $ECHO_N "checking whether F_FULLFSYNC is declared... $ECHO_C" >&6
13236+
if test "${ac_cv_have_decl_F_FULLFSYNC+set}" = set; then
13237+
echo $ECHO_N "(cached) $ECHO_C" >&6
13238+
else
13239+
cat >conftest.$ac_ext <<_ACEOF
13240+
/* confdefs.h. */
13241+
_ACEOF
13242+
cat confdefs.h >>conftest.$ac_ext
13243+
cat >>conftest.$ac_ext <<_ACEOF
13244+
/* end confdefs.h. */
13245+
#include <fcntl.h>
13246+
13247+
int
13248+
main ()
13249+
{
13250+
#ifndef F_FULLFSYNC
13251+
char *p = (char *) F_FULLFSYNC;
13252+
#endif
13253+
13254+
;
13255+
return 0;
13256+
}
13257+
_ACEOF
13258+
rm -f conftest.$ac_objext
13259+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
13260+
(eval $ac_compile) 2>conftest.er1
13261+
ac_status=$?
13262+
grep -v '^ *+' conftest.er1 >conftest.err
13263+
rm -f conftest.er1
13264+
cat conftest.err >&5
13265+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
13266+
(exit $ac_status); } &&
13267+
{ ac_try='test -z "$ac_c_werror_flag"
13268+
|| test ! -s conftest.err'
13269+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13270+
(eval $ac_try) 2>&5
13271+
ac_status=$?
13272+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
13273+
(exit $ac_status); }; } &&
13274+
{ ac_try='test -s conftest.$ac_objext'
13275+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13276+
(eval $ac_try) 2>&5
13277+
ac_status=$?
13278+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
13279+
(exit $ac_status); }; }; then
13280+
ac_cv_have_decl_F_FULLFSYNC=yes
13281+
else
13282+
echo "$as_me: failed program was:" >&5
13283+
sed 's/^/| /' conftest.$ac_ext >&5
13284+
13285+
ac_cv_have_decl_F_FULLFSYNC=no
13286+
fi
13287+
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
13288+
fi
13289+
echo "$as_me:$LINENO: result: $ac_cv_have_decl_F_FULLFSYNC" >&5
13290+
echo "${ECHO_T}$ac_cv_have_decl_F_FULLFSYNC" >&6
13291+
if test $ac_cv_have_decl_F_FULLFSYNC = yes; then
13292+
13293+
cat >>confdefs.h <<_ACEOF
13294+
#define HAVE_DECL_F_FULLFSYNC 1
13295+
_ACEOF
13296+
13297+
13298+
else
13299+
cat >>confdefs.h <<_ACEOF
13300+
#define HAVE_DECL_F_FULLFSYNC 0
13301+
_ACEOF
13302+
13303+
13304+
fi
13305+
13306+
13307+
1323313308
##
1323413309
## Functions, global variables
1323513310
##

‎configure.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.442 2006/01/12 19:23:22 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.443 2006/01/1723:52:30 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -810,6 +810,9 @@ if test "$with_krb5" = yes; then
810810
[#include <krb5.h>])
811811
fi
812812

813+
# This is probably only present on Darwin, but may as well check always
814+
AC_CHECK_DECLS(F_FULLFSYNC, [], [], [#include <fcntl.h>])
815+
813816
##
814817
## Functions, global variables
815818
##

‎src/backend/storage/file/fd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.124 2005/12/08 15:38:29 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.125 2006/01/17 23:52:31 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -265,13 +265,15 @@ int
265265
pg_fsync_writethrough(intfd)
266266
{
267267
if (enableFsync)
268+
{
268269
#ifdefWIN32
269270
return_commit(fd);
270-
#elif defined(__darwin__)
271-
return (fcntl(fd,F_FULLFSYNC,0)==-1) ?-1 :0;
271+
#elif defined(F_FULLFSYNC)
272+
return (fcntl(fd,F_FULLFSYNC,0)==-1) ?-1 :0;
272273
#else
273274
return-1;
274275
#endif
276+
}
275277
else
276278
return0;
277279
}

‎src/include/pg_config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
don't. */
7373
#undef HAVE_DECL_FDATASYNC
7474

75+
/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
76+
don't. */
77+
#undef HAVE_DECL_F_FULLFSYNC
78+
7579
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
7680
don't. */
7781
#undef HAVE_DECL_SNPRINTF

‎src/include/port/darwin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#define__darwin__1
22

3+
#ifHAVE_DECL_F_FULLFSYNC/* not present before OS X 10.3 */
34
#defineHAVE_FSYNC_WRITETHROUGH
5+
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp