aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/bootstrap/bootstrap.c4
-rw-r--r--src/backend/commands/async.c18
-rw-r--r--src/backend/commands/user.c2
-rw-r--r--src/backend/executor/nodeHash.c6
-rw-r--r--src/backend/libpq/pqcomm.c9
-rw-r--r--src/backend/postmaster/postmaster.c4
-rw-r--r--src/backend/storage/buffer/bufmgr.c8
-rw-r--r--src/backend/storage/lmgr/lock.c23
-rw-r--r--src/backend/storage/lmgr/proc.c52
-rw-r--r--src/backend/tcop/postgres.c6
-rw-r--r--src/backend/tcop/utility.c4
-rw-r--r--src/backend/utils/error/elog.c6
-rw-r--r--src/backend/utils/init/globals.c5
-rw-r--r--src/backend/utils/sort/psort.c4
-rw-r--r--src/include/miscadmin.h5
-rw-r--r--src/include/storage/proc.h7
16 files changed, 61 insertions, 102 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 09179f09771..8482c370bc4 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.32 1998/01/07 21:02:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.33 1998/01/25 05:12:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -322,7 +322,7 @@ BootstrapMain(int argc, char *argv[])
* -------------------
*/
- MasterPid = getpid();
+ MyProcPid = getpid();
/* ----------------
* process command arguments
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 0ce2d6403cf..3ef9c913052 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.26 1997/12/17 04:44:49 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.27 1998/01/25 05:12:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,6 +67,7 @@
#include <postgres.h>
+#include <miscadmin.h>
#include <utils/syscache.h>
#include <access/relscan.h>
#include <access/xact.h>
@@ -264,7 +265,6 @@ Async_NotifyAtCommit()
TupleDesc tdesc;
ScanKeyData key;
Datum d;
- int ourpid;
bool isnull;
Buffer b;
extern TransactionState CurrentTransactionState;
@@ -291,7 +291,6 @@ Async_NotifyAtCommit()
RelationSetLockForWrite(lRel);
sRel = heap_beginscan(lRel, 0, false, 1, &key);
tdesc = RelationGetTupleDescriptor(lRel);
- ourpid = getpid();
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
@@ -303,7 +302,7 @@ Async_NotifyAtCommit()
d = heap_getattr(lTuple, b, Anum_pg_listener_pid,
tdesc, &isnull);
- if (ourpid == DatumGetInt32(d))
+ if (MyProcPid == DatumGetInt32(d))
{
#ifdef ASYNC_DEBUG
elog(DEBUG, "Notifying self, setting notifyFronEndPending to 1");
@@ -420,7 +419,6 @@ Async_Listen(char *relname, int pid)
int i;
bool isnull;
int alreadyListener = 0;
- int ourPid = getpid();
char *relnamei;
TupleDesc tupDesc;
@@ -453,7 +451,7 @@ Async_Listen(char *relname, int pid)
{
d = heap_getattr(htup, b, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
- if (pid == ourPid)
+ if (pid == MyProcPid)
{
alreadyListener = 1;
}
@@ -537,7 +535,7 @@ static void
Async_UnlistenOnExit(int code, /* from exitpg */
char *relname)
{
- Async_Unlisten((char *) relname, getpid());
+ Async_Unlisten((char *) relname, MyProcPid);
}
/*
@@ -579,7 +577,6 @@ Async_NotifyFrontEnd()
char repl[3],
nulls[3];
Buffer b;
- int ourpid;
bool isnull;
notifyFrontEndPending = 0;
@@ -589,7 +586,6 @@ Async_NotifyFrontEnd()
#endif
StartTransactionCommand();
- ourpid = getpid();
ScanKeyEntryInitialize(&key[0], 0,
Anum_pg_listener_notify,
Integer32EqualRegProcedure,
@@ -597,7 +593,7 @@ Async_NotifyFrontEnd()
ScanKeyEntryInitialize(&key[1], 0,
Anum_pg_listener_pid,
Integer32EqualRegProcedure,
- Int32GetDatum(ourpid));
+ Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
tdesc = RelationGetTupleDescriptor(lRel);
@@ -621,7 +617,7 @@ Async_NotifyFrontEnd()
if (whereToSendOutput == Remote)
{
pq_putnchar("A", 1);
- pq_putint(ourpid, sizeof(ourpid));
+ pq_putint((int32)MyProcPid, sizeof(int32));
pq_putstr(DatumGetName(d)->data);
pq_flush();
}
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 67d06b82c54..b0763bd7a5d 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -51,7 +51,7 @@ void UpdatePgPwdFile(char* sql) {
*/
filename = crypt_getpwdfilename();
tempname = (char*)malloc(strlen(filename) + 12);
- sprintf(tempname, "%s.%d", filename, getpid());
+ sprintf(tempname, "%s.%d", filename, MyProcPid);
/* Copy the contents of pg_user to the pg_pwd ASCII file using a the SEPCHAR
* character as the delimiter between fields. Then rename the file to its
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 26930f84842..79f308b6c85 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.16 1998/01/13 04:03:53 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.17 1998/01/25 05:13:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "postgres.h"
-
+#include "miscadmin.h"
#include "executor/execdebug.h"
#include "executor/executor.h"
#include "executor/nodeHash.h"
@@ -887,6 +887,6 @@ static int hjtmpcnt = 0;
static void
mk_hj_temp(char *tempname)
{
- sprintf(tempname, "HJ%d.%d", (int) getpid(), hjtmpcnt);
+ sprintf(tempname, "HJ%d.%d", (int) MyProcPid, hjtmpcnt);
hjtmpcnt = (hjtmpcnt + 1) % 1000;
}
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index e78f2e3052f..8014ae14f82 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.33 1998/01/07 21:03:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.34 1998/01/25 05:13:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,6 +56,7 @@
#include <postgres.h>
+#include <miscadmin.h>
#include <libpq/pqsignal.h>
#include <libpq/auth.h>
#include <libpq/libpq.h> /* where the declarations go */
@@ -515,11 +516,11 @@ pq_regoob(void (*fptr) ())
int fd = fileno(Pfout);
#if defined(hpux)
- ioctl(fd, FIOSSAIOOWN, getpid());
+ ioctl(fd, FIOSSAIOOWN, MyProcPid);
#elif defined(sco)
- ioctl(fd, SIOCSPGRP, getpid());
+ ioctl(fd, SIOCSPGRP, MyProcPid);
#else
- fcntl(fd, F_SETOWN, getpid());
+ fcntl(fd, F_SETOWN, MyProcPid);
#endif /* hpux */
pqsignal(SIGURG, fptr);
}
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 724a807c393..e445aa34f69 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.68 1997/12/19 02:06:37 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.69 1998/01/25 05:13:35 momjian Exp $
*
* NOTES
*
@@ -1337,7 +1337,7 @@ DoExec(StartupInfo *packet, int portFd)
if (DebugLvl > 1)
{
fprintf(stderr, "%s child[%ld]: execv(",
- progname, (long) getpid());
+ progname, (long) MyProcPid);
for (i = 0; i < ac; ++i)
fprintf(stderr, "%s, ", av[i]);
fprintf(stderr, ")\n");
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 566627d883b..04b5f0a30cc 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.31 1998/01/07 21:04:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.32 1998/01/25 05:13:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1828,14 +1828,10 @@ refcount = %ld, file: %s, line: %d\n",
_bm_trace(Oid dbId, Oid relId, int blkNo, int bufNo, int allocType)
{
- static int mypid = 0;
long start,
cur;
bmtrace *tb;
- if (mypid == 0)
- mypid = getpid();
-
start = *CurTraceBuf;
if (start > 0)
@@ -1871,7 +1867,7 @@ _bm_trace(Oid dbId, Oid relId, int blkNo, int bufNo, int allocType)
okay:
tb = &TraceBuf[start];
- tb->bmt_pid = mypid;
+ tb->bmt_pid = MyProcPid;
tb->bmt_buf = bufNo;
tb->bmt_dbid = dbId;
tb->bmt_relid = relId;
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 30078cbb161..efc4c991ff4 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.20 1998/01/23 22:16:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.21 1998/01/25 05:14:02 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@@ -37,6 +37,7 @@
#include <unistd.h>
#include "postgres.h"
+#include "miscadmin.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "storage/proc.h"
@@ -77,7 +78,7 @@ static char *lock_types[] = {
if ((lockDebug >= 1) && (tag->relId >= lock_debug_oid_min)) \
elog(DEBUG, \
"%s: pid (%d) rel (%d) dbid (%d) tid (%d,%d) type (%s)",where, \
- getpid(),\
+ MyProcPid,\
tag->relId, tag->dbId, \
((tag->tupleId.ip_blkid.bi_hi<<16)+\
tag->tupleId.ip_blkid.bi_lo),\
@@ -92,7 +93,7 @@ static char *lock_types[] = {
elog(DEBUG, \
"%s: pid (%d) rel (%d) dbid (%d) tid (%d,%d) nHolding (%d) "\
"holders (%d,%d,%d,%d,%d) type (%s)",where, \
- getpid(),\
+ MyProcPid,\
lock->tag.relId, lock->tag.dbId, \
((lock->tag.tupleId.ip_blkid.bi_hi<<16)+\
lock->tag.tupleId.ip_blkid.bi_lo),\
@@ -113,7 +114,7 @@ static char *lock_types[] = {
"%s: pid (%d) xid (%d) pid (%d) lock (%x) nHolding (%d) "\
"holders (%d,%d,%d,%d,%d)",\
where,\
- getpid(),\
+ MyProcPid,\
xidentP->tag.xid,\
xidentP->tag.pid,\
xidentP->tag.lock,\
@@ -550,7 +551,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
#ifdef USER_LOCKS
if (is_user_lock)
{
- item.tag.pid = getpid();
+ item.tag.pid = MyProcPid;
item.tag.xid = myXid = 0;
#ifdef USER_LOCKS_DEBUG
elog(NOTICE, "LockAcquire: user lock xid [%d,%d,%d]",
@@ -975,7 +976,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
#ifdef USER_LOCKS
if (is_user_lock)
{
- item.tag.pid = getpid();
+ item.tag.pid = MyProcPid;
item.tag.xid = 0;
#ifdef USER_LOCKS_DEBUG
elog(NOTICE, "LockRelease: user lock xid [%d,%d,%d]",
@@ -1153,14 +1154,12 @@ LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue)
#ifdef USER_LOCKS
int is_user_lock_table,
- my_pid,
count,
nskip;
is_user_lock_table = (tableId == 0);
- my_pid = getpid();
#ifdef USER_LOCKS_DEBUG
- elog(NOTICE, "LockReleaseAll: tableId=%d, pid=%d", tableId, my_pid);
+ elog(NOTICE, "LockReleaseAll: tableId=%d, pid=%d", tableId, MyProcPid);
#endif
if (is_user_lock_table)
{
@@ -1226,7 +1225,7 @@ LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue)
nskip++;
goto next_item;
}
- if (xidLook->tag.pid != my_pid)
+ if (xidLook->tag.pid != MyProcPid)
{
/* This should never happen */
#ifdef USER_LOCKS_DEBUG
@@ -1433,13 +1432,11 @@ DumpLocks()
SPINLOCK masterLock;
int nLockTypes;
LOCK *lock;
- int pid,
count;
int tableId = 1;
LOCKTAB *ltable;
- pid = getpid();
- ShmemPIDLookup(pid, &location);
+ ShmemPIDLookup(MyProcPid, &location);
if (location == INVALID_OFFSET)
return;
proc = (PROC *) MAKE_PTR(location);
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index b07b21d01db..deca35c8d42 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.27 1998/01/23 22:16:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.28 1998/01/25 05:14:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.27 1998/01/23 22:16:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.28 1998/01/25 05:14:09 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
@@ -127,7 +127,6 @@ InitProcGlobal(IPCKey key)
{
int i;
- ProcGlobal->numProcs = 0;
ProcGlobal->freeProcs = INVALID_OFFSET;
ProcGlobal->currKey = IPCGetProcessSemaphoreInitKey(key);
for (i = 0; i < MAX_PROC_SEMS / PROC_NSEMS_PER_SET; i++)
@@ -144,7 +143,6 @@ void
InitProcess(IPCKey key)
{
bool found = false;
- int pid;
int semstat;
unsigned long location,
myOffset;
@@ -201,8 +199,6 @@ InitProcess(IPCKey key)
/* this cannot be initialized until after the buffer pool */
SHMQueueInit(&(MyProc->lockQueue));
- MyProc->procId = ProcGlobal->numProcs;
- ProcGlobal->numProcs++;
}
/*
@@ -253,11 +249,8 @@ InitProcess(IPCKey key)
*/
SpinRelease(ProcStructLock);
- MyProc->pid = 0;
+ MyProc->pid = MyProcPid;
MyProc->xid = InvalidTransactionId;
-#if 0
- MyProc->pid = MyPid;
-#endif
/* ----------------
* Start keeping spin lock stats from here on. Any botch before
@@ -273,9 +266,8 @@ InitProcess(IPCKey key)
* exit.
* -------------------------
*/
- pid = getpid();
location = MAKE_OFFSET(MyProc);
- if ((!ShmemPIDLookup(pid, &location)) || (location != MAKE_OFFSET(MyProc)))
+ if ((!ShmemPIDLookup(MyProcPid, &location)) || (location != MAKE_OFFSET(MyProc)))
{
elog(FATAL, "InitProc: ShmemPID table broken");
}
@@ -283,7 +275,7 @@ InitProcess(IPCKey key)
MyProc->errType = NO_ERROR;
SHMQueueElemInit(&(MyProc->links));
- on_exitpg(ProcKill, (caddr_t) pid);
+ on_exitpg(ProcKill, (caddr_t) MyProcPid);
ProcInitialized = TRUE;
}
@@ -352,12 +344,7 @@ ProcKill(int exitStatus, int pid)
if (exitStatus != 0)
return;
- if (!pid)
- {
- pid = getpid();
- }
-
- ShmemPIDLookup(pid, &location);
+ ShmemPIDLookup(MyProcPid, &location);
if (location == INVALID_OFFSET)
return;
@@ -365,7 +352,7 @@ ProcKill(int exitStatus, int pid)
if (proc != MyProc)
{
- Assert(pid != getpid());
+ Assert(pid != MyProcPid);
}
else
MyProc = NULL;
@@ -478,7 +465,7 @@ ProcSleep(PROC_QUEUE *queue,
MyProc->prio = prio;
MyProc->token = token;
MyProc->waitLock = lock;
-
+
/* -------------------
* currently, we only need this for the ProcWakeup routines
* -------------------
@@ -572,19 +559,6 @@ ProcWakeup(PROC *proc, int errType)
return retProc;
}
-
-/*
- * ProcGetId --
- */
-#ifdef NOT_USED
-int
-ProcGetId()
-{
- return (MyProc->procId);
-}
-
-#endif
-
/*
* ProcLockWakeup -- routine for waking up processes when a lock is
* released.
@@ -652,8 +626,7 @@ ProcAddLock(SHM_QUEUE *elem)
static void
HandleDeadLock(int sig)
{
- LOCK *lock;
- int size;
+ LOCK *mywaitlock;
LockLockTable();
@@ -692,8 +665,7 @@ HandleDeadLock(int sig)
return;
}
- lock = MyProc->waitLock;
- size = lock->waitProcs.size;/* so we can look at this in the core */
+ mywaitlock = MyProc->waitLock;
#ifdef DEADLOCK_DEBUG
DumpLocks();
@@ -703,8 +675,8 @@ HandleDeadLock(int sig)
* Get this process off the lock's wait queue
* ------------------------
*/
- Assert(lock->waitProcs.size > 0);
- --lock->waitProcs.size;
+ Assert(mywaitlock->waitProcs.size > 0);
+ --mywaitlock->waitProcs.size;
SHMQueueDelete(&(MyProc->links));
SHMQueueElemInit(&(MyProc->links));
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index d823dbb5a65..7e392bd30f3 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.61 1998/01/13 04:04:36 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.62 1998/01/25 05:14:18 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -886,7 +886,7 @@ PostgresMain(int argc, char *argv[])
* -------------------
*/
- MasterPid = getpid();
+ MyProcPid = getpid();
/* ----------------
* parse command line arguments
@@ -1381,7 +1381,7 @@ PostgresMain(int argc, char *argv[])
if (IsUnderPostmaster == false)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.61 $ $Date: 1998/01/13 04:04:36 $");
+ puts("$Revision: 1.62 $ $Date: 1998/01/25 05:14:18 $");
}
/* ----------------
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 74cd794f01d..28858cf6289 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.36 1998/01/05 18:43:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.37 1998/01/25 05:14:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -589,7 +589,7 @@ ProcessUtility(Node * parsetree,
commandTag = "LISTEN";
CHECK_IF_ABORTED();
- Async_Listen(stmt->relname, MasterPid);
+ Async_Listen(stmt->relname, MyProcPid);
}
break;
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 566125f6e45..8bf6ca03e61 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.24 1998/01/07 21:06:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.25 1998/01/25 05:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,7 +177,7 @@ elog(int lev, const char *fmt,...)
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
if (!InError)
{
- kill(getpid(), 1); /* abort to traffic cop */
+ kill(MyProcPid, 1); /* abort to traffic cop */
pause();
}
@@ -257,7 +257,7 @@ DebugFileOpen(void)
if (fcntl(fd, F_GETFD, 0) < 0)
{
sprintf(OutputFileName, "%s/pg.errors.%d",
- DataDir, (int) getpid());
+ DataDir, (int) MyProcPid);
fd = open(OutputFileName, O_CREAT | O_APPEND | O_WRONLY, 0666);
}
if (fd < 0)
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 6c56d83e09c..1cc310df906 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.17 1997/11/24 05:09:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.18 1998/01/25 05:14:42 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -39,7 +39,8 @@ int Portfd = -1;
int Noversion = 0;
int Quiet = 1;
-int MasterPid;
+int MyProcPid;
+
char *DataDir;
/*
diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c
index 99eb183adbc..b00ecaf42de 100644
--- a/src/backend/utils/sort/psort.c
+++ b/src/backend/utils/sort/psort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.32 1998/01/15 19:46:10 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.33 1998/01/25 05:14:49 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
@@ -988,7 +988,7 @@ gettape()
tp = (struct tapelst *) palloc((unsigned) sizeof(struct tapelst));
- sprintf(uniqueName, "%spg_psort.%d.%d", TEMPDIR, (int) getpid(), uniqueFileId);
+ sprintf(uniqueName, "%spg_psort.%d.%d", TEMPDIR, (int) MyProcPid, uniqueFileId);
uniqueFileId++;
tapeinit = 1;
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index ee10cef0a52..774ff0f34d8 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.18 1997/12/04 23:58:01 thomas Exp $
+ * $Id: miscadmin.h,v 1.19 1998/01/25 05:15:01 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -36,10 +36,11 @@ extern int PostmasterMain(int argc, char *argv[]);
*/
extern int Portfd;
extern int Noversion;
-extern int MasterPid;
extern int Quiet;
extern char *DataDir;
+extern int MyProcPid;
+
extern char OutputFileName[];
/*
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index e58758a8c60..e1e582e47e3 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: proc.h,v 1.9 1998/01/23 06:01:25 momjian Exp $
+ * $Id: proc.h,v 1.10 1998/01/25 05:15:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,10 +35,6 @@ typedef struct proc
SEMA sem; /* ONE semaphore to sleep on */
int errType; /* error code tells why we woke up */
- int procId; /* unique number for this structure NOT
- * unique per backend, these things are
- * reused after the backend dies. */
-
int critSects; /* If critSects > 0, we are in sensitive
* routines that cannot be recovered when
* the process fails. */
@@ -69,7 +65,6 @@ typedef struct proc
typedef struct procglobal
{
SHMEM_OFFSET freeProcs;
- int numProcs;
IPCKey currKey;
int32 freeSemMap[MAX_PROC_SEMS / PROC_NSEMS_PER_SET];
} PROC_HDR;