Re: convert libpgport's pqsignal() to a void function

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Fujii Masao <masao.fujii@oss.nttdata.com>, Andy Fan <zhihuifan1213@163.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-01-15T23:47:51Z
Lists: pgsql-hackers

Attachments

On Thu, Jan 16, 2025 at 11:07:41AM +1300, Thomas Munro wrote:
> +1 for your idea of not defining them at all outside the backend, it's
> just confusing noise.

I tried that, but these extra signals are needed even in the frontend for
pgkill(), etc.  My next thought was to simply ignore signal() errors for
the extra signals, but I don't think that's very nice because it just masks
broken code.  Finally, I settled on modifying initdb's setup_signals() to
use WIN32 checks instead of checking for the signals themselves.  This is
how it's done elsewhere, and this is apparently all that's needed to make
cfbot's Windows run happy.

I've also attached a 0002 that removes the redefinitions of SIG_ERR and
friends.  That looks good on cfbot, but we'll see what the buildfarm has to
say...

-- 
nathan

Commits

  1. Remove redefinitions of SIG_* macros in win32_port.h.

  2. Convert libpgport's pqsignal() to a void function.

  3. Avoid calling pqsignal() with invalid signals on Windows frontends.

  4. Avoid symbol collisions between pqsignal.c and legacy-pqsignal.c.

  5. Check that MyProcPid == getpid() in backend signal handlers.

  6. Further refactoring of c.h and nearby files.

  7. Here's the latest win32 signals code, this time in the form of a patch

  8. Add C version of initdb, from Andrew Dunstan.

  9. Allow Win32 to compile under MinGW. Major changes are: