diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.global.in | 3 | ||||
-rw-r--r-- | src/backend/libpq/pqsignal.c | 6 | ||||
-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 | ||||
-rw-r--r-- | src/makefiles/Makefile.hpux | 7 | ||||
-rw-r--r-- | src/port/pqsignal.c | 35 |
8 files changed, 25 insertions, 66 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 39a7879bb69..6871c3c6143 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -432,9 +432,6 @@ host_cpu = @host_cpu@ # Make HAVE_IPV6 available for initdb script creation HAVE_IPV6= @HAVE_IPV6@ -# The HP-UX port makefile, for one, needs access to this symbol -HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@ - # This is mainly for use on FreeBSD, where we have both a.out and elf # systems now. May be applicable to other systems to? ELF_SYSTEM= @ELF_SYS@ diff --git a/src/backend/libpq/pqsignal.c b/src/backend/libpq/pqsignal.c index 5f17d765816..b19c4539f3f 100644 --- a/src/backend/libpq/pqsignal.c +++ b/src/backend/libpq/pqsignal.c @@ -18,7 +18,7 @@ #include "libpq/pqsignal.h" -#ifdef HAVE_SIGPROCMASK +#ifndef WIN32 sigset_t UnBlockSig, BlockSig, StartupBlockSig; @@ -45,7 +45,7 @@ int UnBlockSig, void pqinitmask(void) { -#ifdef HAVE_SIGPROCMASK +#ifndef WIN32 sigemptyset(&UnBlockSig); @@ -101,7 +101,7 @@ pqinitmask(void) #ifdef SIGALRM sigdelset(&StartupBlockSig, SIGALRM); #endif -#else +#else /* WIN32 */ /* Set the signals we want. */ UnBlockSig = 0; BlockSig = sigmask(SIGQUIT) | diff --git a/src/include/c.h b/src/include/c.h index f5da4676c6f..8163b000df1 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 4b85342f325..33642475314 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 1dcc9a9ee7a..dda73a8b4ce 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 bf69ef5bdeb..6f7a773c5be 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 */ diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux index 1917d61b436..97bd0ba6d9e 100644 --- a/src/makefiles/Makefile.hpux +++ b/src/makefiles/Makefile.hpux @@ -1,10 +1,3 @@ -# If we don't have POSIX signals, we need to use the libBSD signal routines. -# (HPUX 9 and early HPUX 10 releases don't have POSIX signals.) Link in -# libBSD only in that case. -ifeq ($(HAVE_POSIX_SIGNALS), no) - LIBS := -lBSD $(LIBS) -endif - # Using X/Open Networking Interfaces requires to link with libxnet. # Without specifying this, bind(), getpeername() and so on don't work # correctly in the LP64 data model. diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c index f475b58acd0..3e538d8c985 100644 --- a/src/port/pqsignal.c +++ b/src/port/pqsignal.c @@ -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) */ |