Re: Dead code in ps_status.c
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Michael Banck <mbanck@gmx.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
pgsql-hackers <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>
Date: 2025-11-16T23:54:44Z
Lists: pgsql-hackers
On Tue, Nov 11, 2025 at 11:04 AM Thomas Munro <thomas.munro@gmail.com> wrote:
> https://www.postgresql.org/message-id/68adbcd3.500a0220.8d4c9.9460%40mx.google.com
>
> Sorry I missed this. I had some trouble with your messages being
> deleted as spam, which I've hopefully fixed now...
>
> -#elif defined(__linux__) || defined(__sun) || defined(__darwin__)
> +#elif defined(__linux__) || defined(__sun) || defined(__darwin__) ||
> defined(__GNU__)
>
> Would __gnu_hurd__ be a better bet, less confusable with GNU userspace
> stuff? I think these platform macros might come from this file in
> GCC:
>
> https://github.com/gcc-mirror/gcc/blob/faf7053346110cbd11fb22ff75f56a964047b19c/gcc/config/gnu.h#L30
>
> But maybe not only there, if __hurd__ (as removed by d2ea2d31)
> actually worked...
I failed to locate a definitive source in a manual or porting guide or
such, but I see patches making the same change in other projects in
their mailing lists[1], so it seems that __GNU__ is indeed their
preferred way of detecting a GNU/Hurd (or IIUC 100% "GNU") system, and
it's certainly not defined on my Debian GNU/Linux machine according to
GCC and Clang. So although it was slightly confusing to this human,
being used to seeing __GNUC__ and similar, it doesn't appear to be
confusing to computers.
Pushed, and back-patched to 16, where it applied without problems.
The REL_{14,15}_STABLE branches don't have commit d2ea2d31. I thought
about doing s/__hurd__/__GNU__/ instead, but it actually said:
#elif (defined(BSD) || defined(__hurd__)) && !defined(__darwin__)
#define PS_USE_CHANGE_ARGV
The right thing to do might be to remove it from there, define
PS_USE_CLOBBER_ARGV like in the newer branches and also apply the
second hunk about padding strategy (in other words: be exactly like
GNU/Linux), but I can't test that. If 14 and 15 are still interesting
to you, let me know if that makes sense and works as expected,
otherwise I'll assume you just want to let sleeping dogs lie.
[1] https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=__GNU__&submit=Search%21&idxname=bug-hurd&max=20&result=normal&sort=score
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Define PS_USE_CLOBBER_ARGV on GNU/Hurd.
- 29a3e22f3568 14.21 landed
- 3995e4a9d8c6 15.16 landed
- 32b236644d33 19 (unreleased) landed
- bcfca332f100 18.2 landed
- d66a922f9247 17.8 landed
- a1407daded69 16.12 landed
-
Remove obsolete platforms from ps_status.c.
- d2ea2d310dfd 16.0 landed