pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

galera: handle ftruncate() issue on NetBSD



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Thu Jan 12 13:36:10 2023 +0100
Changeset:	09de029c19fb7ab21bc393d384b6d85699ca5492

Modified Files:
	galera/distinfo
Added Files:
	galera/patches/patch-galerautils_src_gu__fdesc.cpp

Log Message:
galera: handle ftruncate() issue on NetBSD

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=09de029c19fb7ab21bc393d384b6d85699ca5492

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 galera/distinfo                                    |  1 +
 galera/patches/patch-galerautils_src_gu__fdesc.cpp | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diffs:
diff --git a/galera/distinfo b/galera/distinfo
index 90dd292c60..acba220a17 100644
--- a/galera/distinfo
+++ b/galera/distinfo
@@ -13,6 +13,7 @@ SHA1 (patch-galerautils_src_gu__arch.h) = 317bac921afb5cf8134e2a93dbd6984d4018e7
 SHA1 (patch-galerautils_src_gu__asio__socket__util.hpp) = bdbd2481f45f1ca9063944288e3933e56e863839
 SHA1 (patch-galerautils_src_gu__crc32c__arm64.c) = 8ed40c8e4c5824f762b8bfc64e65f2ea1827cd71
 SHA1 (patch-galerautils_src_gu__errno.h) = cb5ac99b3a77a865fe1c40b3553284ce795db003
+SHA1 (patch-galerautils_src_gu__fdesc.cpp) = d72f5142f32b602a20ac77275ef3d9bddaeb0ee9
 SHA1 (patch-galerautils_src_gu__limits.c) = 9d7a7315f17670fff836dfafd641196c2cdf51cc
 SHA1 (patch-galerautils_src_gu__resolver.cpp) = a057a5802d38cbf716a1a1a493ea5ae7e41eba09
 SHA1 (patch-galerautils_src_gu__system.h) = 9d0062df2878af8277a6fe2de072d5fefc297e4f
diff --git a/galera/patches/patch-galerautils_src_gu__fdesc.cpp b/galera/patches/patch-galerautils_src_gu__fdesc.cpp
new file mode 100644
index 0000000000..b638b0bf84
--- /dev/null
+++ b/galera/patches/patch-galerautils_src_gu__fdesc.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+NetBSD man page suggests ftruncate() before posix_fallocate().
+Also recognize NetBSD's errno if unsupported.
+
+--- galerautils/src/gu_fdesc.cpp.orig	2022-11-02 06:09:14.000000000 +0000
++++ galerautils/src/gu_fdesc.cpp
+@@ -235,13 +235,16 @@ namespace gu
+ #if defined(__APPLE__)
+         if (-1 == fcntl (fd_, F_SETSIZE, size_) && -1 == ftruncate (fd_, size_))
+         {
++#elif defined(__NetBSD__)
++        if (-1 == ftruncate (fd_, size_) || 0 != posix_fallocate (fd_, start, diff))
++        {
+ #else
+         int const ret = posix_fallocate (fd_, start, diff);
+         if (0 != ret)
+         {
+             errno = ret;
+ #endif
+-            if ((EINVAL == errno || ENOSYS == errno) && start >= 0 && diff > 0)
++            if ((EINVAL == errno || ENOSYS == errno || EOPNOTSUPP == errno) && start >= 0 && diff > 0)
+             {
+                 // FS does not support the operation, try physical write
+                 write_file (start);


Home | Main Index | Thread Index | Old Index