aboutsummaryrefslogtreecommitdiff
path: root/db2/log/log_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'db2/log/log_get.c')
-rw-r--r--db2/log/log_get.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/db2/log/log_get.c b/db2/log/log_get.c
index ab6f6247cb..9a055de0a6 100644
--- a/db2/log/log_get.c
+++ b/db2/log/log_get.c
@@ -1,21 +1,19 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997
+ * Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*/
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)log_get.c 10.24 (Sleepycat) 1/17/98";
+static const char sccsid[] = "@(#)log_get.c 10.32 (Sleepycat) 5/6/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#endif
@@ -36,9 +34,8 @@ log_get(dblp, alsn, dbt, flags)
DB_LOG *dblp;
DB_LSN *alsn;
DBT *dbt;
- int flags;
+ u_int32_t flags;
{
- LOG *lp;
int ret;
/* Validate arguments. */
@@ -66,8 +63,6 @@ log_get(dblp, alsn, dbt, flags)
return (__db_ferr(dblp->dbenv, "threaded data", 1));
}
- lp = dblp->lp;
-
LOCK_LOGREGION(dblp);
/*
@@ -97,14 +92,15 @@ log_get(dblp, alsn, dbt, flags)
* __log_get --
* Get a log record; internal version.
*
- * PUBLIC: int __log_get __P((DB_LOG *, DB_LSN *, DBT *, int, int));
+ * PUBLIC: int __log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t, int));
*/
int
__log_get(dblp, alsn, dbt, flags, silent)
DB_LOG *dblp;
DB_LSN *alsn;
DBT *dbt;
- int flags, silent;
+ u_int32_t flags;
+ int silent;
{
DB_LSN nlsn;
HDR hdr;
@@ -122,7 +118,7 @@ __log_get(dblp, alsn, dbt, flags, silent)
nlsn = dblp->c_lsn;
switch (flags) {
case DB_CHECKPOINT:
- nlsn = lp->c_lsn;
+ nlsn = lp->chkpt_lsn;
if (IS_ZERO_LSN(nlsn)) {
__db_err(dblp->dbenv,
"log_get: unable to find checkpoint record: no checkpoint set.");
@@ -219,7 +215,8 @@ retry:
}
/* Seek to the header offset and read the header. */
- if ((ret = __db_seek(dblp->c_fd, 0, 0, nlsn.offset, SEEK_SET)) != 0) {
+ if ((ret =
+ __db_seek(dblp->c_fd, 0, 0, nlsn.offset, 0, SEEK_SET)) != 0) {
fail = "seek";
goto err1;
}
@@ -272,7 +269,13 @@ retry:
goto cksum;
}
- /* Allocate temporary memory to hold the record. */
+ /*
+ * Allocate temporary memory to hold the record.
+ *
+ * XXX
+ * We're calling malloc(3) with a region locked. This isn't
+ * a good idea.
+ */
if ((tbuf = (char *)__db_malloc(len)) == NULL) {
ret = ENOMEM;
goto err1;