pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tomas Vondra <tomas@vondra.me>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Japin Li <japinli@hotmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Cannot find a working 64-bit integer type on Illumos
Date: Wed, 04 Dec 2024 16:20:37 -0500
Message-ID: <2397643.1733347237@sss.pgh.pa.us> (raw)
In-Reply-To: <2385947.1733341279@sss.pgh.pa.us>
References: <ME3P282MB3166F9D1F71F787929C0C7E7B6312@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>
	<20240322165305.6zrtxcmzdrywvmsu@awork3.anarazel.de>
	<ME3P282MB3166D876E9CB83009727A5ECB6312@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>
	<944094.1711128356@sss.pgh.pa.us>
	<CA+hUKG+CR05ACFujUbeAd-yM+nNJBSpnyB=q3vbriCJuoSu9Ag@mail.gmail.com>
	<1229869.1711160593@sss.pgh.pa.us>
	<CA+hUKG+ZwX-reVMHak3yo-63rrh9AJwEVGW4rCbsoLeSKO54Pg@mail.gmail.com>
	<7cf1dcb7-306f-4418-bf25-bdc75130db10@eisentraut.org>
	<CA+hUKGKXEdVSfR6UHXfR3tSQ+TfBNk-ssYmO2F0wCdw7qcx86Q@mail.gmail.com>
	<d8d68452-7195-41cf-a31b-e660f5ac6e75@iki.fi>
	<CA+hUKG+rYp-=fTP5kjRmnfPq7YgK-e=J+gJxBvKarkPVzLwQmQ@mail.gmail.com>
	<0e2cc7af-f0c0-418c-b640-e5eb03eaa6e6@eisentraut.org>
	<CA+hUKGL7YprY+mkWg-9rVkrzkeC62ppdzyb7KcPp9tcff_5F3Q@mail.gmail.com>
	<CA+hUKGK7WQX3nTuYbiiGZFcV70CqbmBx4VUOnDy6ZGm1v=qGqQ@mail.gmail.com>
	<50a4c05e-c43e-4e7e-95d2-4b16493073ed@eisentraut.org>
	<CA+hUKGJ=6wVNNdv9XAUwNv+hhPCW3FzFEkrr6i5axx090vEmcQ@mail.gmail.com>
	<CA+! ! hUKGKRM1vk2Bd=B7O9SKeiz6c=KUB08N0M9fHVq057u9uhJw@mail.gmail.com>
	<2276817.1733293172@sss.pgh.pa.us>
	<2385947.1733341279@sss.pgh.pa.us>

I wrote:
> So apparently, "off_t" was the same as "loff_t" before 962da900a,
> but it no longer is the same on 32-bit machines.

OK, I see what is happening.  On platforms that need it, we define
_FILE_OFFSET_BITS as 64 in pg_config.h to ensure that off_t is
big enough.  However, 962da900a did this:

inline patch 1: src/include/postgres_ext.h (+1/-1 lines) download inline-1.patch--- a/src/include/postgres_ext.h +++ b/src/include/postgres_ext.h @@ -23,7 +23,7 @@ #ifndef POSTGRES_EXT_H #define POSTGRES_EXT_H -#include "pg_config_ext.h" +#include <stdint.h>
Since c.h reads postgres_ext.h first, <stdint.h> is now pulled in before pg_config.h, and that in turn pulls in <features.h>, which locks down the decision that off_t will be 32 bits, as well as some other decisions we don't want. We can NOT include any system headers before pg_config.h; I'm surprised we're not seeing related failures on the Solaris-en, where _LARGEFILE_SOURCE is similarly critical. Another rather serious problem here is that we no longer provide macro PG_INT64_TYPE, which seems rather likely to break applications that were relying on it. That is part of our external API, we can't just remove it on a whim. I think the least painful solution would be to revert the parts of 962da900a that got rid of pg_config_ext.h and PG_INT64_TYPE. Since PG_INT64_TYPE is a macro not a typedef, it might be okay to #define it as int64_t even before we've read that header, so as not to give up the principle of relying on stdint.h for the underlying definition. Now that I see this, I'm fairly astonished that there aren't more problems than we've noticed. I wonder whether it'd be a good idea to put in a static assert somewhere about the width of off_t, so that the next screwup of this sort will be easier to diagnose. regards, tom lane

view thread (78+ messages)  latest in thread

Message-ID: <2397643.1733347237@sss.pgh.pa.us>
Permalink:  ../2397643.1733347237@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2397643.1733347237@sss.pgh.pa.us

 ·  · 

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: tgl@sss.pgh.pa.us, thomas.munro@gmail.com, tomas@vondra.me, peter@eisentraut.org, hlinnaka@iki.fi, japinli@hotmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
  Subject: Re: Cannot find a working 64-bit integer type on Illumos
  In-Reply-To: <2397643.1733347237@sss.pgh.pa.us>

* 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