diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-17 23:52:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-17 23:52:31 +0000 |
commit | 558bc2584d7e79801acb8344b79838cd3511915b (patch) | |
tree | e1cb52137df9ea82b0bc9c85c80d68445b2763e4 /src | |
parent | f3dda5be890dfdd6a3fae6ff21737307fcc6c0a8 (diff) | |
download | postgresql-558bc2584d7e79801acb8344b79838cd3511915b.tar.gz postgresql-558bc2584d7e79801acb8344b79838cd3511915b.zip |
Fix fsync code to test whether F_FULLFSYNC is available, instead of
assuming it always is on Darwin. Per report from Neil Brandt.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/storage/file/fd.c | 8 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 4 | ||||
-rw-r--r-- | src/include/port/darwin.h | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index b7f1c3f5a25..496fc481633 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -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; } diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 27b14ca2ea5..2c24ce3d811 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -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 diff --git a/src/include/port/darwin.h b/src/include/port/darwin.h index 2b7600bebeb..af4ce9b3856 100644 --- a/src/include/port/darwin.h +++ b/src/include/port/darwin.h @@ -1,3 +1,5 @@ #define __darwin__ 1 +#if HAVE_DECL_F_FULLFSYNC /* not present before OS X 10.3 */ #define HAVE_FSYNC_WRITETHROUGH +#endif |