mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix fsync code to test whether F_FULLFSYNC is available, instead of
assuming it always is on Darwin. Per report from Neil Brandt.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.124 2005/12/08 15:38:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.125 2006/01/17 23:52:31 tgl Exp $
|
||||
*
|
||||
* NOTES:
|
||||
*
|
||||
@ -265,13 +265,15 @@ int
|
||||
pg_fsync_writethrough(int fd)
|
||||
{
|
||||
if (enableFsync)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return _commit(fd);
|
||||
#elif defined(__darwin__)
|
||||
return (fcntl(fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
|
||||
#elif defined(F_FULLFSYNC)
|
||||
return (fcntl(fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -72,6 +72,10 @@
|
||||
don't. */
|
||||
#undef HAVE_DECL_FDATASYNC
|
||||
|
||||
/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_F_FULLFSYNC
|
||||
|
||||
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SNPRINTF
|
||||
|
@ -1,3 +1,5 @@
|
||||
#define __darwin__ 1
|
||||
|
||||
#if HAVE_DECL_F_FULLFSYNC /* not present before OS X 10.3 */
|
||||
#define HAVE_FSYNC_WRITETHROUGH
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user