From: Michael Banck <mbanck@gmx.net>
To: pgsql-hackers@lists.postgresql.org
Subject: GNU/Hurd portability patches
Date: Mon, 30 Jun 2025 21:43:13 +0200
Message-ID: <6862e8d1.050a0220.194b8d.76fa@mx.google.com> (raw)
Hi,
please find attached the current patches required to get master built
and the testsuites run on Debian's hurd-i386 port. I have not had the
time to test the hurd-amd64 port in the same fashion, but will do so
next.
As mentioned in this thread[1], one needs a fairly recent kernel for the
high-resolution timers in order to avoid regression test failures, and
the buildfarm client run does not like debug_parallel_query.
Michael
[1] https://www.postgresql.org/message-id/685a3ccd.170a0220.2d27e6.2232%40mx.google.comAttachments:
[text/x-diff] 0001-Make-safeguard-against-incorrect-fd-flags-for-fsync-.patch (1.2K, ../6862e8d1.050a0220.194b8d.76fa@mx.google.com/2-0001-Make-safeguard-against-incorrect-fd-flags-for-fsync-.patch)
download | inline diff:
From 2cf70fa676bacf97c24fd0b80bab6fec06b9f2db Mon Sep 17 00:00:00 2001
From: Michael Banck <mbanck@debian.org>
Date: Tue, 10 Jun 2025 12:23:17 +0200
Subject: [PATCH 1/2] Make safeguard against incorrect fd flags for fsync more
portable.
The current code assumed that O_RDONLY is defined as 0, but this is not
universally the case. To fix this, mask the flags with O_ACCMODE and
assert that they are O_RDONLY for directories or not O_RDONLY for files.
Co-authored-by: Samuel Thibault
---
src/backend/storage/file/fd.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.cindex 0e8299dd556..cd1e661974a 100644--- a/src/backend/storage/file/fd.c+++ b/src/backend/storage/file/fd.c@@ -411,14 +411,12 @@ pg_fsync(int fd)
{
int desc_flags = fcntl(fd, F_GETFL);
- /*- * O_RDONLY is historically 0, so just make sure that for directories- * no write flags are used.- */+ desc_flags &= O_ACCMODE;+
if (S_ISDIR(st.st_mode))
- Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);+ Assert(desc_flags == O_RDONLY);
else
- Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);+ Assert(desc_flags != O_RDONLY);
}
errno = 0;
#endif
--
2.39.5
[text/x-diff] 0002-Make-sure-IOV_MAX-is-defined.patch (1.3K, ../6862e8d1.050a0220.194b8d.76fa@mx.google.com/3-0002-Make-sure-IOV_MAX-is-defined.patch)
download | inline diff:
From 1dec060f19bc3bea23ec3b2b97f93b0b60fdd63e Mon Sep 17 00:00:00 2001
From: Michael Banck <mbanck@debian.org>
Date: Tue, 10 Jun 2025 23:34:14 +0200
Subject: [PATCH 2/2] Make sure IOV_MAX is defined.
We stopped defining IOV_MAX on non-Windows systems since 75357ab9 under
the assumption that every non-Windows system defines it in limits.h
already. However, the GNU (Hurd) system does not define this limit.
As POSIX does not mandate IOV_MAX be defined, define it to 16 if it is
undefined.
Co-authored-by: Christoph Berg
---
src/include/port/pg_iovec.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.hindex df40c7208be..d29721bc7e4 100644--- a/src/include/port/pg_iovec.h+++ b/src/include/port/pg_iovec.h@@ -21,9 +21,6 @@
#else
-/* POSIX requires at least 16 as a maximum iovcnt. */-#define IOV_MAX 16-
/* Define our own POSIX-compatible iovec struct. */
struct iovec
{
@@ -33,6 +30,11 @@ struct iovec
#endif
+/* POSIX requires at least 16 as a maximum iovcnt. */+#ifndef IOV_MAX+#define IOV_MAX 16+#endif+
/*
* Define a reasonable maximum that is safe to use on the stack in arrays of
* struct iovec and other small types. The operating system could limit us to
--
2.39.5
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: mbanck@gmx.net, pgsql-hackers@lists.postgresql.org
Subject: Re: GNU/Hurd portability patches
In-Reply-To: <6862e8d1.050a0220.194b8d.76fa@mx.google.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox