pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Banck <mbanck@gmx.net>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Cleaning up historical portability baggage
Date: Mon, 9 Jun 2025 15:25:22 +0200
Message-ID: <6846e0c3.df0a0220.39ef9b.c60e@mx.google.com> (raw)
In-Reply-To: <CA+hUKG+L_3brvh=8e0BW_VfX9h7MtwgN=nFHP5o7X2oZucY9dg@mail.gmail.com>
References: <1249825.1658622186@sss.pgh.pa.us>
	<CA+hUKGLryBW4fNYoXzMG9y1e0H-QOTdSiTG46xCr1DNuuPwbeg@mail.gmail.com>
	<CA+hUKGJMcwbzRyfTocfxbPBUhERqKE42d-L22jQ+vpB7an-NjQ@mail.gmail.com>
	<20220804034343.unm4rdynedbigamv@awork3.anarazel.de>
	<3322724.1659586159@sss.pgh.pa.us>
	<CA+hUKGJ5ej33AJL19sQph7Z8SFZ6+aUSKxFTS6pvk2Y8J9Tcwg@mail.gmail.com>
	<295419.1659918447@sss.pgh.pa.us>
	<CA+hUKGK=N8W2uFPdJr07Rs4dgRtbzKaYvCaPQasX3S8=aTO5PQ@mail.gmail.com>
	<747620.1660002360@sss.pgh.pa.us>
	<CA+hUKG+L_3brvh=8e0BW_VfX9h7MtwgN=nFHP5o7X2oZucY9dg@mail.gmail.com>

Hi Thomas,

On Thu, Aug 11, 2022 at 10:02:29PM +1200, Thomas Munro wrote:
> Remove configure probe for sys/uio.h.

Removing the configure probe is fine, but the patch also changes
behavior in the sense that IOV_MAX is now considered defined everywhere
but on Windows. However, in the good-old GNU "we have no arbitrary
limits" fashion, this breaks on GNU Hurd:

|gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshado
|w=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -DFRONTEND -I. -I../../src/common -
|I../../src/include  -D_GNU_SOURCE -I/usr/include/libxml2  -DVAL_CC="\"gcc\"" -DVAL_CPPFLAGS="\"-D_GNU_SOURCE -I/usr/include/libxml2\"" -DVAL_CFLAGS="\"-Wall -Wmissing-prototypes -Wpoin
|ter-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security 
|-fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2\"" -DVAL_CFLAGS_SL="\"-fPIC\"" -DVAL_LDFLAGS="\"-Wl,--as-needed -Wl,-rpa
|th,'/home/demo/build-farm-19.1/buildroot/REL_16_STABLE/inst/lib',--enable-new-dtags\"" -DVAL_LDFLAGS_EX="\"\"" -DVAL_LDFLAGS_SL="\"\"" -DVAL_LIBS="\"-lpgcommon -lpgport -lxslt -lxml2 -
|lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lpthread -lm \""  -c -o file_utils.o file_utils.c
|In file included from ../../src/include/postgres_fe.h:25,
|                 from file_utils.c:19:
|file_utils.c: In function 'pg_pwritev_with_retry':
|../../src/include/port/pg_iovec.h:36:24: error: 'IOV_MAX' undeclared (first use in this function); did you mean 'INT_MAX'?
|   36 | #define PG_IOV_MAX Min(IOV_MAX, 32)
|      |                        ^~~~~~~
|../../src/include/c.h:988:35: note: in definition of macro 'Min'
|  988 | #define Min(x, y)               ((x) < (y) ? (x) : (y))
|      |                                   ^
|file_utils.c:474:31: note: in expansion of macro 'PG_IOV_MAX'
|  474 |         struct iovec iov_copy[PG_IOV_MAX];
|      |                               ^~~~~~~~~~
|../../src/include/port/pg_iovec.h:36:24: note: each undeclared identifier is reported only once for each function it appears in

|$ grep IOV_MAX /usr/include/i386-gnu/bits/uio_lim.h     
|#undef __IOV_MAX

Postgres built fine up and until v15 on the Hurd, so this is a build
regression, and the fact that we define #PG_IOV_MAX to at most 32
anyway suggest we could just #definde IOV_MAX to 16 if undefined as on
Windows.

Christoph fixed this up for Debian's hurd-i386 builds in
https://salsa.debian.org/postgresql/postgresql/-/commit/641713a4585e4b040266a1fa567b7ec90469a1bb
but I have not seen a discussion about this (but might have missed it),
so bringing it up here for upstream consideration in v16 and newer.


Michael





view thread (108+ messages)  latest in thread

Message-ID: <6846e0c3.df0a0220.39ef9b.c60e@mx.google.com>
Permalink:  ../6846e0c3.df0a0220.39ef9b.c60e@mx.google.com/
Also on:    postgresql.org/message-id/6846e0c3.df0a0220.39ef9b.c60e@mx.google.com

 · 

reply

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, thomas.munro@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, andrew@dunslane.net, robertmhaas@gmail.com
  Subject: Re: Cleaning up historical portability baggage
  In-Reply-To: <6846e0c3.df0a0220.39ef9b.c60e@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