summaryrefslogtreecommitdiff
path: root/contrib/userlock
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-02-26 04:46:47 +0000
committerBruce Momjian <bruce@momjian.us>1998-02-26 04:46:47 +0000
commita32450a5855eed4bfd756ef292ee45d3c754665b (patch)
tree26735c3406d9f46d0f39accbe6ff1fb5cc5beedc /contrib/userlock
parent757bf69a2e259c76baed94fa06e792664ab5ed67 (diff)
downloadpostgresql-a32450a5855eed4bfd756ef292ee45d3c754665b.tar.gz
pgindent run before 6.3 release, with Thomas' requested changes.
Diffstat (limited to 'contrib/userlock')
-rw-r--r--contrib/userlock/user_locks.c71
-rw-r--r--contrib/userlock/user_locks.h14
2 files changed, 43 insertions, 42 deletions
diff --git a/contrib/userlock/user_locks.c b/contrib/userlock/user_locks.c
index efc9b0a464..fe8abcac0c 100644
--- a/contrib/userlock/user_locks.c
+++ b/contrib/userlock/user_locks.c
@@ -22,79 +22,80 @@
#include "user_locks.h"
-#define USER_LOCKS_TABLE_ID 0
+#define USER_LOCKS_TABLE_ID 0
-extern Oid MyDatabaseId;
+extern Oid MyDatabaseId;
int
user_lock(unsigned int id1, unsigned int id2, LOCKT lockt)
{
- LOCKTAG tag;
+ LOCKTAG tag;
- memset(&tag,0,sizeof(LOCKTAG));
- tag.relId = 0;
- tag.dbId = MyDatabaseId;
- tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
- tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
- tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
+ memset(&tag, 0, sizeof(LOCKTAG));
+ tag.relId = 0;
+ tag.dbId = MyDatabaseId;
+ tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
+ tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
+ tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
- return LockAcquire(USER_LOCKS_TABLE_ID, &tag, lockt);
+ return LockAcquire(USER_LOCKS_TABLE_ID, &tag, lockt);
}
int
user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt)
{
- LOCKTAG tag;
-
- memset(&tag, 0,sizeof(LOCKTAG));
- tag.relId = 0;
- tag.dbId = MyDatabaseId;
- tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
- tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
- tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
-
- return LockRelease(USER_LOCKS_TABLE_ID, &tag, lockt);
+ LOCKTAG tag;
+
+ memset(&tag, 0, sizeof(LOCKTAG));
+ tag.relId = 0;
+ tag.dbId = MyDatabaseId;
+ tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
+ tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
+ tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
+
+ return LockRelease(USER_LOCKS_TABLE_ID, &tag, lockt);
}
int
user_write_lock(unsigned int id1, unsigned int id2)
{
- return user_lock(id1, id2, WRITE_LOCK);
+ return user_lock(id1, id2, WRITE_LOCK);
}
int
user_write_unlock(unsigned int id1, unsigned int id2)
{
- return user_unlock(id1, id2, WRITE_LOCK);
+ return user_unlock(id1, id2, WRITE_LOCK);
}
int
user_write_lock_oid(Oid oid)
{
- return user_lock(0, oid, WRITE_LOCK);
+ return user_lock(0, oid, WRITE_LOCK);
}
int
user_write_unlock_oid(Oid oid)
{
- return user_unlock(0, oid, WRITE_LOCK);
+ return user_unlock(0, oid, WRITE_LOCK);
}
int
user_unlock_all()
{
- PROC *proc;
- SHMEM_OFFSET location;
-
- ShmemPIDLookup(getpid(),&location);
- if (location == INVALID_OFFSET) {
- elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
- return -1;
- }
-
- proc = (PROC *) MAKE_PTR(location);
- return LockReleaseAll(USER_LOCKS_TABLE_ID, &proc->lockQueue);
+ PROC *proc;
+ SHMEM_OFFSET location;
+
+ ShmemPIDLookup(getpid(), &location);
+ if (location == INVALID_OFFSET)
+ {
+ elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
+ return -1;
+ }
+
+ proc = (PROC *) MAKE_PTR(location);
+ return LockReleaseAll(USER_LOCKS_TABLE_ID, &proc->lockQueue);
}
/* end of file */
diff --git a/contrib/userlock/user_locks.h b/contrib/userlock/user_locks.h
index ab890483fa..7f31556403 100644
--- a/contrib/userlock/user_locks.h
+++ b/contrib/userlock/user_locks.h
@@ -1,12 +1,12 @@
#ifndef USER_LOCKS_H
#define USER_LOCKS_H
-int user_lock(unsigned int id1, unsigned int id2, LOCKT lockt);
-int user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt);
-int user_write_lock(unsigned int id1, unsigned int id2);
-int user_write_unlock(unsigned int id1, unsigned int id2);
-int user_write_lock_oid(Oid oid);
-int user_write_unlock_oid(Oid oid);
-int user_unlock_all(void);
+int user_lock(unsigned int id1, unsigned int id2, LOCKT lockt);
+int user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt);
+int user_write_lock(unsigned int id1, unsigned int id2);
+int user_write_unlock(unsigned int id1, unsigned int id2);
+int user_write_lock_oid(Oid oid);
+int user_write_unlock_oid(Oid oid);
+int user_unlock_all(void);
#endif