clean up pid_t printing and get rid of pgpid_t

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: clean up pid_t printing and get rid of pgpid_t
Date: 2022-10-10 08:57:21
Message-ID: 289c2e45-c7d9-5ce4-7eff-a9e2a33e1580@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04.10.22 10:15, Peter Eisentraut wrote:
> I wanted to propose the attached patch to get rid of the custom pgpid_t
> typedef in pg_ctl.  Since we liberally use pid_t elsewhere, this seemed
> plausible.
>
> However, this patch fails the CompilerWarnings job on Cirrus, because
> apparently under mingw, pid_t is "volatile long long int", so all the
> printf placeholders mismatch.  However, we print pid_t as %d in a lot of
> other places, so I'm confused why this fails here.

I figured out that in most places we actually store PIDs in int, and in
the cases where we use pid_t, casts before printing are indeed used and
necessary. So nevermind that.

In any case, I took this opportunity to standardize the printing of PIDs
as %d. There were a few stragglers.

And then the original patch to get rid of pgpid_t in pg_ctl, now updated
with the correct casts for printing. I confirmed that this now passes
the CompilerWarnings job.

Attachment Content-Type Size
v2-0001-doc-Correct-type-of-bgw_notify_pid.patch text/plain 939 bytes
v2-0002-Standardize-format-for-printing-PIDs.patch text/plain 4.3 KB
v2-0003-Remove-pgpid_t-type-use-pid_t-instead.patch text/plain 11.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2022-10-10 09:16:12 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Previous Message Japin Li 2022-10-10 08:50:17 Re: Remove unnecessary commas for goto labels