From 7c99892354500f046995acddc0789879a50a1096 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Mon, 19 Jul 2021 22:26:34 +0000
Subject: [PATCH 2/2] XXX Test

---
 src/backend/storage/file/fd.c         | 2 ++
 src/bin/pg_test_fsync/pg_test_fsync.c | 2 ++
 src/include/storage/fd.h              | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 78ac2caa8f..248e2c3cd4 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -1098,9 +1098,11 @@ tryAgain:
 			int			rc;
 
 #if defined(PG_O_DIRECT_USE_F_NOCACHE)
+			elog(LOG, "XXX F_NOCACHE"); /* HACK */
 			rc = fcntl(fd, F_NOCACHE, 1);
 #endif
 #if defined(PG_O_DIRECT_USE_DIRECTIO_ON)
+			elog(LOG, "XXX DIRECTIO_ON");	/* HACK */
 			rc = directio(fd, DIRECTIO_ON);
 #endif
 			if (rc < 0)
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index f5e3868c10..7396886cec 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -17,6 +17,8 @@
 #include "common/logging.h"
 #include "getopt_long.h"
 
+#undef O_DIRECT					/* HACK: make Illumos behave like Solaris */
+
 /*
  * put the temp files in the local directory
  * unless the user specifies otherwise
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index b04988f818..2c09639cf1 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -79,6 +79,8 @@ extern int	max_safe_fds;
 #define FILE_POSSIBLY_DELETED(err)	((err) == ENOENT || (err) == EACCES)
 #endif
 
+#undef O_DIRECT					/* HACK: make Illumos behave like Solaris */
+
 /*
  * O_DIRECT is not standard, but almost every Unix has it.  We translate it
  * to the appropriate Windows flag in src/port/open.c.  We simulate it with
-- 
2.30.2

