getpid/pid cleanup
authorBruce Momjian
Sun, 25 Jan 1998 05:15:15 +0000 (05:15 +0000)
committerBruce Momjian
Sun, 25 Jan 1998 05:15:15 +0000 (05:15 +0000)
16 files changed:
src/backend/bootstrap/bootstrap.c
src/backend/commands/async.c
src/backend/commands/user.c
src/backend/executor/nodeHash.c
src/backend/libpq/pqcomm.c
src/backend/postmaster/postmaster.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/proc.c
src/backend/tcop/postgres.c
src/backend/tcop/utility.c
src/backend/utils/error/elog.c
src/backend/utils/init/globals.c
src/backend/utils/sort/psort.c
src/include/miscadmin.h
src/include/storage/proc.h

index 09179f097718f80bcb072ac9a820bffe06bb572f..8482c370bc496f338cc3a7e8c5190f620cb2ead3 100644 (file)
@@ -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
index 0ce2d6403cff8ce989c69ee6718248edd024e968..3ef9c9130525f4d51967a662e894067eafaa966f 100644 (file)
@@ -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 
 
+#include 
 #include 
 #include 
 #include 
@@ -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();
        }
index 67d06b82c54da15040305f61fc665ae7e4bfc111..b0763bd7a5d9dd722306bf19873be1a7bcbb407d 100644 (file)
@@ -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
index 26930f84842805a398b5c4f3a33d6099d634d3cf..79f308b6c8585f7dd1abd51979607790453dacd6 100644 (file)
@@ -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 
 
 #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;
 }
index e78f2e3052f879819876ac95fa80c4dd316c6c6a..8014ae14f82b42bd9f62ab2f0aba2f29bf9ad15b 100644 (file)
@@ -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 
 
+#include 
 #include 
 #include 
 #include        /* 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);
 }
index 724a807c3932f8f6574f99199061edf0e22a9864..e445aa34f69dd50ffc8cde2113ad15dc8e4fd1e8 100644 (file)
@@ -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");
index 566627d883b284498c7a44bde147b30b4c65e26a..04b5f0a30cc1cf31de4feb0aed42173c5b068980 100644 (file)
@@ -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;
index 30078cbb16119776329a94efcabbd6b00ef44b6b..efc4c991ff4d146b4e473424665fa660591f6a1a 100644 (file)
@@ -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 
 
 #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);
index b07b21d01db85aa6cfd48008d4b77349345815f5..deca35c8d42ef8cec08ef0330268b074791e2828 100644 (file)
@@ -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 
 #include 
@@ -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));
 
index d823dbb5a65af2e167a687a3eedf6b6bfee01d93..7e392bd30f3d7eebeafe690830275908c41037f3 100644 (file)
@@ -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 $");
    }
 
    /* ----------------
index 74cd794f01d2d6f1dcf31032dc8fb5dff4ab64bd..28858cf62898883efe236f6b5fd3284bee6265bd 100644 (file)
@@ -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;
 
index 566125f6e45337ac0904e2bb425ccfc87c26540f..8bf6ca03e61a2a431f1cb9245b112f053d3ca177 100644 (file)
@@ -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)
index 6c56d83e09c1d7522f71df71f42665888069ad75..1cc310df9065e464b994c67225476fdb7ffdfacb 100644 (file)
@@ -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;
 
  /*
index 99eb183adbca988a84f908777e7c683507338b44..b00ecaf42dedffc1dabf0081712e7f89cfad2b73 100644 (file)
@@ -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;
index ee10cef0a52971783343cacc3923d98dad67a31e..774ff0f34d84b69e4f3c9ea8991ed245ce17cb56 100644 (file)
@@ -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[];
 
 /*
index e58758a8c606bc1a8b075140e4c0b870103600de..e1e582e47e3fd78f30b2df932f478825457c427c 100644 (file)
@@ -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;