diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-18 18:30:21 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-18 18:30:21 +0000 |
commit | 1e8ae136407f2aedd07cc748589f46087b98b950 (patch) | |
tree | 711fa053681b05a10270210d6c13f9e73d6e3536 /src | |
parent | 22045666d62ed5742fbdf4b1548fe1e30533684f (diff) | |
download | postgresql-1e8ae136407f2aedd07cc748589f46087b98b950.tar.gz postgresql-1e8ae136407f2aedd07cc748589f46087b98b950.zip |
Don't try to call posix_fadvise() unless <fcntl.h> supplies a declaration
for it. Hopefully will fix core dump evidenced by some buildfarm members
since fadvise patch went in. The actual definition of the function is not
ABI-compatible with compiler's default assumption in the absence of any
declaration, so it's clearly unsafe to try to call it without seeing a
declaration.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xlog.c | 12 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 57a8d1833d8..85618fcf01c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.239 2006/06/16 04:11:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.240 2006/06/18 18:30:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2147,11 +2147,13 @@ XLogFileClose(void) { Assert(openLogFile >= 0); -#ifdef POSIX_FADV_DONTNEED +#if defined(HAVE_DECL_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) /* - * WAL caches will not be accessed in the future, so we advise OS to - * free them. But we will not do so if WAL archiving is active, - * because archivers might use the caches to read the WAL segment. + * WAL segment files will not be re-read in normal operation, so we advise + * OS to release any cached pages. But do not do so if WAL archiving is + * active, because archiver process could use the cache to read the WAL + * segment. + * * While O_DIRECT works for O_SYNC, posix_fadvise() works for fsync() * and O_SYNC, and some platforms only have posix_fadvise(). */ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 5ccfbfefd28..82ccde63c1c 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -76,6 +76,10 @@ don't. */ #undef HAVE_DECL_F_FULLFSYNC +/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you + don't. */ +#undef HAVE_DECL_POSIX_FADVISE + /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #undef HAVE_DECL_SNPRINTF |