diff options
| author | Tom Lane | 2015-08-31 16:55:59 +0000 |
|---|---|---|
| committer | Tom Lane | 2015-08-31 16:56:10 +0000 |
| commit | a65e086453e0dea5cdd7f9fe9dc6c34d8bfc0f2c (patch) | |
| tree | 0d84406b458a305c86098816345d2a48c1d5a9d7 /src/include | |
| parent | 8f7d044ba842ab3359a8a3190ff2f3aa1de2a6bb (diff) | |
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.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/c.h | 4 | ||||
| -rw-r--r-- | src/include/libpq/pqsignal.h | 18 | ||||
| -rw-r--r-- | src/include/pg_config.h.in | 9 | ||||
| -rw-r--r-- | src/include/pg_config.h.win32 | 9 |
4 files changed, 11 insertions, 29 deletions
diff --git a/src/include/c.h b/src/include/c.h index f5da4676c6..8163b000df 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1051,9 +1051,9 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); /* * When there is no sigsetjmp, its functionality is provided by plain * setjmp. Incidentally, nothing provides setjmp's functionality in - * that case. + * that case. We now support the case only on Windows. */ -#ifndef HAVE_SIGSETJMP +#ifdef WIN32 #define sigjmp_buf jmp_buf #define sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp diff --git a/src/include/libpq/pqsignal.h b/src/include/libpq/pqsignal.h index 4b85342f32..3364247531 100644 --- a/src/include/libpq/pqsignal.h +++ b/src/include/libpq/pqsignal.h @@ -15,27 +15,27 @@ #include <signal.h> -#ifdef HAVE_SIGPROCMASK +#ifndef WIN32 extern sigset_t UnBlockSig, BlockSig, StartupBlockSig; #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) -#else /* not HAVE_SIGPROCMASK */ +#else /* WIN32 */ +/* + * Windows doesn't provide the POSIX signal API, so we use something + * approximating the old BSD signal API. + */ extern int UnBlockSig, BlockSig, StartupBlockSig; -#ifndef WIN32 -#define PG_SETMASK(mask) sigsetmask(*((int*)(mask))) -#else -#define PG_SETMASK(mask) pqsigsetmask(*((int*)(mask))) -int pqsigsetmask(int mask); -#endif +extern int pqsigsetmask(int mask); +#define PG_SETMASK(mask) pqsigsetmask(*(mask)) #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) -#endif /* not HAVE_SIGPROCMASK */ +#endif /* WIN32 */ extern void pqinitmask(void); diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 1dcc9a9ee7..dda73a8b4c 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -379,9 +379,6 @@ /* Define to 1 if you have the `posix_fadvise' function. */ #undef HAVE_POSIX_FADVISE -/* Define to 1 if you have the POSIX signal interface. */ -#undef HAVE_POSIX_SIGNALS - /* Define to 1 if the assembler supports PPC's LWARX mutex hint bit. */ #undef HAVE_PPC_LWARX_MUTEX_HINT @@ -443,12 +440,6 @@ /* Define to 1 if you have the `shm_open' function. */ #undef HAVE_SHM_OPEN -/* Define to 1 if you have the `sigprocmask' function. */ -#undef HAVE_SIGPROCMASK - -/* Define to 1 if you have sigsetjmp(). */ -#undef HAVE_SIGSETJMP - /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index bf69ef5bde..6f7a773c5b 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -264,9 +264,6 @@ /* Define to 1 if you have the <poll.h> header file. */ /* #undef HAVE_POLL_H */ -/* Define to 1 if you have the POSIX signal interface. */ -/* #undef HAVE_POSIX_SIGNALS */ - /* Define to 1 if you have the `pstat' function. */ /* #undef HAVE_PSTAT */ @@ -316,12 +313,6 @@ /* Define to 1 if you have the `setsid' function. */ /* #undef HAVE_SETSID */ -/* Define to 1 if you have the `sigprocmask' function. */ -/* #undef HAVE_SIGPROCMASK */ - -/* Define to 1 if you have sigsetjmp(). */ -/* #undef HAVE_SIGSETJMP */ - /* Define to 1 if you have the `snprintf' function. */ /* #undef HAVE_SNPRINTF */ |
