1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

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.
This commit is contained in:
Tom Lane
2013-03-17 12:06:42 -04:00
parent d43837d030
commit da5aeccf64
30 changed files with 99 additions and 184 deletions

View File

@ -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

View File

@ -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" \

View File

@ -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"

View File

@ -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,

View File

@ -30,7 +30,6 @@
#include "libpq-fe.h"
#include "fe-auth.h"
#include "pqsignal.h"
#include "libpq-int.h"
#ifdef WIN32

View File

@ -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 */
}

View File

@ -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 */

View File

@ -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" \