1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

From: Massimo Dal Zotto <dz@cs.unitn.it>

Here is a tar file the new directories, which substitute the old ones
in contrib. Please remove the old directories array, datetime, miscutil,
string and userlock before unpacking the tar file in contrib.

Note that as the modules are now installed in lib/modules I install all
my sql code in lib/sql. In my opinion also the other contributors should
follow these rules.
This commit is contained in:
Marc G. Fournier
1998-08-30 19:37:51 +00:00
parent 3067ac8e77
commit eec4c7366f
25 changed files with 449 additions and 438 deletions

View File

@ -4,7 +4,10 @@
* This loadable module, together with my user-lock.patch applied to the
* backend, provides support for user-level long-term cooperative locks.
*
* Copyright (c) 1996, Massimo Dal Zotto <dz@cs.unitn.it>
* Copyright (c) 1998, Massimo Dal Zotto <dz@cs.unitn.it>
*
* This file is distributed under the GNU General Public License
* either version 2, or (at your option) any later version.
*/
#include <stdio.h>
@ -14,46 +17,40 @@
#include "postgres.h"
#include "miscadmin.h"
#include "storage/lock.h"
#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/block.h"
#include "storage/multilev.h"
#include "utils/elog.h"
#include "user_locks.h"
#define USER_LOCKS_TABLE_ID 0
extern Oid MyDatabaseId;
int
user_lock(unsigned int id1, unsigned int id2, LOCKT lockt)
user_lock(unsigned int id1, unsigned int id2, LOCKMODE lockmode)
{
LOCKTAG tag;
memset(&tag, 0, sizeof(LOCKTAG));
tag.dbId = MyDatabaseId;
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_LOCKMETHOD, &tag, lockmode);
}
int
user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt)
user_unlock(unsigned int id1, unsigned int id2, LOCKMODE lockmode)
{
LOCKTAG tag;
memset(&tag, 0, sizeof(LOCKTAG));
tag.dbId = MyDatabaseId;
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);
return LockRelease(USER_LOCKMETHOD, &tag, lockmode);
}
int
@ -87,7 +84,7 @@ user_unlock_all()
PROC *proc;
SHMEM_OFFSET location;
ShmemPIDLookup(getpid(), &location);
ShmemPIDLookup(MyProcPid, &location);
if (location == INVALID_OFFSET)
{
elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
@ -95,7 +92,15 @@ user_unlock_all()
}
proc = (PROC *) MAKE_PTR(location);
return LockReleaseAll(USER_LOCKS_TABLE_ID, &proc->lockQueue);
return LockReleaseAll(USER_LOCKMETHOD, &proc->lockQueue);
}
/* end of file */
/*
* Local variables:
* tab-width: 4
* c-indent-level: 4
* c-basic-offset: 4
* End:
*/