mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Remove support for Unix systems without the POSIX signal APIs.
Remove configure's checks for HAVE_POSIX_SIGNALS, HAVE_SIGPROCMASK, and HAVE_SIGSETJMP. These APIs are required by the Single Unix Spec v2 (POSIX 1997), which we generally consider to define our minimum required set of Unix APIs. Moreover, no buildfarm member has reported not having them since 2012 or before, which means that even if the code is still live somewhere, it's untested --- and we've made plenty of signal-handling changes of late. So just take these APIs as given and save the cycles for configure probes for them. However, we can't remove as much C code as I'd hoped, because the Windows port evidently still uses the non-POSIX code paths for signal masking. Since we're largely emulating these BSD-style APIs for Windows anyway, it might be a good thing to switch over to POSIX-like notation and thereby remove a few more #ifdefs. But I'm not in a position to code or test that. In the meantime, we can at least make things a bit more transparent by testing for WIN32 explicitly in these places.
This commit is contained in:
@ -11,30 +11,17 @@
|
||||
* IDENTIFICATION
|
||||
* src/port/pqsignal.c
|
||||
*
|
||||
* A NOTE ABOUT SIGNAL HANDLING ACROSS THE VARIOUS PLATFORMS.
|
||||
*
|
||||
* pg_config.h defines the macro HAVE_POSIX_SIGNALS for some platforms and
|
||||
* not for others. We use that here to decide how to handle signalling.
|
||||
*
|
||||
* Ultrix and SunOS provide BSD signal(2) semantics by default.
|
||||
*
|
||||
* SVID2 and POSIX signal(2) semantics differ from BSD signal(2)
|
||||
* semantics. We can use the POSIX sigaction(2) on systems that
|
||||
* allow us to request restartable signals (SA_RESTART).
|
||||
*
|
||||
* Some systems don't allow restartable signals at all unless we
|
||||
* link to a special BSD library.
|
||||
*
|
||||
* We devoutly hope that there aren't any Unix-oid systems that provide
|
||||
* neither POSIX signals nor BSD signals. The alternative is to do
|
||||
* signal-handler reinstallation, which doesn't work well at all.
|
||||
* We now assume that all Unix-oid systems have POSIX sigaction(2)
|
||||
* with support for restartable signals (SA_RESTART). We used to also
|
||||
* support BSD-style signal(2), but there really shouldn't be anything
|
||||
* out there anymore that doesn't have the POSIX API.
|
||||
*
|
||||
* Windows, of course, is resolutely in a class by itself. In the backend,
|
||||
* we don't use this file at all; src/backend/port/win32/signal.c provides
|
||||
* pqsignal() for the backend environment. Frontend programs can use
|
||||
* this version of pqsignal() if they wish, but beware that Windows
|
||||
* requires signal-handler reinstallation, because indeed it provides
|
||||
* neither POSIX signals nor BSD signals :-(
|
||||
* this version of pqsignal() if they wish, but beware that this does
|
||||
* not provide restartable signals on Windows.
|
||||
*
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -52,9 +39,7 @@
|
||||
pqsigfunc
|
||||
pqsignal(int signo, pqsigfunc func)
|
||||
{
|
||||
#if !defined(HAVE_POSIX_SIGNALS)
|
||||
return signal(signo, func);
|
||||
#else
|
||||
#ifndef WIN32
|
||||
struct sigaction act,
|
||||
oact;
|
||||
|
||||
@ -68,7 +53,9 @@ pqsignal(int signo, pqsigfunc func)
|
||||
if (sigaction(signo, &act, &oact) < 0)
|
||||
return SIG_ERR;
|
||||
return oact.sa_handler;
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
#else /* WIN32 */
|
||||
return signal(signo, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !defined(WIN32) || defined(FRONTEND) */
|
||||
|
Reference in New Issue
Block a user