aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/postgresql
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2023-10-26 14:05:36 +0300
committerthegeorg <thegeorg@yandex-team.com>2023-10-26 14:58:44 +0300
commit4f504885ab6f95bc35471124d1b0107ab0095090 (patch)
tree4f183044d4f4d3834fe7e36f1da23613b70aed42 /contrib/libs/postgresql
parent11864378c1db4609db90c75576ea33f9b0052c11 (diff)
downloadydb-4f504885ab6f95bc35471124d1b0107ab0095090.tar.gz
Prevent contrib/libs/postgresql from depending on contrib/libs/libpq
Diffstat (limited to 'contrib/libs/postgresql')
-rw-r--r--contrib/libs/postgresql/src/include/port/darwin.h8
-rw-r--r--contrib/libs/postgresql/src/include/port/linux.h22
-rw-r--r--contrib/libs/postgresql/src/include/port/win32.h79
3 files changed, 109 insertions, 0 deletions
diff --git a/contrib/libs/postgresql/src/include/port/darwin.h b/contrib/libs/postgresql/src/include/port/darwin.h
new file mode 100644
index 0000000000..15fb69d6db
--- /dev/null
+++ b/contrib/libs/postgresql/src/include/port/darwin.h
@@ -0,0 +1,8 @@
+/* src/include/port/darwin.h */
+
+#define __darwin__ 1
+
+#if HAVE_DECL_F_FULLFSYNC /* not present before macOS 10.3 */
+#define HAVE_FSYNC_WRITETHROUGH
+
+#endif
diff --git a/contrib/libs/postgresql/src/include/port/linux.h b/contrib/libs/postgresql/src/include/port/linux.h
new file mode 100644
index 0000000000..7a6e46cdbb
--- /dev/null
+++ b/contrib/libs/postgresql/src/include/port/linux.h
@@ -0,0 +1,22 @@
+/* src/include/port/linux.h */
+
+/*
+ * As of July 2007, all known versions of the Linux kernel will sometimes
+ * return EIDRM for a shmctl() operation when EINVAL is correct (it happens
+ * when the low-order 15 bits of the supplied shm ID match the slot number
+ * assigned to a newer shmem segment). We deal with this by assuming that
+ * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe
+ * since in fact Linux has no excuse for ever returning EIDRM; it doesn't
+ * track removed segments in a way that would allow distinguishing them from
+ * private ones. But someday that code might get upgraded, and we'd have
+ * to have a kernel version test here.
+ */
+#define HAVE_LINUX_EIDRM_BUG
+
+/*
+ * Set the default wal_sync_method to fdatasync. With recent Linux versions,
+ * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't
+ * perform better and (b) causes outright failures on ext4 data=journal
+ * filesystems, because those don't support O_DIRECT.
+ */
+#define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
diff --git a/contrib/libs/postgresql/src/include/port/win32.h b/contrib/libs/postgresql/src/include/port/win32.h
new file mode 100644
index 0000000000..c6213c77c3
--- /dev/null
+++ b/contrib/libs/postgresql/src/include/port/win32.h
@@ -0,0 +1,79 @@
+/* src/include/port/win32.h */
+
+/*
+ * We always rely on the WIN32 macro being set by our build system,
+ * but _WIN32 is the compiler pre-defined macro. So make sure we define
+ * WIN32 whenever _WIN32 is set, to facilitate standalone building.
+ */
+#if defined(_WIN32) && !defined(WIN32)
+#define WIN32
+#endif
+
+/*
+ * Make sure _WIN32_WINNT has the minimum required value.
+ * Leave a higher value in place. When building with at least Visual
+ * Studio 2015 the minimum requirement is Windows Vista (0x0600) to
+ * get support for GetLocaleInfoEx() with locales. For everything else
+ * the minimum version is Windows XP (0x0501).
+ */
+#if defined(_MSC_VER) && _MSC_VER >= 1900
+#define MIN_WINNT 0x0600
+#else
+#define MIN_WINNT 0x0501
+#endif
+
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
+#undef _WIN32_WINNT
+#endif
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT MIN_WINNT
+#endif
+
+/*
+ * We need to prevent <crtdefs.h> from defining a symbol conflicting with
+ * our errcode() function. Since it's likely to get included by standard
+ * system headers, pre-emptively include it now.
+ */
+#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H)
+#define errcode __msvc_errcode
+#include <crtdefs.h>
+#undef errcode
+#endif
+
+/*
+ * defines for dynamic linking on Win32 platform
+ */
+
+/*
+ * Variables declared in the core backend and referenced by loadable
+ * modules need to be marked "dllimport" in the core build, but
+ * "dllexport" when the declaration is read in a loadable module.
+ * No special markings should be used when compiling frontend code.
+ */
+#ifndef FRONTEND
+#ifdef BUILDING_DLL
+#define PGDLLIMPORT __declspec (dllexport)
+#else
+#define PGDLLIMPORT __declspec (dllimport)
+#endif
+#endif
+
+/*
+ * Under MSVC, functions exported by a loadable module must be marked
+ * "dllexport". Other compilers don't need that.
+ */
+#ifdef _MSC_VER
+#define PGDLLEXPORT __declspec (dllexport)
+#endif
+
+/*
+ * Windows headers don't define this structure, but you can define it yourself
+ * to use the functionality.
+ */
+struct sockaddr_un
+{
+ unsigned short sun_family;
+ char sun_path[108];
+};
+#define HAVE_STRUCT_SOCKADDR_UN 1