aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/bootstrap/bootstrap.c4
-rw-r--r--src/backend/executor/execQual.c30
-rw-r--r--src/backend/libpq/pqcomm.c9
-rw-r--r--src/backend/port/dynloader/bsdi.h2
-rw-r--r--src/backend/postmaster/postmaster.c146
-rw-r--r--src/backend/storage/ipc/ipc.c21
-rw-r--r--src/backend/storage/ipc/ipci.c4
-rw-r--r--src/backend/storage/smgr/mm.c5
-rw-r--r--src/backend/storage/smgr/smgr.c4
-rw-r--r--src/backend/tcop/postgres.c38
-rw-r--r--src/backend/utils/error/excabort.c6
-rw-r--r--src/backend/utils/init/globals.c3
-rw-r--r--src/backend/utils/init/miscinit.c9
-rw-r--r--src/backend/utils/init/postinit.c9
-rw-r--r--src/include/libpq/libpq.h8
-rw-r--r--src/include/miscadmin.h3
-rw-r--r--src/include/storage/ipc.h5
-rw-r--r--src/include/tcop/tcopprot.h6
-rw-r--r--src/interfaces/Makefile4
19 files changed, 172 insertions, 144 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index f41187c0504..d2e6fff5bbd 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.41 1998/05/19 18:05:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.42 1998/05/29 17:00:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -382,7 +382,7 @@ BootstrapMain(int argc, char *argv[])
* initialize input fd
* ----------------
*/
- if (IsUnderPostmaster == true && portFd < 0)
+ if (IsUnderPostmaster && portFd < 0)
{
fputs("backend: failed, no -P option with -postmaster opt.\n", stderr);
exitpg(1);
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index a4988e407c0..34193990db0 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.31 1998/04/27 04:05:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.32 1998/05/29 17:00:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -671,7 +671,7 @@ ExecMakeFunctionResult(Node *node,
bool *isNull,
bool *isDone)
{
- Datum argv[MAXFMGRARGS];
+ Datum argV[MAXFMGRARGS];
FunctionCachePtr fcache;
Func *funcNode = NULL;
Oper *operNode = NULL;
@@ -699,7 +699,7 @@ ExecMakeFunctionResult(Node *node,
* arguments is a list of expressions to evaluate
* before passing to the function manager.
* We collect the results of evaluating the expressions
- * into a datum array (argv) and pass this array to arrayFmgr()
+ * into a datum array (argV) and pass this array to arrayFmgr()
* ----------------
*/
if (fcache->nargs != 0)
@@ -718,11 +718,11 @@ ExecMakeFunctionResult(Node *node,
*/
if ((fcache->hasSetArg) && fcache->setArg != NULL)
{
- argv[0] = (Datum) fcache->setArg;
+ argV[0] = (Datum) fcache->setArg;
argDone = false;
}
else
- ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone);
+ ExecEvalFuncArgs(fcache, econtext, arguments, argV, &argDone);
if ((fcache->hasSetArg) && (argDone))
{
@@ -745,7 +745,7 @@ ExecMakeFunctionResult(Node *node,
* which defines this set. So replace the existing funcid in the
* funcnode with the set's OID. Also, we want a new fcache which
* points to the right function, so get that, now that we have the
- * right OID. Also zero out the argv, since the real set doesn't take
+ * right OID. Also zero out the argV, since the real set doesn't take
* any arguments.
*/
if (((Func *) node)->funcid == F_SETEVAL)
@@ -753,18 +753,18 @@ ExecMakeFunctionResult(Node *node,
funcisset = true;
if (fcache->setArg)
{
- argv[0] = 0;
+ argV[0] = 0;
((Func *) node)->funcid = (Oid) PointerGetDatum(fcache->setArg);
}
else
{
- ((Func *) node)->funcid = (Oid) argv[0];
- setFcache(node, argv[0], NIL, econtext);
+ ((Func *) node)->funcid = (Oid) argV[0];
+ setFcache(node, argV[0], NIL, econtext);
fcache = ((Func *) node)->func_fcache;
- fcache->setArg = (char *) argv[0];
- argv[0] = (Datum) 0;
+ fcache->setArg = (char *) argV[0];
+ argV[0] = (Datum) 0;
}
}
@@ -778,7 +778,7 @@ ExecMakeFunctionResult(Node *node,
Datum result;
Assert(funcNode);
- result = postquel_function(funcNode, (char **) argv, isNull, isDone);
+ result = postquel_function(funcNode, (char **) argV, isNull, isDone);
/*
* finagle the situation where we are iterating through all
@@ -791,7 +791,7 @@ ExecMakeFunctionResult(Node *node,
{
bool argDone;
- ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone);
+ ExecEvalFuncArgs(fcache, econtext, arguments, argV, &argDone);
if (argDone)
{
@@ -801,7 +801,7 @@ ExecMakeFunctionResult(Node *node,
}
else
result = postquel_function(funcNode,
- (char **) argv,
+ (char **) argV,
isNull,
isDone);
}
@@ -837,7 +837,7 @@ ExecMakeFunctionResult(Node *node,
if (fcache->nullVect[i] == true)
*isNull = true;
- return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argv, isNull));
+ return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull));
}
}
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 7dca3d567e5..4e1a2659ced 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.42 1998/05/27 18:32:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.43 1998/05/29 17:00:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -564,8 +564,8 @@ static char sock_path[MAXPGPATH + 1] = "";
void
StreamDoUnlink()
{
- if (sock_path[0])
- unlink(sock_path);
+ Assert(sock_path[0]);
+ unlink(sock_path);
}
int
@@ -628,6 +628,9 @@ StreamServerPort(char *hostName, short portName, int *fdP)
return (STATUS_ERROR);
}
+ if (family == AF_UNIX)
+ on_exitpg(StreamDoUnlink, NULL);
+
listen(fd, SOMAXCONN);
/*
diff --git a/src/backend/port/dynloader/bsdi.h b/src/backend/port/dynloader/bsdi.h
index 02d9c0aae88..91a5331a8c9 100644
--- a/src/backend/port/dynloader/bsdi.h
+++ b/src/backend/port/dynloader/bsdi.h
@@ -20,7 +20,7 @@
#ifndef PRE_BSDI_2_1
#include <dlfcn.h>
-#define pg_dlopen(f) dlopen(f, 1)
+#define pg_dlopen(f) dlopen(f, RTLD_LAZY)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 59b3007bd53..81b789de51f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.77 1998/05/27 18:32:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.78 1998/05/29 17:00:09 momjian Exp $
*
* NOTES
*
@@ -82,6 +82,8 @@
#include "miscadmin.h"
#include "version.h"
#include "lib/dllist.h"
+#include "tcop/tcopprot.h"
+#include "commands/async.h"
#include "nodes/nodes.h"
#include "utils/mcxt.h"
#include "storage/proc.h"
@@ -91,16 +93,6 @@
#endif
#include "storage/fd.h"
-#if defined(DBX_VERSION)
-#define FORK() (0)
-#else
-#ifndef HAVE_VFORK
-#define FORK() fork()
-#else
-#define FORK() vfork()
-#endif
-#endif
-
#if !defined(MAXINT)
#define MAXINT INT_MAX
#endif
@@ -165,6 +157,7 @@ static IpcMemoryKey ipc_key;
static int NextBackendId = MAXINT; /* XXX why? */
static char *progname = (char *) NULL;
+static char **argv_name;
/*
* Default Values
@@ -192,6 +185,19 @@ static int SendStop = false;
static bool NetServer = false; /* if not zero, postmaster listen for
* non-local connections */
+
+/*
+ * GH: For !HAVE_SIGPROCMASK (NEXTSTEP), TRH implemented an
+ * alternative interface.
+ */
+#ifdef HAVE_SIGPROCMASK
+static sigset_t oldsigmask,
+ newsigmask;
+#else
+static int orgsigmask = sigblock(0);
+#endif
+
+
/*
* postmaster.c - function prototypes
*/
@@ -202,7 +208,7 @@ static void pmdie(SIGNAL_ARGS);
static void reaper(SIGNAL_ARGS);
static void dumpstatus(SIGNAL_ARGS);
static void CleanupProc(int pid, int exitstatus);
-static int DoExec(Port *port);
+static int DoBackend(Port *port);
static void ExitPostmaster(int status);
static void usage(const char *);
static int ServerLoop(void);
@@ -284,7 +290,6 @@ int
PostmasterMain(int argc, char *argv[])
{
extern int NBuffers; /* from buffer/bufmgr.c */
- extern bool IsPostmaster; /* from smgr/mm.c */
int opt;
char *hostName;
int status;
@@ -293,9 +298,8 @@ PostmasterMain(int argc, char *argv[])
char hostbuf[MAXHOSTNAMELEN];
progname = argv[0];
-
- IsPostmaster = true;
-
+ argv_name = &argv[0];
+
/*
* for security, no dir or file created can be group or other
* accessible
@@ -531,26 +535,14 @@ ServerLoop(void)
int nSockets;
Dlelem *curr;
- /*
- * GH: For !HAVE_SIGPROCMASK (NEXTSTEP), TRH implemented an
- * alternative interface.
- */
-#ifdef HAVE_SIGPROCMASK
- sigset_t oldsigmask,
- newsigmask;
-
-#else
- int orgsigmask = sigblock(0);
-
-#endif
-
nSockets = initMasks(&readmask, &writemask);
#ifdef HAVE_SIGPROCMASK
- sigprocmask(0, 0, &oldsigmask);
+ sigprocmask(0, NULL, &oldsigmask);
sigemptyset(&newsigmask);
sigaddset(&newsigmask, SIGCHLD);
#endif
+
for (;;)
{
Port *port;
@@ -1048,13 +1040,17 @@ BackendStartup(Port *port)
fprintf(stderr, "-----------------------------------------\n");
}
- if ((pid = FORK()) == 0)
- { /* child */
- if (DoExec(port))
- fprintf(stderr, "%s child[%d]: BackendStartup: execv failed\n",
- progname, pid);
- /* use _exit to keep from double-flushing stdio */
- _exit(1);
+ if ((pid = fork()) == 0)
+ { /* child */
+ if (DoBackend(port))
+ {
+ fprintf(stderr, "%s child[%d]: BackendStartup: backend startup failed\n",
+ progname, pid);
+ /* use _exit to keep from double-flushing stdio */
+ _exit(1);
+ }
+ else
+ _exit(0);
}
/* in parent */
@@ -1123,19 +1119,14 @@ split_opts(char **argv, int *argcp, char *s)
}
/*
- * DoExec -- set up the argument list and perform an execv system call
- *
- * Tries fairly hard not to dork with anything that isn't automatically
- * allocated so we don't do anything weird to the postmaster when it gets
- * its thread back. (This is vfork() we're talking about. If we're using
- * fork() because we don't have vfork(), then we don't really care.)
+ * DoBackend -- set up the argument list and perform an execv system call
*
- * returns:
- * Shouldn't return at all.
- * If execv() fails, return status.
+ * returns:
+ * Shouldn't return at all.
+ * If execv() fails, return status.
*/
static int
-DoExec(Port *port)
+DoBackend(Port *port)
{
char execbuf[MAXPATHLEN];
char portbuf[ARGV_SIZE];
@@ -1154,9 +1145,58 @@ DoExec(Port *port)
int ac = 0;
int i;
+ /*
+ * Let's clean up ourselves as the postmaster child
+ */
+
+ clear_exitpg(); /* we don't want the postmaster's exitpg() handlers */
+
+ /* ----------------
+ * register signal handlers.
+ * Thanks to the postmaster, these are currently blocked.
+ * ----------------
+ */
+ pqsignal(SIGINT, die);
+
+ pqsignal(SIGHUP, die);
+ pqsignal(SIGTERM, die);
+ pqsignal(SIGPIPE, die);
+ pqsignal(SIGUSR1, quickdie);
+ pqsignal(SIGUSR2, Async_NotifyHandler);
+ pqsignal(SIGFPE, FloatExceptionHandler);
+
+ pqsignal(SIGCHLD, SIG_DFL);
+ pqsignal(SIGTTIN, SIG_DFL);
+ pqsignal(SIGTTOU, SIG_DFL);
+ pqsignal(SIGCONT, SIG_DFL);
+
+ /* OK, let's unblock our signals, all together now... */
+ sigprocmask(SIG_SETMASK, &oldsigmask, 0);
+
+ /* Close the postmater sockets */
+ if (NetServer)
+ StreamClose(ServerSock_INET);
+ StreamClose(ServerSock_UNIX);
+
+ /* Now, on to standard postgres stuff */
+
+ MyProcPid = getpid();
+
strncpy(execbuf, Execfile, MAXPATHLEN - 1);
av[ac++] = execbuf;
+ /*
+ * We need to set our argv[0] to an absolute path name because
+ * some OS's use this for dynamic loading, like BSDI. Without it,
+ * when we change directories to the database dir, the dynamic
+ * loader can't find the base executable and fails.
+ * Another advantage is that this changes the 'ps' displayed
+ * process name on some platforms. It does on BSDI. That's
+ * a big win.
+ */
+
+ *argv_name = Execfile;
+
/* Tell the backend it is being called from the postmaster */
av[ac++] = "-p";
@@ -1195,7 +1235,7 @@ DoExec(Port *port)
/* Tell the backend what protocol the frontend is using. */
- sprintf(protobuf, "-v %u", port->proto);
+ sprintf(protobuf, "-v%u", port->proto);
av[ac++] = protobuf;
StrNCpy(dbbuf, port->database, ARGV_SIZE);
@@ -1205,14 +1245,14 @@ DoExec(Port *port)
if (DebugLvl > 1)
{
- fprintf(stderr, "%s child[%ld]: execv(",
- progname, (long) MyProcPid);
+ fprintf(stderr, "%s child[%d]: starting with (",
+ progname, MyProcPid);
for (i = 0; i < ac; ++i)
fprintf(stderr, "%s, ", av[i]);
fprintf(stderr, ")\n");
}
- return (execv(av[0], av));
+ return(PostgresMain(ac, av));
}
/*
@@ -1228,9 +1268,9 @@ ExitPostmaster(int status)
* the backends all be killed? probably not.
*/
if (ServerSock_INET != INVALID_SOCK)
- close(ServerSock_INET);
+ StreamClose(ServerSock_INET);
if (ServerSock_UNIX != INVALID_SOCK)
- close(ServerSock_UNIX);
+ StreamClose(ServerSock_UNIX);
exitpg(status);
}
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 28fbd87a99d..768b144ff56 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.20 1998/03/02 05:41:55 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.21 1998/05/29 17:00:10 momjian Exp $
*
* NOTES
*
@@ -137,7 +137,6 @@ exitpg(int code)
for (i = onexit_index - 1; i >= 0; --i)
(*onexit_list[i].function) (code, onexit_list[i].arg);
- StreamDoUnlink();
exit(code);
}
@@ -168,7 +167,9 @@ quasi_exitpg()
* ----------------
*/
for (i = onexit_index - 1; i >= 0; --i)
- (*onexit_list[i].function) (0, onexit_list[i].arg);
+ /* Don't do StreamDoUnlink on quasi_exit */
+ if (onexit_list[i].function != StreamDoUnlink)
+ (*onexit_list[i].function) (0, onexit_list[i].arg);
onexit_index = 0;
exitpg_inprogress = 0;
@@ -182,7 +183,7 @@ quasi_exitpg()
* ----------------------------------------------------------------
*/
int
- on_exitpg(void (*function) (), caddr_t arg)
+on_exitpg(void (*function) (), caddr_t arg)
{
if (onexit_index >= MAX_ON_EXITS)
return (-1);
@@ -195,6 +196,18 @@ int
return (0);
}
+/* ----------------------------------------------------------------
+ * clear_exitpg
+ *
+ * this function clears all exitpg() registered functions.
+ * ----------------------------------------------------------------
+ */
+void
+clear_exitpg(void)
+{
+ onexit_index = 0;
+}
+
/****************************************************************************/
/* IPCPrivateSemaphoreKill(status, semId) */
/* */
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index b6740b524d7..4da60cb9ac9 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.7 1997/09/08 02:28:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.8 1998/05/29 17:00:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -101,7 +101,7 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
* ----------------
*/
InitProcGlobal(key);
- on_exitpg(ProcFreeAllSemaphores, 0);
+ on_exitpg(ProcFreeAllSemaphores, NULL);
CreateSharedInvalidationState(key);
}
diff --git a/src/backend/storage/smgr/mm.c b/src/backend/storage/smgr/mm.c
index c666644ebc9..265f9696ae4 100644
--- a/src/backend/storage/smgr/mm.c
+++ b/src/backend/storage/smgr/mm.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.7 1997/09/18 20:21:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.8 1998/05/29 17:00:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,7 +79,6 @@ typedef struct MMRelHashEntry
#define MMNRELATIONS 2
SPINLOCK MMCacheLock;
-extern bool IsPostmaster;
extern Oid MyDatabaseId;
static int *MMCurTop;
@@ -139,7 +138,7 @@ mminit()
return (SM_FAIL);
}
- if (IsPostmaster)
+ if (IsUnderPostmaster) /* was IsPostmaster bjm */
{
MemSet(mmcacheblk, 0, mmsize);
SpinRelease(MMCacheLock);
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index c6956b30999..c0bdd94da65 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.14 1998/04/01 15:35:33 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.15 1998/05/29 17:00:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -100,7 +100,7 @@ smgrinit()
}
/* register the shutdown proc */
- on_exitpg(smgrshutdown, 0);
+ on_exitpg(smgrshutdown, NULL);
return (SM_SUCCESS);
}
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c8cad2444c7..b2fb3008e65 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.71 1998/05/27 18:32:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.72 1998/05/29 17:00:15 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -83,8 +83,6 @@
#include "nodes/memnodes.h"
#endif
-static void quickdie(SIGNAL_ARGS);
-
/* ----------------
* global variables
* ----------------
@@ -743,7 +741,7 @@ handle_warn(SIGNAL_ARGS)
siglongjmp(Warn_restart, 1);
}
-static void
+void
quickdie(SIGNAL_ARGS)
{
elog(NOTICE, "Message from PostgreSQL backend:"
@@ -770,7 +768,7 @@ die(SIGNAL_ARGS)
}
/* signal handler for floating point exception */
-static void
+void
FloatExceptionHandler(SIGNAL_ARGS)
{
elog(ERROR, "floating point exception!"
@@ -850,26 +848,6 @@ PostgresMain(int argc, char *argv[])
extern short DebugLvl;
/* ----------------
- * register signal handlers.
- * ----------------
- */
- pqsignal(SIGINT, die);
-
- pqsignal(SIGHUP, die);
- pqsignal(SIGTERM, die);
- pqsignal(SIGPIPE, die);
- pqsignal(SIGUSR1, quickdie);
- pqsignal(SIGUSR2, Async_NotifyHandler);
- pqsignal(SIGFPE, FloatExceptionHandler);
-
- /* --------------------
- * initialize globals
- * -------------------
- */
-
- MyProcPid = getpid();
-
- /* ----------------
* parse command line arguments
* ----------------
*/
@@ -915,6 +893,8 @@ PostgresMain(int argc, char *argv[])
EuroDates = TRUE;
}
+ optind = 1; /* reset after postmaster usage */
+
while ((flag = getopt(argc, argv, "B:bCD:d:Eef:iK:Lm:MNo:P:pQS:st:v:x:F"))
!= EOF)
switch (flag)
@@ -1254,7 +1234,7 @@ PostgresMain(int argc, char *argv[])
* initialize portal file descriptors
* ----------------
*/
- if (IsUnderPostmaster == true)
+ if (IsUnderPostmaster)
{
if (Portfd < 0)
{
@@ -1314,10 +1294,10 @@ PostgresMain(int argc, char *argv[])
* POSTGRES main processing loop begins here
* ----------------
*/
- if (IsUnderPostmaster == false)
+ if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.71 $ $Date: 1998/05/27 18:32:03 $");
+ puts("$Revision: 1.72 $ $Date: 1998/05/29 17:00:15 $");
}
/* ----------------
@@ -1327,7 +1307,7 @@ PostgresMain(int argc, char *argv[])
* ----------------
*/
if (!TransactionFlushEnabled())
- on_exitpg(FlushBufferPool, (caddr_t) 0);
+ on_exitpg(FlushBufferPool, NULL);
for (;;)
{
diff --git a/src/backend/utils/error/excabort.c b/src/backend/utils/error/excabort.c
index d87d57f2fef..f956c42af01 100644
--- a/src/backend/utils/error/excabort.c
+++ b/src/backend/utils/error/excabort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/excabort.c,v 1.4 1997/09/08 21:49:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/excabort.c,v 1.5 1998/05/29 17:00:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,10 +22,6 @@ ExcAbort(const Exception *excP,
ExcData data,
ExcMessage message)
{
-#ifdef __SABER__
- saber_stop();
-#else
/* dump core */
abort();
-#endif
}
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index f58a75ec857..2deec81de00 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.22 1998/05/19 18:05:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.23 1998/05/29 17:00:18 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -66,7 +66,6 @@ Oid MyDatabaseId = InvalidOid;
bool TransactionInitWasProcessed = false;
bool IsUnderPostmaster = false;
-bool IsPostmaster = false;
short DebugLvl = 0;
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index b9a5062f483..7f02bec6113 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.14 1998/04/05 21:04:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.15 1998/05/29 17:00:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,9 +84,6 @@ unsigned char RecodeBackTable[128];
void
ExitPostgres(ExitStatus status)
{
-#ifdef __SABER__
- saber_stop();
-#endif
exitpg(status);
}
@@ -111,10 +108,6 @@ AbortPostgres()
{
char *abortValue = getenv(EnableAbortEnvVarName);
-#ifdef __SABER__
- saber_stop();
-#endif
-
if (PointerIsValid(abortValue) && abortValue[0] != '\0')
abort();
else
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 76042390cc0..27bb849a08b 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.27 1998/04/05 21:04:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.28 1998/05/29 17:00:21 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
@@ -384,8 +384,11 @@ forcesharedmemory:
#endif
- PostgresIpcKey = key;
- AttachSharedMemoryAndSemaphores(key);
+ if (!IsUnderPostmaster) /* postmaster already did this */
+ {
+ PostgresIpcKey = key;
+ AttachSharedMemoryAndSemaphores(key);
+ }
}
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index 6768626f988..61c8c9910dd 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq.h,v 1.14 1998/05/19 18:05:55 momjian Exp $
+ * $Id: libpq.h,v 1.15 1998/05/29 17:00:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -279,9 +279,9 @@ extern int StreamOpen(char *hostName, short portName, Port *port);
extern void pq_regoob(void (*fptr) ());
extern void pq_unregoob(void);
extern void pq_async_notify(void);
-extern int StreamServerPort(char *hostName, short portName, int *fdP);
-extern int StreamConnection(int server_fd, Port *port);
+extern void StreamDoUnlink();
+extern int StreamServerPort(char *hostName, short portName, int *fdP);
+extern int StreamConnection(int server_fd, Port *port);
extern void StreamClose(int sock);
-extern void StreamDoUnlink(void);
#endif /* LIBPQ_H */
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index f5da6e628ab..d7cee404c58 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.23 1998/05/19 18:05:52 momjian Exp $
+ * $Id: miscadmin.h,v 1.24 1998/05/29 17:00:22 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -55,7 +55,6 @@ extern Oid MyDatabaseId;
extern bool TransactionInitWasProcessed;
extern bool IsUnderPostmaster;
-extern bool IsPostmaster;
extern short DebugLvl;
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index cbd649234a7..5bb8b45eb69 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ipc.h,v 1.24 1998/02/26 04:43:26 momjian Exp $
+ * $Id: ipc.h,v 1.25 1998/05/29 17:00:26 momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
@@ -73,7 +73,8 @@ typedef int IpcMemoryId;
/* ipc.c */
extern void exitpg(int code);
extern void quasi_exitpg(void);
-extern int on_exitpg(void (*function) (), caddr_t arg);
+extern int on_exitpg(void (*function) (), caddr_t arg);
+extern void clear_exitpg(void);
extern IpcSemaphoreId
IpcSemaphoreCreate(IpcSemaphoreKey semKey,
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index dbd9fdba740..f20a14d0e2b 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tcopprot.h,v 1.12 1998/05/19 18:05:58 momjian Exp $
+ * $Id: tcopprot.h,v 1.13 1998/05/29 17:00:28 momjian Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
@@ -33,9 +33,11 @@ pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
#endif /* BOOTSTRAP_HEADER */
extern void handle_warn(SIGNAL_ARGS);
+extern void quickdie(SIGNAL_ARGS);
extern void die(SIGNAL_ARGS);
+extern void FloatExceptionHandler(SIGNAL_ARGS);
extern void CancelQuery(void);
-extern int PostgresMain(int argc, char *argv[]);
+extern int PostgresMain(int argc, char *argv[]);
extern void ResetUsage(void);
extern void ShowUsage(void);
diff --git a/src/interfaces/Makefile b/src/interfaces/Makefile
index 13ae838c6b6..12b0306f08c 100644
--- a/src/interfaces/Makefile
+++ b/src/interfaces/Makefile
@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.9 1998/03/05 13:18:51 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.10 1998/05/29 17:00:29 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -16,7 +16,7 @@ include $(SRCDIR)/Makefile.global
.DEFAULT all:
$(MAKE) -C libpq $@
- $(MAKE) -C ecpg $@
+# $(MAKE) -C ecpg $@
ifeq ($(HAVE_Cplusplus), true)
$(MAKE) -C libpq++ $@
else