diff options
author | Thomas Munro <tmunro@postgresql.org> | 2023-02-03 10:34:56 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2023-02-03 11:29:46 +1300 |
commit | cdf6518ef08ee602b94db4e5ba5887a1d7053c24 (patch) | |
tree | d25d1bc430e8a0f670ecd84f04a9dcce78d22615 /src/backend/postmaster/postmaster.c | |
parent | e0d70a91a04b942980ab06bc471d2b5b65952459 (diff) | |
download | postgresql-cdf6518ef08ee602b94db4e5ba5887a1d7053c24.tar.gz postgresql-cdf6518ef08ee602b94db4e5ba5887a1d7053c24.zip |
Retire PG_SETMASK() macro.
In the 90s we needed to deal with computers that still had the
pre-standard signal masking APIs. That hasn't been relevant for a very
long time on Unix systems, and c94ae9d8 got rid of a remaining
dependency in our Windows porting code. PG_SETMASK didn't expose
save/restore functionality, so we'd already started using sigprocmask()
directly in places, creating the visual distraction of having two ways
to spell it. It's not part of the API that extensions are expected to
be using (but if they are, the change will be trivial). It seems like a
good time to drop the old macro and just call the standard POSIX
function.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2BKfQgrhHP2DLTohX1WwubaCBHmTzGnAEDPZ-Gug-Xskg%40mail.gmail.com
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index f92dbc22707..2552327d904 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -639,7 +639,7 @@ PostmasterMain(int argc, char *argv[]) * postmaster/bgworker.c and postmaster/checkpointer.c. */ pqinitmask(); - PG_SETMASK(&BlockSig); + sigprocmask(SIG_SETMASK, &BlockSig, NULL); pqsignal(SIGHUP, handle_pm_reload_request_signal); pqsignal(SIGINT, handle_pm_shutdown_request_signal); @@ -675,7 +675,7 @@ PostmasterMain(int argc, char *argv[]) #endif /* Begin accepting signals. */ - PG_SETMASK(&UnBlockSig); + sigprocmask(SIG_SETMASK, &UnBlockSig, NULL); /* * Options setup @@ -4321,7 +4321,7 @@ BackendInitialize(Port *port) pqsignal(SIGTERM, process_startup_packet_die); /* SIGQUIT handler was already set up by InitPostmasterChild */ InitializeTimeouts(); /* establishes SIGALRM handler */ - PG_SETMASK(&StartupBlockSig); + sigprocmask(SIG_SETMASK, &StartupBlockSig, NULL); /* * Get the remote host name and port for logging and status display. @@ -4402,7 +4402,7 @@ BackendInitialize(Port *port) * Disable the timeout, and prevent SIGTERM again. */ disable_timeout(STARTUP_PACKET_TIMEOUT, false); - PG_SETMASK(&BlockSig); + sigprocmask(SIG_SETMASK, &BlockSig, NULL); /* * As a safety check that nothing in startup has yet performed @@ -5661,13 +5661,13 @@ BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid, uint32 flags) void BackgroundWorkerBlockSignals(void) { - PG_SETMASK(&BlockSig); + sigprocmask(SIG_SETMASK, &BlockSig, NULL); } void BackgroundWorkerUnblockSignals(void) { - PG_SETMASK(&UnBlockSig); + sigprocmask(SIG_SETMASK, &UnBlockSig, NULL); } #ifdef EXEC_BACKEND |