aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/bootstrap/bootstrap.c20
-rw-r--r--src/backend/tcop/postgres.c28
-rw-r--r--src/backend/utils/error/elog.c19
3 files changed, 18 insertions, 49 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index c4cb0df1c56..0c377d267c8 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.57 1999/03/25 03:49:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.58 1999/04/20 02:19:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -184,24 +184,6 @@ static char *values[MAXATTR]; /* cooresponding attribute values */
int numattr; /* number of attributes for cur. rel */
extern bool disableFsync; /* do not fsync the database */
-/* The test for HAVE_SIGSETJMP fails on Linux 2.0.x because the test
- * explicitly disallows sigsetjmp being a #define, which is how it
- * is declared in Linux. So, to avoid compiler warnings about
- * sigsetjmp() being redefined, let's not redefine unless necessary.
- * - thomas 1997-12-27
- */
-
-#if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp)
-static jmp_buf Warn_restart;
-
-#define sigsetjmp(x,y) setjmp(x)
-#define siglongjmp longjmp
-
-#else
-static sigjmp_buf Warn_restart;
-
-#endif
-
int DebugMode;
static GlobalMemory nogc = (GlobalMemory) NULL; /* special no-gc mem
* context */
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index bf049518752..231b88d620a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.106 1999/03/22 16:45:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.107 1999/04/20 02:19:53 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -21,7 +21,6 @@
#include <string.h>
#include <signal.h>
#include <time.h>
-#include <setjmp.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -136,15 +135,8 @@ static bool IsEmptyQuery = false;
char relname[80]; /* current relation name */
-#if defined(nextstep)
-jmp_buf Warn_restart;
-
-#define sigsetjmp(x,y) setjmp(x)
-#define siglongjmp longjmp
-#else
+/* note: these declarations had better match tcopprot.h */
DLLIMPORT sigjmp_buf Warn_restart;
-
-#endif /* defined(nextstep) */
bool InError;
extern int NBuffers;
@@ -829,8 +821,15 @@ pg_exec_query_dest(char *query_string, /* string to execute */
/* --------------------------------
* signal handler routines used in PostgresMain()
*
- * handle_warn() is used to catch kill(getpid(),SIGQUIT) which
- * occurs when elog(ERROR) is called.
+ * handle_warn() catches SIGQUIT. It forces control back to the main
+ * loop, just as if an internal error (elog(ERROR,...)) had occurred.
+ * elog() used to actually use kill(2) to induce a SIGQUIT to get here!
+ * But that's not 100% reliable on some systems, so now it does its own
+ * siglongjmp() instead.
+ * We still provide the signal catcher so that an error quit can be
+ * forced externally. This should be done only with great caution,
+ * however, since an asynchronous signal could leave the system in
+ * who-knows-what inconsistent state.
*
* quickdie() occurs when signalled by the postmaster.
* Some backend has bought the farm,
@@ -1531,7 +1530,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.106 $ $Date: 1999/03/22 16:45:27 $\n");
+ puts("$Revision: 1.107 $ $Date: 1999/04/20 02:19:53 $\n");
}
/* ----------------
@@ -1543,8 +1542,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
* so that the slaves signal the master to abort the transaction
* rather than calling AbortCurrentTransaction() themselves.
*
- * Note: elog(ERROR) causes a kill(getpid(),SIGQUIT) to occur
- * sending us back here.
+ * Note: elog(ERROR) does a siglongjmp() to transfer control here.
* ----------------
*/
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 3704f457f82..e1fa74634af 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.40 1999/04/16 06:38:17 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.41 1999/04/20 02:19:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@
#include "miscadmin.h"
#include "libpq/libpq.h"
#include "storage/proc.h"
+#include "tcop/tcopprot.h"
#include "utils/trace.h"
#ifdef USE_SYSLOG
@@ -216,24 +217,12 @@ elog(int lev, const char *fmt,...)
if (lev == ERROR)
{
- extern bool InError;
-
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
if (!InError)
{
- if (MyProcPid == 0) {
- kill(getpid(), SIGQUIT);
- } else {
- kill(MyProcPid, SIGQUIT); /* abort to traffic cop */
- }
- pause();
+ /* exit to main loop */
+ siglongjmp(Warn_restart, 1);
}
-
- /*
- * The pause(3) is just to avoid race conditions where the thread
- * of control on an MP system gets past here (i.e., the signal is
- * not received instantaneously).
- */
}
if (lev == FATAL)