Remove fork()/exec() and only do fork(). Small cleanups.

This commit is contained in:
Bruce Momjian 1998-05-29 17:00:34 +00:00
parent 2d4c6cab96
commit 212c905e2c
19 changed files with 172 additions and 144 deletions

View File

@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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 * initialize input fd
* ---------------- * ----------------
*/ */
if (IsUnderPostmaster == true && portFd < 0) if (IsUnderPostmaster && portFd < 0)
{ {
fputs("backend: failed, no -P option with -postmaster opt.\n", stderr); fputs("backend: failed, no -P option with -postmaster opt.\n", stderr);
exitpg(1); exitpg(1);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 *isNull,
bool *isDone) bool *isDone)
{ {
Datum argv[MAXFMGRARGS]; Datum argV[MAXFMGRARGS];
FunctionCachePtr fcache; FunctionCachePtr fcache;
Func *funcNode = NULL; Func *funcNode = NULL;
Oper *operNode = NULL; Oper *operNode = NULL;
@ -699,7 +699,7 @@ ExecMakeFunctionResult(Node *node,
* arguments is a list of expressions to evaluate * arguments is a list of expressions to evaluate
* before passing to the function manager. * before passing to the function manager.
* We collect the results of evaluating the expressions * 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) if (fcache->nargs != 0)
@ -718,11 +718,11 @@ ExecMakeFunctionResult(Node *node,
*/ */
if ((fcache->hasSetArg) && fcache->setArg != NULL) if ((fcache->hasSetArg) && fcache->setArg != NULL)
{ {
argv[0] = (Datum) fcache->setArg; argV[0] = (Datum) fcache->setArg;
argDone = false; argDone = false;
} }
else else
ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone); ExecEvalFuncArgs(fcache, econtext, arguments, argV, &argDone);
if ((fcache->hasSetArg) && (argDone)) if ((fcache->hasSetArg) && (argDone))
{ {
@ -745,7 +745,7 @@ ExecMakeFunctionResult(Node *node,
* which defines this set. So replace the existing funcid in the * which defines this set. So replace the existing funcid in the
* funcnode with the set's OID. Also, we want a new fcache which * 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 * 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. * any arguments.
*/ */
if (((Func *) node)->funcid == F_SETEVAL) if (((Func *) node)->funcid == F_SETEVAL)
@ -753,18 +753,18 @@ ExecMakeFunctionResult(Node *node,
funcisset = true; funcisset = true;
if (fcache->setArg) if (fcache->setArg)
{ {
argv[0] = 0; argV[0] = 0;
((Func *) node)->funcid = (Oid) PointerGetDatum(fcache->setArg); ((Func *) node)->funcid = (Oid) PointerGetDatum(fcache->setArg);
} }
else else
{ {
((Func *) node)->funcid = (Oid) argv[0]; ((Func *) node)->funcid = (Oid) argV[0];
setFcache(node, argv[0], NIL, econtext); setFcache(node, argV[0], NIL, econtext);
fcache = ((Func *) node)->func_fcache; fcache = ((Func *) node)->func_fcache;
fcache->setArg = (char *) argv[0]; fcache->setArg = (char *) argV[0];
argv[0] = (Datum) 0; argV[0] = (Datum) 0;
} }
} }
@ -778,7 +778,7 @@ ExecMakeFunctionResult(Node *node,
Datum result; Datum result;
Assert(funcNode); 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 * finagle the situation where we are iterating through all
@ -791,7 +791,7 @@ ExecMakeFunctionResult(Node *node,
{ {
bool argDone; bool argDone;
ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone); ExecEvalFuncArgs(fcache, econtext, arguments, argV, &argDone);
if (argDone) if (argDone)
{ {
@ -801,7 +801,7 @@ ExecMakeFunctionResult(Node *node,
} }
else else
result = postquel_function(funcNode, result = postquel_function(funcNode,
(char **) argv, (char **) argV,
isNull, isNull,
isDone); isDone);
} }
@ -837,7 +837,7 @@ ExecMakeFunctionResult(Node *node,
if (fcache->nullVect[i] == true) if (fcache->nullVect[i] == true)
*isNull = true; *isNull = true;
return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argv, isNull)); return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull));
} }
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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,7 +564,7 @@ static char sock_path[MAXPGPATH + 1] = "";
void void
StreamDoUnlink() StreamDoUnlink()
{ {
if (sock_path[0]) Assert(sock_path[0]);
unlink(sock_path); unlink(sock_path);
} }
@ -628,6 +628,9 @@ StreamServerPort(char *hostName, short portName, int *fdP)
return (STATUS_ERROR); return (STATUS_ERROR);
} }
if (family == AF_UNIX)
on_exitpg(StreamDoUnlink, NULL);
listen(fd, SOMAXCONN); listen(fd, SOMAXCONN);
/* /*

View File

@ -20,7 +20,7 @@
#ifndef PRE_BSDI_2_1 #ifndef PRE_BSDI_2_1
#include <dlfcn.h> #include <dlfcn.h>
#define pg_dlopen(f) dlopen(f, 1) #define pg_dlopen(f) dlopen(f, RTLD_LAZY)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
@ -82,6 +82,8 @@
#include "miscadmin.h" #include "miscadmin.h"
#include "version.h" #include "version.h"
#include "lib/dllist.h" #include "lib/dllist.h"
#include "tcop/tcopprot.h"
#include "commands/async.h"
#include "nodes/nodes.h" #include "nodes/nodes.h"
#include "utils/mcxt.h" #include "utils/mcxt.h"
#include "storage/proc.h" #include "storage/proc.h"
@ -91,16 +93,6 @@
#endif #endif
#include "storage/fd.h" #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) #if !defined(MAXINT)
#define MAXINT INT_MAX #define MAXINT INT_MAX
#endif #endif
@ -165,6 +157,7 @@ static IpcMemoryKey ipc_key;
static int NextBackendId = MAXINT; /* XXX why? */ static int NextBackendId = MAXINT; /* XXX why? */
static char *progname = (char *) NULL; static char *progname = (char *) NULL;
static char **argv_name;
/* /*
* Default Values * Default Values
@ -192,6 +185,19 @@ static int SendStop = false;
static bool NetServer = false; /* if not zero, postmaster listen for static bool NetServer = false; /* if not zero, postmaster listen for
* non-local connections */ * 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 * postmaster.c - function prototypes
*/ */
@ -202,7 +208,7 @@ static void pmdie(SIGNAL_ARGS);
static void reaper(SIGNAL_ARGS); static void reaper(SIGNAL_ARGS);
static void dumpstatus(SIGNAL_ARGS); static void dumpstatus(SIGNAL_ARGS);
static void CleanupProc(int pid, int exitstatus); static void CleanupProc(int pid, int exitstatus);
static int DoExec(Port *port); static int DoBackend(Port *port);
static void ExitPostmaster(int status); static void ExitPostmaster(int status);
static void usage(const char *); static void usage(const char *);
static int ServerLoop(void); static int ServerLoop(void);
@ -284,7 +290,6 @@ int
PostmasterMain(int argc, char *argv[]) PostmasterMain(int argc, char *argv[])
{ {
extern int NBuffers; /* from buffer/bufmgr.c */ extern int NBuffers; /* from buffer/bufmgr.c */
extern bool IsPostmaster; /* from smgr/mm.c */
int opt; int opt;
char *hostName; char *hostName;
int status; int status;
@ -293,8 +298,7 @@ PostmasterMain(int argc, char *argv[])
char hostbuf[MAXHOSTNAMELEN]; char hostbuf[MAXHOSTNAMELEN];
progname = argv[0]; progname = argv[0];
argv_name = &argv[0];
IsPostmaster = true;
/* /*
* for security, no dir or file created can be group or other * for security, no dir or file created can be group or other
@ -531,26 +535,14 @@ ServerLoop(void)
int nSockets; int nSockets;
Dlelem *curr; 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); nSockets = initMasks(&readmask, &writemask);
#ifdef HAVE_SIGPROCMASK #ifdef HAVE_SIGPROCMASK
sigprocmask(0, 0, &oldsigmask); sigprocmask(0, NULL, &oldsigmask);
sigemptyset(&newsigmask); sigemptyset(&newsigmask);
sigaddset(&newsigmask, SIGCHLD); sigaddset(&newsigmask, SIGCHLD);
#endif #endif
for (;;) for (;;)
{ {
Port *port; Port *port;
@ -1048,14 +1040,18 @@ BackendStartup(Port *port)
fprintf(stderr, "-----------------------------------------\n"); fprintf(stderr, "-----------------------------------------\n");
} }
if ((pid = FORK()) == 0) if ((pid = fork()) == 0)
{ /* child */ { /* child */
if (DoExec(port)) if (DoBackend(port))
fprintf(stderr, "%s child[%d]: BackendStartup: execv failed\n", {
fprintf(stderr, "%s child[%d]: BackendStartup: backend startup failed\n",
progname, pid); progname, pid);
/* use _exit to keep from double-flushing stdio */ /* use _exit to keep from double-flushing stdio */
_exit(1); _exit(1);
} }
else
_exit(0);
}
/* in parent */ /* in parent */
if (pid < 0) if (pid < 0)
@ -1123,19 +1119,14 @@ split_opts(char **argv, int *argcp, char *s)
} }
/* /*
* DoExec -- set up the argument list and perform an execv system call * DoBackend -- 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.)
* *
* returns: * returns:
* Shouldn't return at all. * Shouldn't return at all.
* If execv() fails, return status. * If execv() fails, return status.
*/ */
static int static int
DoExec(Port *port) DoBackend(Port *port)
{ {
char execbuf[MAXPATHLEN]; char execbuf[MAXPATHLEN];
char portbuf[ARGV_SIZE]; char portbuf[ARGV_SIZE];
@ -1154,9 +1145,58 @@ DoExec(Port *port)
int ac = 0; int ac = 0;
int i; 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); strncpy(execbuf, Execfile, MAXPATHLEN - 1);
av[ac++] = execbuf; 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 */ /* Tell the backend it is being called from the postmaster */
av[ac++] = "-p"; av[ac++] = "-p";
@ -1205,14 +1245,14 @@ DoExec(Port *port)
if (DebugLvl > 1) if (DebugLvl > 1)
{ {
fprintf(stderr, "%s child[%ld]: execv(", fprintf(stderr, "%s child[%d]: starting with (",
progname, (long) MyProcPid); progname, MyProcPid);
for (i = 0; i < ac; ++i) for (i = 0; i < ac; ++i)
fprintf(stderr, "%s, ", av[i]); fprintf(stderr, "%s, ", av[i]);
fprintf(stderr, ")\n"); 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. * the backends all be killed? probably not.
*/ */
if (ServerSock_INET != INVALID_SOCK) if (ServerSock_INET != INVALID_SOCK)
close(ServerSock_INET); StreamClose(ServerSock_INET);
if (ServerSock_UNIX != INVALID_SOCK) if (ServerSock_UNIX != INVALID_SOCK)
close(ServerSock_UNIX); StreamClose(ServerSock_UNIX);
exitpg(status); exitpg(status);
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
@ -137,7 +137,6 @@ exitpg(int code)
for (i = onexit_index - 1; i >= 0; --i) for (i = onexit_index - 1; i >= 0; --i)
(*onexit_list[i].function) (code, onexit_list[i].arg); (*onexit_list[i].function) (code, onexit_list[i].arg);
StreamDoUnlink();
exit(code); exit(code);
} }
@ -168,6 +167,8 @@ quasi_exitpg()
* ---------------- * ----------------
*/ */
for (i = onexit_index - 1; i >= 0; --i) for (i = onexit_index - 1; i >= 0; --i)
/* Don't do StreamDoUnlink on quasi_exit */
if (onexit_list[i].function != StreamDoUnlink)
(*onexit_list[i].function) (0, onexit_list[i].arg); (*onexit_list[i].function) (0, onexit_list[i].arg);
onexit_index = 0; onexit_index = 0;
@ -195,6 +196,18 @@ int
return (0); return (0);
} }
/* ----------------------------------------------------------------
* clear_exitpg
*
* this function clears all exitpg() registered functions.
* ----------------------------------------------------------------
*/
void
clear_exitpg(void)
{
onexit_index = 0;
}
/****************************************************************************/ /****************************************************************************/
/* IPCPrivateSemaphoreKill(status, semId) */ /* IPCPrivateSemaphoreKill(status, semId) */
/* */ /* */

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); InitProcGlobal(key);
on_exitpg(ProcFreeAllSemaphores, 0); on_exitpg(ProcFreeAllSemaphores, NULL);
CreateSharedInvalidationState(key); CreateSharedInvalidationState(key);
} }

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 #define MMNRELATIONS 2
SPINLOCK MMCacheLock; SPINLOCK MMCacheLock;
extern bool IsPostmaster;
extern Oid MyDatabaseId; extern Oid MyDatabaseId;
static int *MMCurTop; static int *MMCurTop;
@ -139,7 +138,7 @@ mminit()
return (SM_FAIL); return (SM_FAIL);
} }
if (IsPostmaster) if (IsUnderPostmaster) /* was IsPostmaster bjm */
{ {
MemSet(mmcacheblk, 0, mmsize); MemSet(mmcacheblk, 0, mmsize);
SpinRelease(MMCacheLock); SpinRelease(MMCacheLock);

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* register the shutdown proc */
on_exitpg(smgrshutdown, 0); on_exitpg(smgrshutdown, NULL);
return (SM_SUCCESS); return (SM_SUCCESS);
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -83,8 +83,6 @@
#include "nodes/memnodes.h" #include "nodes/memnodes.h"
#endif #endif
static void quickdie(SIGNAL_ARGS);
/* ---------------- /* ----------------
* global variables * global variables
* ---------------- * ----------------
@ -743,7 +741,7 @@ handle_warn(SIGNAL_ARGS)
siglongjmp(Warn_restart, 1); siglongjmp(Warn_restart, 1);
} }
static void void
quickdie(SIGNAL_ARGS) quickdie(SIGNAL_ARGS)
{ {
elog(NOTICE, "Message from PostgreSQL backend:" elog(NOTICE, "Message from PostgreSQL backend:"
@ -770,7 +768,7 @@ die(SIGNAL_ARGS)
} }
/* signal handler for floating point exception */ /* signal handler for floating point exception */
static void void
FloatExceptionHandler(SIGNAL_ARGS) FloatExceptionHandler(SIGNAL_ARGS)
{ {
elog(ERROR, "floating point exception!" elog(ERROR, "floating point exception!"
@ -849,26 +847,6 @@ PostgresMain(int argc, char *argv[])
extern char *optarg; extern char *optarg;
extern short DebugLvl; 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 * parse command line arguments
* ---------------- * ----------------
@ -915,6 +893,8 @@ PostgresMain(int argc, char *argv[])
EuroDates = TRUE; 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")) while ((flag = getopt(argc, argv, "B:bCD:d:Eef:iK:Lm:MNo:P:pQS:st:v:x:F"))
!= EOF) != EOF)
switch (flag) switch (flag)
@ -1254,7 +1234,7 @@ PostgresMain(int argc, char *argv[])
* initialize portal file descriptors * initialize portal file descriptors
* ---------------- * ----------------
*/ */
if (IsUnderPostmaster == true) if (IsUnderPostmaster)
{ {
if (Portfd < 0) if (Portfd < 0)
{ {
@ -1314,10 +1294,10 @@ PostgresMain(int argc, char *argv[])
* POSTGRES main processing loop begins here * POSTGRES main processing loop begins here
* ---------------- * ----------------
*/ */
if (IsUnderPostmaster == false) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface"); 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()) if (!TransactionFlushEnabled())
on_exitpg(FlushBufferPool, (caddr_t) 0); on_exitpg(FlushBufferPool, NULL);
for (;;) for (;;)
{ {

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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, ExcData data,
ExcMessage message) ExcMessage message)
{ {
#ifdef __SABER__
saber_stop();
#else
/* dump core */ /* dump core */
abort(); abort();
#endif
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Globals used all over the place should be declared here and not * Globals used all over the place should be declared here and not
@ -66,7 +66,6 @@ Oid MyDatabaseId = InvalidOid;
bool TransactionInitWasProcessed = false; bool TransactionInitWasProcessed = false;
bool IsUnderPostmaster = false; bool IsUnderPostmaster = false;
bool IsPostmaster = false;
short DebugLvl = 0; short DebugLvl = 0;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 void
ExitPostgres(ExitStatus status) ExitPostgres(ExitStatus status)
{ {
#ifdef __SABER__
saber_stop();
#endif
exitpg(status); exitpg(status);
} }
@ -111,10 +108,6 @@ AbortPostgres()
{ {
char *abortValue = getenv(EnableAbortEnvVarName); char *abortValue = getenv(EnableAbortEnvVarName);
#ifdef __SABER__
saber_stop();
#endif
if (PointerIsValid(abortValue) && abortValue[0] != '\0') if (PointerIsValid(abortValue) && abortValue[0] != '\0')
abort(); abort();
else else

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* InitPostgres() is the function called from PostgresMain * InitPostgres() is the function called from PostgresMain
@ -384,9 +384,12 @@ forcesharedmemory:
#endif #endif
if (!IsUnderPostmaster) /* postmaster already did this */
{
PostgresIpcKey = key; PostgresIpcKey = key;
AttachSharedMemoryAndSemaphores(key); AttachSharedMemoryAndSemaphores(key);
} }
}
/* -------------------------------- /* --------------------------------

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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_regoob(void (*fptr) ());
extern void pq_unregoob(void); extern void pq_unregoob(void);
extern void pq_async_notify(void); extern void pq_async_notify(void);
extern void StreamDoUnlink();
extern int StreamServerPort(char *hostName, short portName, int *fdP); extern int StreamServerPort(char *hostName, short portName, int *fdP);
extern int StreamConnection(int server_fd, Port *port); extern int StreamConnection(int server_fd, Port *port);
extern void StreamClose(int sock); extern void StreamClose(int sock);
extern void StreamDoUnlink(void);
#endif /* LIBPQ_H */ #endif /* LIBPQ_H */

View File

@ -11,7 +11,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* some of the information in this file will be moved to * some of the information in this file will be moved to
@ -55,7 +55,6 @@ extern Oid MyDatabaseId;
extern bool TransactionInitWasProcessed; extern bool TransactionInitWasProcessed;
extern bool IsUnderPostmaster; extern bool IsUnderPostmaster;
extern bool IsPostmaster;
extern short DebugLvl; extern short DebugLvl;

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* This file is very architecture-specific. This stuff should actually * This file is very architecture-specific. This stuff should actually
@ -74,6 +74,7 @@ typedef int IpcMemoryId;
extern void exitpg(int code); extern void exitpg(int code);
extern void quasi_exitpg(void); 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 extern IpcSemaphoreId
IpcSemaphoreCreate(IpcSemaphoreKey semKey, IpcSemaphoreCreate(IpcSemaphoreKey semKey,

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * OLD COMMENTS
* This file was created so that other c files could get the two * This file was created so that other c files could get the two
@ -33,7 +33,9 @@ pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
#endif /* BOOTSTRAP_HEADER */ #endif /* BOOTSTRAP_HEADER */
extern void handle_warn(SIGNAL_ARGS); extern void handle_warn(SIGNAL_ARGS);
extern void quickdie(SIGNAL_ARGS);
extern void die(SIGNAL_ARGS); extern void die(SIGNAL_ARGS);
extern void FloatExceptionHandler(SIGNAL_ARGS);
extern void CancelQuery(void); extern void CancelQuery(void);
extern int PostgresMain(int argc, char *argv[]); extern int PostgresMain(int argc, char *argv[]);
extern void ResetUsage(void); extern void ResetUsage(void);

View File

@ -7,7 +7,7 @@
# #
# #
# IDENTIFICATION # 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: .DEFAULT all:
$(MAKE) -C libpq $@ $(MAKE) -C libpq $@
$(MAKE) -C ecpg $@ # $(MAKE) -C ecpg $@
ifeq ($(HAVE_Cplusplus), true) ifeq ($(HAVE_Cplusplus), true)
$(MAKE) -C libpq++ $@ $(MAKE) -C libpq++ $@
else else