Re: Cleaning up historical portability baggage

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up historical portability baggage
Date: 2022-08-13 12:23:02
Message-ID: CA+hUKGLW6dWAJYQ4q1wXED78L_=tZp0LKi-BNjEaEnqfyWB4vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 12, 2022 at 8:03 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Fri, Aug 12, 2022 at 7:15 PM Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
> > But maybe it would be better to make that a separate patch from the
> > sys/un.h configure changes, just so there is more clarity around it.
>
> Cool, I'll do that.

I pushed these, except I chopped out the HAVE_UNIX_SOCKETS part as
requested. Here it is in a separate patch, with a commit message that
explains the rationale (essentially, what you said, it's basically a
runtime matter for a hypothetical AF_UNIX-less system to complain
about). Tom, does this argument persuade you? Also, a couple of
nearby things:

Remove HAVE_UNIX_SOCKETS.
Remove configure probe for struct sockaddr_storage.
Remove configure probe for getaddrinfo, and replacement code.

If I'm reading comments and scraped configure data right, it looks
like those last two things were there only for HP-UX 10 and Windows <
8.1.

I tried to figure out how to get rid of
PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS, but there we're into genuine
non-standard cross-platform differences. At best maybe you could
maybe skip the test for ss_family (POSIX says you have to have that,
but I haven't read RFC 2553 to see why it claims someone should spell
it differently). Didn't seem worth changing.

bfbot=> select name, value, count(*) from macro where name like
'%SOCKADDR_%' group by 1, 2;
name | value | count
----------------------------------------+-------+-------
HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN | 1 | 13 <-- BSDish
HAVE_STRUCT_SOCKADDR_STORAGE | 1 | 108 <-- everyone
HAVE_STRUCT_SOCKADDR_SA_LEN | 1 | 18 <-- BSDish + AIX
HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY | 1 | 108 <-- everyone
HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN | 1 | 5 <-- AIX
HAVE_STRUCT_SOCKADDR_UN | 1 | 106 <-- everyone
except mingw
(6 rows)

Attachment Content-Type Size
0001-Remove-HAVE_UNIX_SOCKETS.patch text/x-patch 17.4 KB
0002-Remove-configure-probe-for-struct-sockaddr_storage.patch text/x-patch 5.0 KB
0003-Remove-configure-probe-for-getaddrinfo-and-replaceme.patch text/x-patch 25.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-08-13 13:14:23 Re: Cleaning up historical portability baggage
Previous Message Bharath Rupireddy 2022-08-13 09:16:24 Re: Add lasterrno setting for dir_existsfile()