7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.20 1998/01/23 22:16:46 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.21 1998/01/25 05:14:02 momjian Exp $
11
11
*
12
12
* NOTES
13
13
* Outside modules can create a lock table and acquire/release
37
37
#include <unistd.h>
38
38
39
39
#include "postgres.h"
40
+ #include "miscadmin.h"
40
41
#include "storage/shmem.h"
41
42
#include "storage/spin.h"
42
43
#include "storage/proc.h"
@@ -77,7 +78,7 @@ static char *lock_types[] = {
77
78
if ((lockDebug >= 1) && (tag->relId >= lock_debug_oid_min)) \
78
79
elog(DEBUG, \
79
80
"%s: pid (%d) rel (%d) dbid (%d) tid (%d,%d) type (%s)",where, \
80
- getpid() ,\
81
+ MyProcPid ,\
81
82
tag->relId, tag->dbId, \
82
83
((tag->tupleId.ip_blkid.bi_hi<<16)+\
83
84
tag->tupleId.ip_blkid.bi_lo),\
@@ -92,7 +93,7 @@ static char *lock_types[] = {
92
93
elog(DEBUG, \
93
94
"%s: pid (%d) rel (%d) dbid (%d) tid (%d,%d) nHolding (%d) "\
94
95
"holders (%d,%d,%d,%d,%d) type (%s)",where, \
95
- getpid() ,\
96
+ MyProcPid ,\
96
97
lock->tag.relId, lock->tag.dbId, \
97
98
((lock->tag.tupleId.ip_blkid.bi_hi<<16)+\
98
99
lock->tag.tupleId.ip_blkid.bi_lo),\
@@ -113,7 +114,7 @@ static char *lock_types[] = {
113
114
"%s: pid (%d) xid (%d) pid (%d) lock (%x) nHolding (%d) "\
114
115
"holders (%d,%d,%d,%d,%d)",\
115
116
where,\
116
- getpid() ,\
117
+ MyProcPid ,\
117
118
xidentP->tag.xid,\
118
119
xidentP->tag.pid,\
119
120
xidentP->tag.lock,\
@@ -550,7 +551,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
550
551
#ifdef USER_LOCKS
551
552
if (is_user_lock )
552
553
{
553
- item .tag .pid = getpid () ;
554
+ item .tag .pid = MyProcPid ;
554
555
item .tag .xid = myXid = 0 ;
555
556
#ifdef USER_LOCKS_DEBUG
556
557
elog (NOTICE , "LockAcquire: user lock xid [%d,%d,%d]" ,
@@ -975,7 +976,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
975
976
#ifdef USER_LOCKS
976
977
if (is_user_lock )
977
978
{
978
- item .tag .pid = getpid () ;
979
+ item .tag .pid = MyProcPid ;
979
980
item .tag .xid = 0 ;
980
981
#ifdef USER_LOCKS_DEBUG
981
982
elog (NOTICE , "LockRelease: user lock xid [%d,%d,%d]" ,
@@ -1153,14 +1154,12 @@ LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue)
1153
1154
1154
1155
#ifdef USER_LOCKS
1155
1156
int is_user_lock_table ,
1156
- my_pid ,
1157
1157
count ,
1158
1158
nskip ;
1159
1159
1160
1160
is_user_lock_table = (tableId == 0 );
1161
- my_pid = getpid ();
1162
1161
#ifdef USER_LOCKS_DEBUG
1163
- elog (NOTICE , "LockReleaseAll: tableId=%d, pid=%d" , tableId , my_pid );
1162
+ elog (NOTICE , "LockReleaseAll: tableId=%d, pid=%d" , tableId , MyProcPid );
1164
1163
#endif
1165
1164
if (is_user_lock_table )
1166
1165
{
@@ -1226,7 +1225,7 @@ LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue)
1226
1225
nskip ++ ;
1227
1226
goto next_item ;
1228
1227
}
1229
- if (xidLook -> tag .pid != my_pid )
1228
+ if (xidLook -> tag .pid != MyProcPid )
1230
1229
{
1231
1230
/* This should never happen */
1232
1231
#ifdef USER_LOCKS_DEBUG
@@ -1433,13 +1432,11 @@ DumpLocks()
1433
1432
SPINLOCK masterLock ;
1434
1433
int nLockTypes ;
1435
1434
LOCK * lock ;
1436
- int pid ,
1437
1435
count ;
1438
1436
int tableId = 1 ;
1439
1437
LOCKTAB * ltable ;
1440
1438
1441
- pid = getpid ();
1442
- ShmemPIDLookup (pid , & location );
1439
+ ShmemPIDLookup (MyProcPid , & location );
1443
1440
if (location == INVALID_OFFSET )
1444
1441
return ;
1445
1442
proc = (PROC * ) MAKE_PTR (location );
0 commit comments