summaryrefslogtreecommitdiff
path: root/db/lock
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-11-11 15:58:46 +0000
committerjbj <devnull@localhost>2004-11-11 15:58:46 +0000
commitacf19af1ab27ad071c1614f9610ae29eb5c902c1 (patch)
treeeec4be5e0c491d0171d25c17eaa136ce62a90417 /db/lock
parentf9473219d523ace837a3ef5a1212bb6dcad2a690 (diff)
downloadrpm-acf19af1ab27ad071c1614f9610ae29eb5c902c1.tar.gz
rpm-acf19af1ab27ad071c1614f9610ae29eb5c902c1.tar.bz2
rpm-acf19af1ab27ad071c1614f9610ae29eb5c902c1.zip
Upgrade to db-4.3.21.
CVS patchset: 7578 CVS date: 2004/11/11 15:58:46
Diffstat (limited to 'db/lock')
-rw-r--r--db/lock/lock.c31
-rw-r--r--db/lock/lock_deadlock.c11
-rw-r--r--db/lock/lock_id.c9
-rw-r--r--db/lock/lock_region.c38
-rw-r--r--db/lock/lock_stat.c4
5 files changed, 40 insertions, 53 deletions
diff --git a/db/lock/lock.c b/db/lock/lock.c
index 4e4b07890..2b4f63e0d 100644
--- a/db/lock/lock.c
+++ b/db/lock/lock.c
@@ -4,7 +4,7 @@
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
- * $Id: lock.c,v 11.166 2004/10/11 19:38:49 ubell Exp $
+ * $Id: lock.c,v 11.167 2004/10/15 16:59:41 bostic Exp $
*/
#include "db_config.h"
@@ -237,8 +237,7 @@ __lock_vec(dbenv, locker, flags, list, nlist, elistp)
locker_links, __db_lock)) {
if (lp->mode != DB_LOCK_WWRITE)
continue;
- lock.off = R_OFFSET(dbenv,
- &lt->reginfo, lp);
+ lock.off = R_OFFSET(&lt->reginfo, lp);
lock.gen = lp->gen;
F_SET(sh_locker, DB_LOCKER_INABORT);
if ((ret = __lock_get_internal(lt,
@@ -482,8 +481,8 @@ __lock_get_internal(lt, locker, flags, obj, lock_mode, timeout, lock)
if (obj == NULL) {
DB_ASSERT(LOCK_ISSET(*lock));
- lp = (struct __db_lock *)R_ADDR(dbenv, &lt->reginfo, lock->off);
- sh_obj = (DB_LOCKOBJ *) ((u_int8_t *)lp + lp->obj);
+ lp = R_ADDR(&lt->reginfo, lock->off);
+ sh_obj = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj);
} else {
/* Allocate a shared memory new object. */
OBJECT_LOCK(lt, region, obj, lock->ndx);
@@ -563,7 +562,7 @@ __lock_get_internal(lt, locker, flags, obj, lock_mode, timeout, lock)
* the locker.
*/
lp->refcount++;
- lock->off = R_OFFSET(dbenv, &lt->reginfo, lp);
+ lock->off = R_OFFSET(&lt->reginfo, lp);
lock->gen = lp->gen;
lock->mode = lp->mode;
goto done;
@@ -704,13 +703,12 @@ __lock_get_internal(lt, locker, flags, obj, lock_mode, timeout, lock)
upgrade: if (wwrite != NULL) {
lp = wwrite;
lp->refcount++;
- lock->off = R_OFFSET(dbenv, &lt->reginfo, lp);
+ lock->off = R_OFFSET(&lt->reginfo, lp);
lock->gen = lp->gen;
lock->mode = lock_mode;
}
else
- lp = (struct __db_lock *)R_ADDR(dbenv,
- &lt->reginfo, lock->off);
+ lp = R_ADDR(&lt->reginfo, lock->off);
if (IS_WRITELOCK(lock_mode) && !IS_WRITELOCK(lp->mode))
sh_locker->nwrites++;
lp->mode = lock_mode;
@@ -874,7 +872,7 @@ expired: SHOBJECT_LOCK(lt, region, sh_obj, obj_ndx);
}
}
- lock->off = R_OFFSET(dbenv, &lt->reginfo, newl);
+ lock->off = R_OFFSET(&lt->reginfo, newl);
lock->gen = newl->gen;
lock->mode = newl->mode;
sh_locker->nlocks++;
@@ -974,7 +972,7 @@ __lock_put_nolock(dbenv, lock, runp, flags)
lt = dbenv->lk_handle;
region = lt->reginfo.primary;
- lockp = (struct __db_lock *)R_ADDR(dbenv, &lt->reginfo, lock->off);
+ lockp = R_ADDR(&lt->reginfo, lock->off);
if (lock->gen != lockp->gen) {
__db_err(dbenv, __db_lock_invalid, "DB_LOCK->lock_put");
LOCK_INIT(*lock);
@@ -1040,7 +1038,7 @@ __lock_downgrade(dbenv, lock, new_mode, flags)
if (!LF_ISSET(DB_LOCK_NOREGION))
LOCKREGION(dbenv, lt);
- lockp = (struct __db_lock *)R_ADDR(dbenv, &lt->reginfo, lock->off);
+ lockp = R_ADDR(&lt->reginfo, lock->off);
if (lock->gen != lockp->gen) {
__db_err(dbenv, __db_lock_invalid, "lock_downgrade");
ret = EINVAL;
@@ -1298,8 +1296,7 @@ __lock_is_parent(lt, locker, sh_locker)
parent = sh_locker;
while (parent->parent_locker != INVALID_ROFF) {
- parent = (DB_LOCKER *)
- R_ADDR(lt->dbenv, &lt->reginfo, parent->parent_locker);
+ parent = R_ADDR(&lt->reginfo, parent->parent_locker);
if (parent->id == locker)
return (1);
}
@@ -1394,8 +1391,7 @@ __lock_inherit_locks(lt, locker, flags)
ret = EINVAL;
goto err;
}
- sh_parent = (DB_LOCKER *)
- R_ADDR(dbenv, &lt->reginfo, sh_locker->parent_locker);
+ sh_parent = R_ADDR(&lt->reginfo, sh_locker->parent_locker);
F_SET(sh_locker, DB_LOCKER_DELETED);
/*
@@ -1618,8 +1614,7 @@ __lock_trade(dbenv, lock, new_locker)
lt = dbenv->lk_handle;
region = lt->reginfo.primary;
-
- lp = (struct __db_lock *)R_ADDR(dbenv, &lt->reginfo, lock->off);
+ lp = R_ADDR(&lt->reginfo, lock->off);
/* If the lock is already released, simply return. */
if (lp->gen != lock->gen)
diff --git a/db/lock/lock_deadlock.c b/db/lock/lock_deadlock.c
index 61f4f5a35..8caf82100 100644
--- a/db/lock/lock_deadlock.c
+++ b/db/lock/lock_deadlock.c
@@ -4,7 +4,7 @@
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
- * $Id: lock_deadlock.c,v 11.85 2004/09/22 03:48:29 bostic Exp $
+ * $Id: lock_deadlock.c,v 11.86 2004/10/15 16:59:42 bostic Exp $
*/
#include "db_config.h"
@@ -512,7 +512,7 @@ obj_loop:
continue;
if (lockerp->dd_id == DD_INVALID_ID) {
- dd = ((DB_LOCKER *)R_ADDR(dbenv, &lt->reginfo,
+ dd = ((DB_LOCKER *)R_ADDR(&lt->reginfo,
lockerp->master_locker))->dd_id;
lockerp->dd_id = dd;
switch (atype) {
@@ -571,7 +571,7 @@ look_waiters:
continue;
if (lockerp->dd_id == DD_INVALID_ID) {
- dd = ((DB_LOCKER *)R_ADDR(dbenv, &lt->reginfo,
+ dd = ((DB_LOCKER *)R_ADDR(&lt->reginfo,
lockerp->master_locker))->dd_id;
lockerp->dd_id = dd;
switch (atype) {
@@ -654,8 +654,7 @@ look_waiters:
lp = SH_LIST_FIRST(&lockerp->heldby, __db_lock);
if (lp != NULL) {
id_array[id].last_locker_id = lockerp->id;
-get_lock: id_array[id].last_lock = R_OFFSET(dbenv,
- &lt->reginfo, lp);
+get_lock: id_array[id].last_lock = R_OFFSET(&lt->reginfo, lp);
id_array[id].last_obj = lp->obj;
lo = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj);
pptr = SH_DBT_PTR(&lo->lockobj);
@@ -790,7 +789,7 @@ __dd_abort(dbenv, info)
ret = DB_ALREADY_ABORTED;
goto out;
}
- if (R_OFFSET(dbenv, &lt->reginfo, lockp) != info->last_lock ||
+ if (R_OFFSET(&lt->reginfo, lockp) != info->last_lock ||
lockp->holder != lockerp->id ||
lockp->obj != info->last_obj || lockp->status != DB_LSTAT_WAITING) {
ret = DB_ALREADY_ABORTED;
diff --git a/db/lock/lock_id.c b/db/lock/lock_id.c
index 0efd001b0..02f85765d 100644
--- a/db/lock/lock_id.c
+++ b/db/lock/lock_id.c
@@ -4,7 +4,7 @@
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
- * $Id: lock_id.c,v 11.145 2004/09/15 21:49:17 mjc Exp $
+ * $Id: lock_id.c,v 11.146 2004/10/15 16:59:42 bostic Exp $
*/
#include "db_config.h"
@@ -312,15 +312,14 @@ __lock_addfamilylocker(dbenv, pid, id)
goto err;
/* Point to our parent. */
- lockerp->parent_locker = R_OFFSET(dbenv, &lt->reginfo, mlockerp);
+ lockerp->parent_locker = R_OFFSET(&lt->reginfo, mlockerp);
/* See if this locker is the family master. */
if (mlockerp->master_locker == INVALID_ROFF)
- lockerp->master_locker =
- R_OFFSET(dbenv, &lt->reginfo, mlockerp);
+ lockerp->master_locker = R_OFFSET(&lt->reginfo, mlockerp);
else {
lockerp->master_locker = mlockerp->master_locker;
- mlockerp = R_ADDR(dbenv, &lt->reginfo, mlockerp->master_locker);
+ mlockerp = R_ADDR(&lt->reginfo, mlockerp->master_locker);
}
/*
diff --git a/db/lock/lock_region.c b/db/lock/lock_region.c
index ff4bf2270..b03dc74f1 100644
--- a/db/lock/lock_region.c
+++ b/db/lock/lock_region.c
@@ -4,7 +4,7 @@
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
- * $Id: lock_region.c,v 11.81 2004/09/15 21:49:17 mjc Exp $
+ * $Id: lock_region.c,v 11.82 2004/10/15 16:59:42 bostic Exp $
*/
#include "db_config.h"
@@ -98,7 +98,7 @@ __lock_open(dbenv)
/* Set the local addresses. */
region = lt->reginfo.primary =
- R_ADDR(dbenv, &lt->reginfo, lt->reginfo.rp->primary);
+ R_ADDR(&lt->reginfo, lt->reginfo.rp->primary);
if (dbenv->lk_detect != DB_LOCK_NORUN) {
/*
@@ -132,12 +132,9 @@ __lock_open(dbenv)
region->tx_timeout = dbenv->tx_timeout;
/* Set remaining pointers into region. */
- lt->conflicts =
- (u_int8_t *)R_ADDR(dbenv, &lt->reginfo, region->conf_off);
- lt->obj_tab =
- (DB_HASHTAB *)R_ADDR(dbenv, &lt->reginfo, region->obj_off);
- lt->locker_tab =
- (DB_HASHTAB *)R_ADDR(dbenv, &lt->reginfo, region->locker_off);
+ lt->conflicts = R_ADDR(&lt->reginfo, region->conf_off);
+ lt->obj_tab = R_ADDR(&lt->reginfo, region->obj_off);
+ lt->locker_tab = R_ADDR(&lt->reginfo, region->locker_off);
R_UNLOCK(dbenv, &lt->reginfo);
@@ -178,8 +175,7 @@ __lock_region_init(dbenv, lt)
if ((ret = __db_shalloc(&lt->reginfo,
sizeof(DB_LOCKREGION), 0, &lt->reginfo.primary)) != 0)
goto mem_err;
- lt->reginfo.rp->primary =
- R_OFFSET(dbenv, &lt->reginfo, lt->reginfo.primary);
+ lt->reginfo.rp->primary = R_OFFSET(&lt->reginfo, lt->reginfo.primary);
region = lt->reginfo.primary;
memset(region, 0, sizeof(*region));
@@ -217,21 +213,21 @@ __lock_region_init(dbenv, lt)
&lt->reginfo, (size_t)(lk_modes * lk_modes), 0, &addr)) != 0)
goto mem_err;
memcpy(addr, lk_conflicts, (size_t)(lk_modes * lk_modes));
- region->conf_off = R_OFFSET(dbenv, &lt->reginfo, addr);
+ region->conf_off = R_OFFSET(&lt->reginfo, addr);
/* Allocate room for the object hash table and initialize it. */
if ((ret = __db_shalloc(&lt->reginfo,
region->object_t_size * sizeof(DB_HASHTAB), 0, &addr)) != 0)
goto mem_err;
__db_hashinit(addr, region->object_t_size);
- region->obj_off = R_OFFSET(dbenv, &lt->reginfo, addr);
+ region->obj_off = R_OFFSET(&lt->reginfo, addr);
/* Allocate room for the locker hash table and initialize it. */
if ((ret = __db_shalloc(&lt->reginfo,
region->locker_t_size * sizeof(DB_HASHTAB), 0, &addr)) != 0)
goto mem_err;
__db_hashinit(addr, region->locker_t_size);
- region->locker_off = R_OFFSET(dbenv, &lt->reginfo, addr);
+ region->locker_off = R_OFFSET(&lt->reginfo, addr);
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
maint_size = __lock_region_maint(dbenv);
@@ -240,7 +236,7 @@ __lock_region_init(dbenv, lt)
sizeof(REGMAINT) + maint_size, 0, &addr)) != 0)
goto mem_err;
__db_maintinit(&lt->reginfo, addr, maint_size);
- region->maint_off = R_OFFSET(dbenv, &lt->reginfo, addr);
+ region->maint_off = R_OFFSET(&lt->reginfo, addr);
#endif
/*
@@ -320,16 +316,14 @@ __lock_dbenv_refresh(dbenv)
*/
if (F_ISSET(dbenv, DB_ENV_PRIVATE)) {
/* Discard the conflict matrix. */
- __db_shalloc_free(reginfo,
- R_ADDR(dbenv, &lt->reginfo, lr->conf_off));
+ __db_shalloc_free(reginfo, R_ADDR(&lt->reginfo, lr->conf_off));
/* Discard the object hash table. */
- __db_shalloc_free(reginfo,
- R_ADDR(dbenv, &lt->reginfo, lr->obj_off));
+ __db_shalloc_free(reginfo, R_ADDR(&lt->reginfo, lr->obj_off));
/* Discard the locker hash table. */
__db_shalloc_free(
- reginfo, R_ADDR(dbenv, &lt->reginfo, lr->locker_off));
+ reginfo, R_ADDR(&lt->reginfo, lr->locker_off));
/* Discard locks. */
while ((lp =
@@ -448,11 +442,11 @@ __lock_region_destroy(dbenv, infop)
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
DB_LOCKREGION *lt;
- lt = R_ADDR(dbenv, infop, infop->rp->primary);
+ lt = R_ADDR(infop, infop->rp->primary);
- __db_shlocks_destroy(infop, R_ADDR(dbenv, infop, lt->maint_off));
+ __db_shlocks_destroy(infop, R_ADDR(infop, lt->maint_off));
if (infop->primary != NULL && F_ISSET(dbenv, DB_ENV_PRIVATE))
- __db_shalloc_free(infop, R_ADDR(dbenv, infop, lt->maint_off));
+ __db_shalloc_free(infop, R_ADDR(infop, lt->maint_off));
#endif
if (infop->primary != NULL && F_ISSET(dbenv, DB_ENV_PRIVATE))
__db_shalloc_free(infop, infop->primary);
diff --git a/db/lock/lock_stat.c b/db/lock/lock_stat.c
index d49235dac..7cf56bb90 100644
--- a/db/lock/lock_stat.c
+++ b/db/lock/lock_stat.c
@@ -4,7 +4,7 @@
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
- * $Id: lock_stat.c,v 11.63 2004/09/22 03:48:29 bostic Exp $
+ * $Id: lock_stat.c,v 11.64 2004/10/15 16:59:42 bostic Exp $
*/
#include "db_config.h"
@@ -528,7 +528,7 @@ __lock_printlock(lt, mbp, lp, ispgno)
(u_long)pgno);
} else {
__db_msgadd(dbenv, mbp, "0x%lx ",
- (u_long)R_OFFSET(dbenv, &lt->reginfo, lockobj));
+ (u_long)R_OFFSET(&lt->reginfo, lockobj));
__db_pr(dbenv, mbp, ptr, lockobj->lockobj.size);
}
DB_MSGBUF_FLUSH(dbenv, mbp);