diff options
author | Tom Lane | 2013-03-17 16:06:42 +0000 |
---|---|---|
committer | Tom Lane | 2013-03-17 16:06:42 +0000 |
commit | da5aeccf64b37a8e9bd3cb605848590595dbcbf8 (patch) | |
tree | 5e16817356f6ae9b0bc3bf29a7d814da9a40bf8a /src/interfaces | |
parent | d43837d03067487560af481474ae985df894f786 (diff) |
Move pqsignal() to libpgport.
We had two copies of this function in the backend and libpq, which was
already pretty bogus, but it turns out that we need it in some other
programs that don't use libpq (such as pg_test_fsync). So put it where
it probably should have been all along. The signal-mask-initialization
support in src/backend/libpq/pqsignal.c stays where it is, though, since
we only need that in the backend.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/libpq/Makefile | 2 | ||||
-rw-r--r-- | src/interfaces/libpq/bcc32.mak | 2 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 1 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-print.c | 1 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 1 | ||||
-rw-r--r-- | src/interfaces/libpq/pqsignal.c | 49 | ||||
-rw-r--r-- | src/interfaces/libpq/pqsignal.h | 25 | ||||
-rw-r--r-- | src/interfaces/libpq/win32.mak | 2 |
8 files changed, 1 insertions, 82 deletions
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index f594f7e499b..c45856efb6b 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -32,7 +32,7 @@ LIBS := $(LIBS:-lpgport=) # We can't use Makefile variables here because the MSVC build system scrapes # OBJS from this file. OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \ - fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \ + fe-protocol2.o fe-protocol3.o pqexpbuffer.o fe-secure.o \ libpq-events.o # libpgport C files we always use OBJS += chklocale.o inet_net_ntop.o noblock.o pgstrcasecmp.o thread.o diff --git a/src/interfaces/libpq/bcc32.mak b/src/interfaces/libpq/bcc32.mak index 441fb5e76fb..62821964469 100644 --- a/src/interfaces/libpq/bcc32.mak +++ b/src/interfaces/libpq/bcc32.mak @@ -95,7 +95,6 @@ CLEAN : -@erase "$(INTDIR)\fe-secure.obj" -@erase "$(INTDIR)\libpq-events.obj" -@erase "$(INTDIR)\pqexpbuffer.obj" - -@erase "$(INTDIR)\pqsignal.obj" -@erase "$(INTDIR)\win32.obj" -@erase "$(INTDIR)\wchar.obj" -@erase "$(INTDIR)\encnames.obj" @@ -140,7 +139,6 @@ LIB32_OBJS= \ "$(INTDIR)\fe-secure.obj" \ "$(INTDIR)\libpq-events.obj" \ "$(INTDIR)\pqexpbuffer.obj" \ - "$(INTDIR)\pqsignal.obj" \ "$(INTDIR)\wchar.obj" \ "$(INTDIR)\encnames.obj" \ "$(INTDIR)\snprintf.obj" \ diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index cea3776c33c..6be3249638c 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -55,7 +55,6 @@ #include "libpq-fe.h" #include "libpq-int.h" -#include "pqsignal.h" #include "mb/pg_wchar.h" #include "pg_config_paths.h" diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 5c86f037d71..b0fab6a839f 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -35,7 +35,6 @@ #include "libpq-fe.h" #include "libpq-int.h" -#include "pqsignal.h" static void do_field(const PQprintOpt *po, const PGresult *res, diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 574d3bae8f4..174cf426f06 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -30,7 +30,6 @@ #include "libpq-fe.h" #include "fe-auth.h" -#include "pqsignal.h" #include "libpq-int.h" #ifdef WIN32 diff --git a/src/interfaces/libpq/pqsignal.c b/src/interfaces/libpq/pqsignal.c deleted file mode 100644 index 26e203b6690..00000000000 --- a/src/interfaces/libpq/pqsignal.c +++ /dev/null @@ -1,49 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pqsignal.c - * reliable BSD-style signal(2) routine stolen from RWW who stole it - * from Stevens... - * - * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * src/interfaces/libpq/pqsignal.c - * - * NOTES - * This shouldn't be in libpq, but the monitor and some other - * things need it... - * - *------------------------------------------------------------------------- - */ -#include "postgres_fe.h" - -#include <signal.h> - -#include "pqsignal.h" - - -pqsigfunc -pqsignal(int signo, pqsigfunc func) -{ -#if !defined(HAVE_POSIX_SIGNALS) - return signal(signo, func); -#else - struct sigaction act, - oact; - - act.sa_handler = func; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - if (signo != SIGALRM) - act.sa_flags |= SA_RESTART; -#ifdef SA_NOCLDSTOP - if (signo == SIGCHLD) - act.sa_flags |= SA_NOCLDSTOP; -#endif - if (sigaction(signo, &act, &oact) < 0) - return SIG_ERR; - return oact.sa_handler; -#endif /* !HAVE_POSIX_SIGNALS */ -} diff --git a/src/interfaces/libpq/pqsignal.h b/src/interfaces/libpq/pqsignal.h deleted file mode 100644 index 2a72327d796..00000000000 --- a/src/interfaces/libpq/pqsignal.h +++ /dev/null @@ -1,25 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pqsignal.h - * prototypes for the reliable BSD-style signal(2) routine. - * - * - * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/interfaces/libpq/pqsignal.h - * - * NOTES - * This shouldn't be in libpq, but the monitor and some other - * things need it... - * - *------------------------------------------------------------------------- - */ -#ifndef PQSIGNAL_H -#define PQSIGNAL_H - -typedef void (*pqsigfunc) (int); - -extern pqsigfunc pqsignal(int signo, pqsigfunc func); - -#endif /* PQSIGNAL_H */ diff --git a/src/interfaces/libpq/win32.mak b/src/interfaces/libpq/win32.mak index 9355de23cef..49d51d11fb9 100644 --- a/src/interfaces/libpq/win32.mak +++ b/src/interfaces/libpq/win32.mak @@ -102,7 +102,6 @@ CLEAN : -@erase "$(INTDIR)\fe-secure.obj" -@erase "$(INTDIR)\libpq-events.obj" -@erase "$(INTDIR)\pqexpbuffer.obj" - -@erase "$(INTDIR)\pqsignal.obj" -@erase "$(INTDIR)\win32.obj" -@erase "$(INTDIR)\wchar.obj" -@erase "$(INTDIR)\encnames.obj" @@ -150,7 +149,6 @@ LIB32_OBJS= \ "$(INTDIR)\fe-secure.obj" \ "$(INTDIR)\libpq-events.obj" \ "$(INTDIR)\pqexpbuffer.obj" \ - "$(INTDIR)\pqsignal.obj" \ "$(INTDIR)\wchar.obj" \ "$(INTDIR)\encnames.obj" \ "$(INTDIR)\snprintf.obj" \ |