1997-08-27 20:26:10 +00:00
|
|
|
/*-
|
|
|
|
* See the file LICENSE for redistribution information.
|
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Copyright (c) 1997, 1998
|
1997-08-27 20:26:10 +00:00
|
|
|
* Sleepycat Software. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifndef lint
|
1999-06-13 13:36:34 +00:00
|
|
|
static const char sccsid[] = "@(#)bt_recno.c 10.53 (Sleepycat) 12/11/98";
|
1997-08-27 20:26:10 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#ifndef NO_SYSTEM_INCLUDES
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "db_int.h"
|
|
|
|
#include "db_page.h"
|
|
|
|
#include "btree.h"
|
1999-06-13 13:36:34 +00:00
|
|
|
#include "db_ext.h"
|
|
|
|
#include "shqueue.h"
|
|
|
|
#include "db_shash.h"
|
|
|
|
#include "lock.h"
|
|
|
|
#include "lock_ext.h"
|
|
|
|
|
|
|
|
static int __ram_add __P((DBC *, db_recno_t *, DBT *, u_int32_t, u_int32_t));
|
|
|
|
static int __ram_delete __P((DB *, DB_TXN *, DBT *, u_int32_t));
|
|
|
|
static int __ram_fmap __P((DBC *, db_recno_t));
|
|
|
|
static int __ram_i_delete __P((DBC *));
|
1998-06-09 15:16:55 +00:00
|
|
|
static int __ram_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
static int __ram_source __P((DB *, RECNO *, const char *));
|
1998-06-09 15:16:55 +00:00
|
|
|
static int __ram_sync __P((DB *, u_int32_t));
|
1999-06-13 13:36:34 +00:00
|
|
|
static int __ram_update __P((DBC *, db_recno_t, int));
|
|
|
|
static int __ram_vmap __P((DBC *, db_recno_t));
|
|
|
|
static int __ram_writeback __P((DBC *));
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* In recno, there are two meanings to the on-page "deleted" flag. If we're
|
|
|
|
* re-numbering records, it means the record was implicitly created. We skip
|
|
|
|
* over implicitly created records if doing a cursor "next" or "prev", and
|
|
|
|
* return DB_KEYEMPTY if they're explicitly requested.. If not re-numbering
|
|
|
|
* records, it means that the record was implicitly created, or was deleted.
|
|
|
|
* We skip over implicitly created or deleted records if doing a cursor "next"
|
|
|
|
* or "prev", and return DB_KEYEMPTY if they're explicitly requested.
|
|
|
|
*
|
|
|
|
* If we're re-numbering records, then we have to detect in the cursor that
|
|
|
|
* a record was deleted, and adjust the cursor as necessary on the next get.
|
|
|
|
* If we're not re-numbering records, then we can detect that a record has
|
|
|
|
* been deleted by looking at the actual on-page record, so we completely
|
|
|
|
* ignore the cursor's delete flag. This is different from the B+tree code.
|
|
|
|
* It also maintains whether the cursor references a deleted record in the
|
|
|
|
* cursor, and it doesn't always check the on-page value.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
#define CD_SET(dbp, cp) { \
|
|
|
|
if (F_ISSET(dbp, DB_RE_RENUMBER)) \
|
1999-06-13 13:36:34 +00:00
|
|
|
F_SET(cp, C_DELETED); \
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
#define CD_CLR(dbp, cp) { \
|
|
|
|
if (F_ISSET(dbp, DB_RE_RENUMBER)) \
|
1999-06-13 13:36:34 +00:00
|
|
|
F_CLR(cp, C_DELETED); \
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
#define CD_ISSET(dbp, cp) \
|
1999-06-13 13:36:34 +00:00
|
|
|
(F_ISSET(dbp, DB_RE_RENUMBER) && F_ISSET(cp, C_DELETED))
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_open --
|
|
|
|
* Recno open function.
|
|
|
|
*
|
1999-06-13 13:36:34 +00:00
|
|
|
* PUBLIC: int __ram_open __P((DB *, DB_INFO *));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_open(dbp, dbinfo)
|
1997-08-27 20:26:10 +00:00
|
|
|
DB *dbp;
|
|
|
|
DB_INFO *dbinfo;
|
|
|
|
{
|
|
|
|
BTREE *t;
|
1999-06-13 13:36:34 +00:00
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
RECNO *rp;
|
1999-06-13 13:36:34 +00:00
|
|
|
int ret, t_ret;
|
1998-01-25 17:01:47 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Allocate and initialize the private btree structure. */
|
|
|
|
if ((ret = __os_calloc(1, sizeof(BTREE), &t)) != 0)
|
|
|
|
return (ret);
|
|
|
|
dbp->internal = t;
|
|
|
|
__bam_setovflsize(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Allocate and initialize the private recno structure. */
|
|
|
|
if ((ret = __os_calloc(1, sizeof(*rp), &rp)) != 0)
|
|
|
|
return (ret);
|
|
|
|
/* Link in the private recno structure. */
|
|
|
|
t->recno = rp;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* Intention is to make sure all of the user's selections are okay
|
|
|
|
* here and then use them without checking.
|
|
|
|
*/
|
|
|
|
if (dbinfo == NULL) {
|
|
|
|
rp->re_delim = '\n';
|
|
|
|
rp->re_pad = ' ';
|
|
|
|
rp->re_fd = -1;
|
|
|
|
F_SET(rp, RECNO_EOF);
|
|
|
|
} else {
|
1997-08-27 20:26:10 +00:00
|
|
|
/*
|
|
|
|
* If the user specified a source tree, open it and map it in.
|
|
|
|
*
|
|
|
|
* !!!
|
|
|
|
* We don't complain if the user specified transactions or
|
|
|
|
* threads. It's possible to make it work, but you'd better
|
|
|
|
* know what you're doing!
|
|
|
|
*/
|
|
|
|
if (dbinfo->re_source == NULL) {
|
|
|
|
rp->re_fd = -1;
|
|
|
|
F_SET(rp, RECNO_EOF);
|
|
|
|
} else {
|
|
|
|
if ((ret =
|
|
|
|
__ram_source(dbp, rp, dbinfo->re_source)) != 0)
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy delimiter, length and padding values. */
|
|
|
|
rp->re_delim =
|
|
|
|
F_ISSET(dbp, DB_RE_DELIMITER) ? dbinfo->re_delim : '\n';
|
|
|
|
rp->re_pad = F_ISSET(dbp, DB_RE_PAD) ? dbinfo->re_pad : ' ';
|
|
|
|
|
|
|
|
if (F_ISSET(dbp, DB_RE_FIXEDLEN)) {
|
|
|
|
if ((rp->re_len = dbinfo->re_len) == 0) {
|
|
|
|
__db_err(dbp->dbenv,
|
|
|
|
"record length must be greater than 0");
|
|
|
|
ret = EINVAL;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
rp->re_len = 0;
|
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Initialize the remaining fields/methods of the DB. */
|
|
|
|
dbp->am_close = __ram_close;
|
1997-08-27 20:26:10 +00:00
|
|
|
dbp->del = __ram_delete;
|
|
|
|
dbp->put = __ram_put;
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp->stat = __bam_stat;
|
1997-08-27 20:26:10 +00:00
|
|
|
dbp->sync = __ram_sync;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Start up the tree. */
|
|
|
|
if ((ret = __bam_read_root(dbp)) != 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* Set the overflow page size. */
|
|
|
|
__bam_setovflsize(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* If we're snapshotting an underlying source file, do it now. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if (dbinfo != NULL && F_ISSET(dbinfo, DB_SNAPSHOT)) {
|
|
|
|
/* Allocate a cursor. */
|
|
|
|
if ((ret = dbp->cursor(dbp, NULL, &dbc, 0)) != 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* Do the snapshot. */
|
|
|
|
if ((ret = __ram_update(dbc,
|
|
|
|
DB_MAX_RECORDS, 0)) != 0 && ret == DB_NOTFOUND)
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
/* Discard the cursor. */
|
|
|
|
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
|
|
|
|
ret = t_ret;
|
|
|
|
|
|
|
|
if (ret != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
1999-06-13 13:36:34 +00:00
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
err: /* If we mmap'd a source file, discard it. */
|
|
|
|
if (rp->re_smap != NULL)
|
1998-06-09 15:16:55 +00:00
|
|
|
(void)__db_unmapfile(rp->re_smap, rp->re_msize);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* If we opened a source file, discard it. */
|
|
|
|
if (rp->re_fd != -1)
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(rp->re_fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
if (rp->re_source != NULL)
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(rp->re_source);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_free(rp, sizeof(*rp));
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* __ram_delete --
|
|
|
|
* Recno db->del function.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
static int
|
|
|
|
__ram_delete(dbp, txn, key, flags)
|
1997-08-27 20:26:10 +00:00
|
|
|
DB *dbp;
|
|
|
|
DB_TXN *txn;
|
1999-06-13 13:36:34 +00:00
|
|
|
DBT *key;
|
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp;
|
1997-08-27 20:26:10 +00:00
|
|
|
DBC *dbc;
|
1999-06-13 13:36:34 +00:00
|
|
|
db_recno_t recno;
|
|
|
|
int ret, t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_PANIC_CHECK(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Check for invalid flags. */
|
|
|
|
if ((ret = __db_delchk(dbp,
|
|
|
|
key, flags, F_ISSET(dbp, DB_AM_RDONLY))) != 0)
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Acquire a cursor. */
|
|
|
|
if ((ret = dbp->cursor(dbp, txn, &dbc, DB_WRITELOCK)) != 0)
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DEBUG_LWRITE(dbc, txn, "ram_delete", key, NULL, flags);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Check the user's record number and fill in as necessary. */
|
|
|
|
if ((ret = __ram_getno(dbc, key, &recno, 0)) != 0)
|
|
|
|
goto err;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Do the delete. */
|
|
|
|
cp = dbc->internal;
|
|
|
|
cp->recno = recno;
|
|
|
|
ret = __ram_i_delete(dbc);
|
1998-06-09 15:16:55 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Release the cursor. */
|
|
|
|
err: if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
|
|
|
|
ret = t_ret;
|
1998-06-09 15:16:55 +00:00
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* __ram_i_delete --
|
|
|
|
* Internal version of recno delete, called by __ram_delete and
|
|
|
|
* __ram_c_del.
|
1998-06-09 15:16:55 +00:00
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_i_delete(dbc)
|
|
|
|
DBC *dbc;
|
1998-06-09 15:16:55 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
BKEYDATA bk;
|
1998-06-09 15:16:55 +00:00
|
|
|
BTREE *t;
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp;
|
|
|
|
DB *dbp;
|
|
|
|
DBT hdr, data;
|
1998-06-09 15:16:55 +00:00
|
|
|
PAGE *h;
|
|
|
|
db_indx_t indx;
|
|
|
|
int exact, ret, stack;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
|
|
|
cp = dbc->internal;
|
1997-08-27 20:26:10 +00:00
|
|
|
t = dbp->internal;
|
1999-06-13 13:36:34 +00:00
|
|
|
stack = 0;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* If this is CDB and this isn't a write cursor, then it's an error.
|
|
|
|
* If it is a write cursor, but we don't yet hold the write lock, then
|
|
|
|
* we need to upgrade to the write lock.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(dbp, DB_AM_CDB)) {
|
|
|
|
/* Make sure it's a valid update cursor. */
|
|
|
|
if (!F_ISSET(dbc, DBC_RMW | DBC_WRITER))
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
if (F_ISSET(dbc, DBC_RMW) &&
|
|
|
|
(ret = lock_get(dbp->dbenv->lk_info, dbc->locker,
|
|
|
|
DB_LOCK_UPGRADE, &dbc->lock_dbt, DB_LOCK_WRITE,
|
|
|
|
&dbc->mylock)) != 0)
|
|
|
|
return (EAGAIN);
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Search the tree for the key; delete only deletes exact matches. */
|
|
|
|
if ((ret = __bam_rsearch(dbc, &cp->recno, S_DELETE, 1, &exact)) != 0)
|
|
|
|
goto err;
|
|
|
|
if (!exact) {
|
|
|
|
ret = DB_NOTFOUND;
|
|
|
|
goto err;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
stack = 1;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
h = cp->csp->page;
|
|
|
|
indx = cp->csp->indx;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* If re-numbering records, the on-page deleted flag can only mean
|
|
|
|
* that this record was implicitly created. Applications aren't
|
|
|
|
* permitted to delete records they never created, return an error.
|
|
|
|
*
|
|
|
|
* If not re-numbering records, the on-page deleted flag means that
|
|
|
|
* this record was implicitly created, or, was deleted at some time.
|
|
|
|
* The former is an error because applications aren't permitted to
|
|
|
|
* delete records they never created, the latter is an error because
|
|
|
|
* if the record was "deleted", we could never have found it.
|
|
|
|
*/
|
1997-09-05 01:43:20 +00:00
|
|
|
if (B_DISSET(GET_BKEYDATA(h, indx)->type)) {
|
1997-08-27 20:26:10 +00:00
|
|
|
ret = DB_KEYEMPTY;
|
1999-06-13 13:36:34 +00:00
|
|
|
goto err;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if (F_ISSET(dbp, DB_RE_RENUMBER)) {
|
|
|
|
/* Delete the item, adjust the counts, adjust the cursors. */
|
|
|
|
if ((ret = __bam_ditem(dbc, h, indx)) != 0)
|
|
|
|
goto err;
|
|
|
|
__bam_adjust(dbc, -1);
|
|
|
|
__ram_ca(dbp, cp->recno, CA_DELETE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the page is empty, delete it. The whole tree is locked
|
|
|
|
* so there are no preparations to make.
|
|
|
|
*/
|
|
|
|
if (NUM_ENT(h) == 0 && h->pgno != PGNO_ROOT) {
|
|
|
|
stack = 0;
|
|
|
|
ret = __bam_dpages(dbc);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Use a delete/put pair to replace the record with a marker. */
|
|
|
|
if ((ret = __bam_ditem(dbc, h, indx)) != 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
B_TSET(bk.type, B_KEYDATA, 1);
|
|
|
|
bk.len = 0;
|
|
|
|
memset(&hdr, 0, sizeof(hdr));
|
|
|
|
hdr.data = &bk;
|
|
|
|
hdr.size = SSZA(BKEYDATA, data);
|
|
|
|
memset(&data, 0, sizeof(data));
|
|
|
|
data.data = (char *)"";
|
|
|
|
data.size = 0;
|
|
|
|
if ((ret = __db_pitem(dbc,
|
|
|
|
h, indx, BKEYDATA_SIZE(0), &hdr, &data)) != 0)
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
F_SET(t->recno, RECNO_MODIFIED);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
err: if (stack)
|
|
|
|
__bam_stkrel(dbc, 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* If we upgraded the CDB lock upon entry; downgrade it now. */
|
|
|
|
if (F_ISSET(dbp, DB_AM_CDB) && F_ISSET(dbc, DBC_RMW))
|
|
|
|
(void)__lock_downgrade(dbp->dbenv->lk_info, dbc->mylock,
|
|
|
|
DB_LOCK_IWRITE, 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_put --
|
|
|
|
* Recno db->put function.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_put(dbp, txn, key, data, flags)
|
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
DB_TXN *txn;
|
|
|
|
DBT *key, *data;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t recno;
|
1999-06-13 13:36:34 +00:00
|
|
|
int ret, t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_PANIC_CHECK(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Check for invalid flags. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __db_putchk(dbp,
|
|
|
|
key, data, flags, F_ISSET(dbp, DB_AM_RDONLY), 0)) != 0)
|
|
|
|
return (ret);
|
|
|
|
|
|
|
|
/* Allocate a cursor. */
|
|
|
|
if ((ret = dbp->cursor(dbp, txn, &dbc, DB_WRITELOCK)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DEBUG_LWRITE(dbc, txn, "ram_put", key, data, flags);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're appending to the tree, make sure we've read in all of
|
|
|
|
* the backing source file. Otherwise, check the user's record
|
|
|
|
* number and fill in as necessary.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
ret = flags == DB_APPEND ?
|
|
|
|
__ram_update(dbc, DB_MAX_RECORDS, 0) :
|
|
|
|
__ram_getno(dbc, key, &recno, 1);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Add the record. */
|
|
|
|
if (ret == 0)
|
1999-06-13 13:36:34 +00:00
|
|
|
ret = __ram_add(dbc, &recno, data, flags, 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Discard the cursor. */
|
|
|
|
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
|
|
|
|
ret = t_ret;
|
|
|
|
|
|
|
|
/* Return the record number if we're appending to the tree. */
|
|
|
|
if (ret == 0 && flags == DB_APPEND)
|
|
|
|
*(db_recno_t *)key->data = recno;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_sync --
|
|
|
|
* Recno db->sync function.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_sync(dbp, flags)
|
|
|
|
DB *dbp;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
DBC *dbc;
|
|
|
|
int ret, t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* Sync the underlying btree.
|
|
|
|
*
|
|
|
|
* !!!
|
|
|
|
* We don't need to do a panic check or flags check, the "real"
|
|
|
|
* sync function does all that for us.
|
|
|
|
*/
|
|
|
|
if ((ret = __db_sync(dbp, flags)) != 0)
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Allocate a cursor. */
|
|
|
|
if ((ret = dbp->cursor(dbp, NULL, &dbc, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DEBUG_LWRITE(dbc, NULL, "ram_sync", NULL, NULL, flags);
|
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
/* Copy back the backing source file. */
|
1999-06-13 13:36:34 +00:00
|
|
|
ret = __ram_writeback(dbc);
|
|
|
|
|
|
|
|
/* Discard the cursor. */
|
|
|
|
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
|
|
|
|
ret = t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_close --
|
|
|
|
* Recno db->close function.
|
|
|
|
*
|
|
|
|
* PUBLIC: int __ram_close __P((DB *));
|
|
|
|
*/
|
|
|
|
int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_close(dbp)
|
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
|
|
|
RECNO *rp;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
rp = ((BTREE *)dbp->internal)->recno;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Close any underlying mmap region. */
|
|
|
|
if (rp->re_smap != NULL)
|
1998-06-09 15:16:55 +00:00
|
|
|
(void)__db_unmapfile(rp->re_smap, rp->re_msize);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Close any backing source file descriptor. */
|
|
|
|
if (rp->re_fd != -1)
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(rp->re_fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Free any backing source file name. */
|
|
|
|
if (rp->re_source != NULL)
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(rp->re_source);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Free allocated memory. */
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_free(rp, sizeof(RECNO));
|
|
|
|
((BTREE *)dbp->internal)->recno = NULL;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Close the underlying btree. */
|
1999-06-13 13:36:34 +00:00
|
|
|
return (__bam_close(dbp));
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_c_del --
|
|
|
|
* Recno cursor->c_del function.
|
1999-06-13 13:36:34 +00:00
|
|
|
*
|
|
|
|
* PUBLIC: int __ram_c_del __P((DBC *, u_int32_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
int
|
1997-08-27 20:26:10 +00:00
|
|
|
__ram_c_del(dbc, flags)
|
|
|
|
DBC *dbc;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp;
|
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
int ret;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
cp = dbc->internal;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_PANIC_CHECK(dbp);
|
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
/* Check for invalid flags. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __db_cdelchk(dbp, flags,
|
|
|
|
F_ISSET(dbp, DB_AM_RDONLY), cp->recno != RECNO_OOB)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DEBUG_LWRITE(dbc, dbc->txn, "ram_c_del", NULL, NULL, flags);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* If we are running CDB, this had better be either a write
|
|
|
|
* cursor or an immediate writer.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(dbp, DB_AM_CDB))
|
|
|
|
if (!F_ISSET(dbc, DBC_RMW | DBC_WRITER))
|
|
|
|
return (EINVAL);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* The semantics of cursors during delete are as follows: if record
|
|
|
|
* numbers are mutable (DB_RE_RENUMBER is set), deleting a record
|
|
|
|
* causes the cursor to automatically point to the record immediately
|
|
|
|
* following. In this case it is possible to use a single cursor for
|
|
|
|
* repeated delete operations, without intervening operations.
|
|
|
|
*
|
|
|
|
* If record numbers are not mutable, then records are replaced with
|
|
|
|
* a marker containing a delete flag. If the record referenced by
|
|
|
|
* this cursor has already been deleted, we will detect that as part
|
|
|
|
* of the delete operation, and fail.
|
|
|
|
*/
|
|
|
|
return (__ram_i_delete(dbc));
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_c_get --
|
|
|
|
* Recno cursor->c_get function.
|
1999-06-13 13:36:34 +00:00
|
|
|
*
|
|
|
|
* PUBLIC: int __ram_c_get __P((DBC *, DBT *, DBT *, u_int32_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
int
|
1997-08-27 20:26:10 +00:00
|
|
|
__ram_c_get(dbc, key, data, flags)
|
|
|
|
DBC *dbc;
|
|
|
|
DBT *key, *data;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp, copy;
|
1997-08-27 20:26:10 +00:00
|
|
|
DB *dbp;
|
1999-06-13 13:36:34 +00:00
|
|
|
PAGE *h;
|
|
|
|
db_indx_t indx;
|
|
|
|
int exact, ret, stack, tmp_rmw;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
dbp = dbc->dbp;
|
1999-06-13 13:36:34 +00:00
|
|
|
cp = dbc->internal;
|
|
|
|
|
|
|
|
DB_PANIC_CHECK(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Check for invalid flags. */
|
|
|
|
if ((ret = __db_cgetchk(dbc->dbp,
|
|
|
|
key, data, flags, cp->recno != RECNO_OOB)) != 0)
|
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Clear OR'd in additional bits so we can check for flag equality. */
|
|
|
|
tmp_rmw = 0;
|
|
|
|
if (LF_ISSET(DB_RMW)) {
|
|
|
|
if (!F_ISSET(dbp, DB_AM_CDB)) {
|
|
|
|
tmp_rmw = 1;
|
|
|
|
F_SET(dbc, DBC_RMW);
|
|
|
|
}
|
|
|
|
LF_CLR(DB_RMW);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_LREAD(dbc, dbc->txn, "ram_c_get",
|
|
|
|
flags == DB_SET || flags == DB_SET_RANGE ? key : NULL, NULL, flags);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Initialize the cursor for a new retrieval. */
|
|
|
|
copy = *cp;
|
|
|
|
|
|
|
|
retry: /* Update the record number. */
|
1999-06-13 13:36:34 +00:00
|
|
|
stack = 0;
|
1997-08-27 20:26:10 +00:00
|
|
|
switch (flags) {
|
|
|
|
case DB_CURRENT:
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* If record numbers are mutable: if we just deleted a record,
|
|
|
|
* there is no action necessary, we return the record following
|
|
|
|
* the deleted item by virtue of renumbering the tree.
|
|
|
|
*/
|
1997-08-27 20:26:10 +00:00
|
|
|
break;
|
|
|
|
case DB_NEXT:
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* If record numbers are mutable: if we just deleted a record,
|
|
|
|
* we have to avoid incrementing the record number so that we
|
|
|
|
* return the right record by virtue of renumbering the tree.
|
|
|
|
*/
|
1997-08-27 20:26:10 +00:00
|
|
|
if (CD_ISSET(dbp, cp))
|
|
|
|
break;
|
1999-06-13 13:36:34 +00:00
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
if (cp->recno != RECNO_OOB) {
|
|
|
|
++cp->recno;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case DB_FIRST:
|
|
|
|
flags = DB_NEXT;
|
|
|
|
cp->recno = 1;
|
|
|
|
break;
|
|
|
|
case DB_PREV:
|
|
|
|
if (cp->recno != RECNO_OOB) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if (cp->recno == 1) {
|
|
|
|
ret = DB_NOTFOUND;
|
|
|
|
goto err;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
--cp->recno;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case DB_LAST:
|
|
|
|
flags = DB_PREV;
|
1999-06-13 13:36:34 +00:00
|
|
|
if (((ret = __ram_update(dbc,
|
|
|
|
DB_MAX_RECORDS, 0)) != 0) && ret != DB_NOTFOUND)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_nrecs(dbc, &cp->recno)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
1999-06-13 13:36:34 +00:00
|
|
|
if (cp->recno == 0) {
|
|
|
|
ret = DB_NOTFOUND;
|
|
|
|
goto err;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
break;
|
|
|
|
case DB_SET:
|
|
|
|
case DB_SET_RANGE:
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __ram_getno(dbc, key, &cp->recno, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Return the key if the user didn't give us one. */
|
1997-08-27 20:26:10 +00:00
|
|
|
if (flags != DB_SET && flags != DB_SET_RANGE &&
|
|
|
|
(ret = __db_retcopy(key, &cp->recno, sizeof(cp->recno),
|
1999-06-13 13:36:34 +00:00
|
|
|
&dbc->rkey.data, &dbc->rkey.ulen, dbp->db_malloc)) != 0)
|
|
|
|
goto err;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Search the tree for the record. */
|
|
|
|
if ((ret = __bam_rsearch(dbc, &cp->recno,
|
|
|
|
F_ISSET(dbc, DBC_RMW) ? S_FIND_WR : S_FIND, 1, &exact)) != 0)
|
|
|
|
goto err;
|
|
|
|
stack = 1;
|
|
|
|
if (!exact) {
|
|
|
|
ret = DB_NOTFOUND;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
h = cp->csp->page;
|
|
|
|
indx = cp->csp->indx;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* If re-numbering records, the on-page deleted flag means this record
|
|
|
|
* was implicitly created. If not re-numbering records, the on-page
|
|
|
|
* deleted flag means this record was implicitly created, or, it was
|
|
|
|
* deleted at some time. Regardless, we skip such records if doing
|
|
|
|
* cursor next/prev operations, and fail if the application requested
|
|
|
|
* them explicitly.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if (B_DISSET(GET_BKEYDATA(h, indx)->type)) {
|
|
|
|
if (flags == DB_NEXT || flags == DB_PREV) {
|
|
|
|
(void)__bam_stkrel(dbc, 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
goto retry;
|
1999-06-13 13:36:34 +00:00
|
|
|
}
|
|
|
|
ret = DB_KEYEMPTY;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the data item. */
|
|
|
|
if ((ret = __db_ret(dbp,
|
|
|
|
h, indx, data, &dbc->rdata.data, &dbc->rdata.ulen)) != 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* The cursor was reset, no further delete adjustment is necessary. */
|
|
|
|
CD_CLR(dbp, cp);
|
|
|
|
|
|
|
|
err: if (stack)
|
|
|
|
(void)__bam_stkrel(dbc, 0);
|
|
|
|
|
|
|
|
/* Release temporary lock upgrade. */
|
|
|
|
if (tmp_rmw)
|
|
|
|
F_CLR(dbc, DBC_RMW);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if (ret != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
*cp = copy;
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_c_put --
|
|
|
|
* Recno cursor->c_put function.
|
1999-06-13 13:36:34 +00:00
|
|
|
*
|
|
|
|
* PUBLIC: int __ram_c_put __P((DBC *, DBT *, DBT *, u_int32_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
int
|
1997-08-27 20:26:10 +00:00
|
|
|
__ram_c_put(dbc, key, data, flags)
|
|
|
|
DBC *dbc;
|
|
|
|
DBT *key, *data;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp, copy;
|
1997-08-27 20:26:10 +00:00
|
|
|
DB *dbp;
|
|
|
|
int exact, ret;
|
|
|
|
void *arg;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
cp = dbc->internal;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_PANIC_CHECK(dbp);
|
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
if ((ret = __db_cputchk(dbc->dbp, key, data, flags,
|
|
|
|
F_ISSET(dbc->dbp, DB_AM_RDONLY), cp->recno != RECNO_OOB)) != 0)
|
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
DEBUG_LWRITE(dbc, dbc->txn, "ram_c_put", NULL, data, flags);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we are running CDB, this had better be either a write
|
|
|
|
* cursor or an immediate writer. If it's a regular writer,
|
|
|
|
* that means we have an IWRITE lock and we need to upgrade
|
|
|
|
* it to a write lock.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(dbp, DB_AM_CDB)) {
|
|
|
|
if (!F_ISSET(dbc, DBC_RMW | DBC_WRITER))
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
if (F_ISSET(dbc, DBC_RMW) &&
|
|
|
|
(ret = lock_get(dbp->dbenv->lk_info, dbc->locker,
|
|
|
|
DB_LOCK_UPGRADE, &dbc->lock_dbt, DB_LOCK_WRITE,
|
|
|
|
&dbc->mylock)) != 0)
|
|
|
|
return (EAGAIN);
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Initialize the cursor for a new retrieval. */
|
|
|
|
copy = *cp;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To split, we need a valid key for the page. Since it's a cursor,
|
|
|
|
* we have to build one.
|
|
|
|
*
|
|
|
|
* The split code discards all short-term locks and stack pages.
|
|
|
|
*/
|
|
|
|
if (0) {
|
|
|
|
split: arg = &cp->recno;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_split(dbc, arg)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_rsearch(dbc, &cp->recno, S_INSERT, 1, &exact)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
if (!exact) {
|
|
|
|
ret = DB_NOTFOUND;
|
|
|
|
goto err;
|
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_iitem(dbc, &cp->csp->page,
|
|
|
|
&cp->csp->indx, key, data, flags, 0)) == DB_NEEDSPLIT) {
|
|
|
|
if ((ret = __bam_stkrel(dbc, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
goto split;
|
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_stkrel(dbc, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
switch (flags) {
|
|
|
|
case DB_AFTER:
|
|
|
|
/* Adjust the cursors. */
|
|
|
|
__ram_ca(dbp, cp->recno, CA_IAFTER);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Set this cursor to reference the new record. */
|
|
|
|
cp->recno = copy.recno + 1;
|
|
|
|
break;
|
|
|
|
case DB_BEFORE:
|
|
|
|
/* Adjust the cursors. */
|
|
|
|
__ram_ca(dbp, cp->recno, CA_IBEFORE);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Set this cursor to reference the new record. */
|
|
|
|
cp->recno = copy.recno;
|
|
|
|
break;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* The cursor was reset, no further delete adjustment is necessary. */
|
1997-08-27 20:26:10 +00:00
|
|
|
CD_CLR(dbp, cp);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
err: if (F_ISSET(dbp, DB_AM_CDB) && F_ISSET(dbc, DBC_RMW))
|
|
|
|
(void)__lock_downgrade(dbp->dbenv->lk_info, dbc->mylock,
|
|
|
|
DB_LOCK_IWRITE, 0);
|
|
|
|
|
|
|
|
if (ret != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
*cp = copy;
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_ca --
|
|
|
|
* Adjust cursors.
|
|
|
|
*
|
|
|
|
* PUBLIC: void __ram_ca __P((DB *, db_recno_t, ca_recno_arg));
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
__ram_ca(dbp, recno, op)
|
|
|
|
DB *dbp;
|
|
|
|
db_recno_t recno;
|
|
|
|
ca_recno_arg op;
|
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp;
|
1997-08-27 20:26:10 +00:00
|
|
|
DBC *dbc;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Adjust the cursors. See the comment in __bam_ca_delete().
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_THREAD_LOCK(dbp);
|
|
|
|
for (dbc = TAILQ_FIRST(&dbp->active_queue);
|
1997-08-27 20:26:10 +00:00
|
|
|
dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
cp = dbc->internal;
|
1997-08-27 20:26:10 +00:00
|
|
|
switch (op) {
|
|
|
|
case CA_DELETE:
|
|
|
|
if (recno > cp->recno)
|
|
|
|
--cp->recno;
|
1999-06-13 13:36:34 +00:00
|
|
|
if (recno == cp->recno)
|
|
|
|
CD_SET(dbp, cp);
|
1997-08-27 20:26:10 +00:00
|
|
|
break;
|
|
|
|
case CA_IAFTER:
|
|
|
|
if (recno > cp->recno)
|
|
|
|
++cp->recno;
|
|
|
|
break;
|
|
|
|
case CA_IBEFORE:
|
|
|
|
if (recno >= cp->recno)
|
|
|
|
++cp->recno;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_THREAD_UNLOCK(dbp);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_getno --
|
|
|
|
* Check the user's record number, and make sure we've seen it.
|
|
|
|
*
|
1999-06-13 13:36:34 +00:00
|
|
|
* PUBLIC: int __ram_getno __P((DBC *, const DBT *, db_recno_t *, int));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_getno(dbc, key, rep, can_create)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
const DBT *key;
|
|
|
|
db_recno_t *rep;
|
|
|
|
int can_create;
|
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t recno;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
/* Check the user's record number. */
|
|
|
|
if ((recno = *(db_recno_t *)key->data) == 0) {
|
|
|
|
__db_err(dbp->dbenv, "illegal record number of 0");
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
if (rep != NULL)
|
|
|
|
*rep = recno;
|
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* Btree can neither create records nor read them in. Recno can
|
1997-08-27 20:26:10 +00:00
|
|
|
* do both, see if we can find the record.
|
|
|
|
*/
|
|
|
|
return (dbp->type == DB_RECNO ?
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_update(dbc, recno, can_create) : 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_update --
|
|
|
|
* Ensure the tree has records up to and including the specified one.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_update(dbc, recno, can_create)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t recno;
|
|
|
|
int can_create;
|
|
|
|
{
|
|
|
|
BTREE *t;
|
1999-06-13 13:36:34 +00:00
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
RECNO *rp;
|
|
|
|
db_recno_t nrecs;
|
|
|
|
int ret;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
t = dbp->internal;
|
1999-06-13 13:36:34 +00:00
|
|
|
rp = t->recno;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we can't create records and we've read the entire backing input
|
|
|
|
* file, we're done.
|
|
|
|
*/
|
|
|
|
if (!can_create && F_ISSET(rp, RECNO_EOF))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we haven't seen this record yet, try to get it from the original
|
|
|
|
* file.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_nrecs(dbc, &nrecs)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
if (!F_ISSET(rp, RECNO_EOF) && recno > nrecs) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = rp->re_irec(dbc, recno)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_nrecs(dbc, &nrecs)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we can create records, create empty ones up to the requested
|
|
|
|
* record.
|
|
|
|
*/
|
|
|
|
if (!can_create || recno <= nrecs + 1)
|
|
|
|
return (0);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbc->rdata.dlen = 0;
|
|
|
|
dbc->rdata.doff = 0;
|
|
|
|
dbc->rdata.flags = 0;
|
1997-08-27 20:26:10 +00:00
|
|
|
if (F_ISSET(dbp, DB_RE_FIXEDLEN)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if (dbc->rdata.ulen < rp->re_len) {
|
|
|
|
if ((ret =
|
|
|
|
__os_realloc(&dbc->rdata.data, rp->re_len)) != 0) {
|
|
|
|
dbc->rdata.ulen = 0;
|
|
|
|
dbc->rdata.data = NULL;
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
dbc->rdata.ulen = rp->re_len;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
dbc->rdata.size = rp->re_len;
|
|
|
|
memset(dbc->rdata.data, rp->re_pad, rp->re_len);
|
1997-08-27 20:26:10 +00:00
|
|
|
} else
|
1999-06-13 13:36:34 +00:00
|
|
|
dbc->rdata.size = 0;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
while (recno > ++nrecs)
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __ram_add(dbc,
|
|
|
|
&nrecs, &dbc->rdata, 0, BI_DELETED)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_source --
|
|
|
|
* Load information about the backing file.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
__ram_source(dbp, rp, fname)
|
|
|
|
DB *dbp;
|
|
|
|
RECNO *rp;
|
|
|
|
const char *fname;
|
|
|
|
{
|
1998-01-25 17:01:47 +00:00
|
|
|
size_t size;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t bytes, mbytes, oflags;
|
|
|
|
int ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/*
|
|
|
|
* !!!
|
|
|
|
* The caller has full responsibility for cleaning up on error --
|
|
|
|
* (it has to anyway, in case it fails after this routine succeeds).
|
|
|
|
*/
|
1997-08-27 20:26:10 +00:00
|
|
|
if ((ret = __db_appname(dbp->dbenv,
|
1998-06-09 15:16:55 +00:00
|
|
|
DB_APP_DATA, NULL, fname, 0, NULL, &rp->re_source)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
|
|
|
oflags = F_ISSET(dbp, DB_AM_RDONLY) ? DB_RDONLY : 0;
|
|
|
|
if ((ret =
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
__db_open(rp->re_source, oflags, oflags, 0, &rp->re_fd)) != 0) {
|
1997-08-27 20:26:10 +00:00
|
|
|
__db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret));
|
1999-06-13 13:36:34 +00:00
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* We'd like to test to see if the file is too big to mmap. Since we
|
|
|
|
* don't know what size or type off_t's or size_t's are, or the largest
|
|
|
|
* unsigned integral type is, or what random insanity the local C
|
|
|
|
* compiler will perpetrate, doing the comparison in a portable way is
|
|
|
|
* flatly impossible. Hope that mmap fails if the file is too large.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_ioinfo(rp->re_source,
|
1998-01-25 17:01:47 +00:00
|
|
|
rp->re_fd, &mbytes, &bytes, NULL)) != 0) {
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
__db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret));
|
1999-06-13 13:36:34 +00:00
|
|
|
return (ret);
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
}
|
1998-01-25 17:01:47 +00:00
|
|
|
if (mbytes == 0 && bytes == 0) {
|
1997-08-27 20:26:10 +00:00
|
|
|
F_SET(rp, RECNO_EOF);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1998-01-25 17:01:47 +00:00
|
|
|
size = mbytes * MEGABYTE + bytes;
|
1998-06-09 15:16:55 +00:00
|
|
|
if ((ret = __db_mapfile(rp->re_source,
|
|
|
|
rp->re_fd, (size_t)size, 1, &rp->re_smap)) != 0)
|
1999-06-13 13:36:34 +00:00
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
rp->re_cmap = rp->re_smap;
|
|
|
|
rp->re_emap = (u_int8_t *)rp->re_smap + (rp->re_msize = size);
|
|
|
|
rp->re_irec = F_ISSET(dbp, DB_RE_FIXEDLEN) ? __ram_fmap : __ram_vmap;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_writeback --
|
|
|
|
* Rewrite the backing file.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_writeback(dbc)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
DBT key, data;
|
1999-06-13 13:36:34 +00:00
|
|
|
RECNO *rp;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t keyno;
|
|
|
|
ssize_t nw;
|
|
|
|
int fd, ret, t_ret;
|
|
|
|
u_int8_t delim, *pad;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
|
|
|
rp = ((BTREE *)dbp->internal)->recno;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* If the file wasn't modified, we're done. */
|
|
|
|
if (!F_ISSET(rp, RECNO_MODIFIED))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* If there's no backing source file, we're done. */
|
|
|
|
if (rp->re_source == NULL) {
|
|
|
|
F_CLR(rp, RECNO_MODIFIED);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read any remaining records into the tree.
|
|
|
|
*
|
1999-06-13 13:36:34 +00:00
|
|
|
* !!!
|
1997-08-27 20:26:10 +00:00
|
|
|
* This is why we can't support transactions when applications specify
|
|
|
|
* backing (re_source) files. At this point we have to read in the
|
|
|
|
* rest of the records from the file so that we can write all of the
|
|
|
|
* records back out again, which could modify a page for which we'd
|
|
|
|
* have to log changes and which we don't have locked. This could be
|
|
|
|
* partially fixed by taking a snapshot of the entire file during the
|
|
|
|
* db_open(), or, since db_open() isn't transaction protected, as part
|
|
|
|
* of the first DB operation. But, if a checkpoint occurs then, the
|
|
|
|
* part of the log holding the copy of the file could be discarded, and
|
|
|
|
* that would make it impossible to recover in the face of disaster.
|
|
|
|
* This could all probably be fixed, but it would require transaction
|
|
|
|
* protecting the backing source file, i.e. mpool would have to know
|
|
|
|
* about it, and we don't want to go there.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret =
|
|
|
|
__ram_update(dbc, DB_MAX_RECORDS, 0)) != 0 && ret != DB_NOTFOUND)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* !!!
|
|
|
|
* Close any underlying mmap region. This is required for Windows NT
|
|
|
|
* (4.0, Service Pack 2) -- if the file is still mapped, the following
|
|
|
|
* open will fail.
|
|
|
|
*/
|
|
|
|
if (rp->re_smap != NULL) {
|
1998-06-09 15:16:55 +00:00
|
|
|
(void)__db_unmapfile(rp->re_smap, rp->re_msize);
|
1997-08-27 20:26:10 +00:00
|
|
|
rp->re_smap = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get rid of any backing file descriptor, just on GP's. */
|
|
|
|
if (rp->re_fd != -1) {
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(rp->re_fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
rp->re_fd = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open the file, truncating it. */
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
if ((ret = __db_open(rp->re_source,
|
1997-08-27 20:26:10 +00:00
|
|
|
DB_SEQUENTIAL | DB_TRUNCATE,
|
|
|
|
DB_SEQUENTIAL | DB_TRUNCATE, 0, &fd)) != 0) {
|
|
|
|
__db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret));
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We step through the records, writing each one out. Use the record
|
|
|
|
* number and the dbp->get() function, instead of a cursor, so we find
|
|
|
|
* and write out "deleted" or non-existent records.
|
|
|
|
*/
|
|
|
|
memset(&key, 0, sizeof(key));
|
|
|
|
memset(&data, 0, sizeof(data));
|
|
|
|
key.size = sizeof(db_recno_t);
|
|
|
|
key.data = &keyno;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We'll need the delimiter if we're doing variable-length records,
|
|
|
|
* and the pad character if we're doing fixed-length records.
|
|
|
|
*/
|
|
|
|
delim = rp->re_delim;
|
|
|
|
if (F_ISSET(dbp, DB_RE_FIXEDLEN)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_malloc(rp->re_len, NULL, &pad)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
memset(pad, rp->re_pad, rp->re_len);
|
|
|
|
} else
|
1998-01-25 17:01:47 +00:00
|
|
|
COMPQUIET(pad, NULL);
|
1997-08-27 20:26:10 +00:00
|
|
|
for (keyno = 1;; ++keyno) {
|
|
|
|
switch (ret = dbp->get(dbp, NULL, &key, &data, 0)) {
|
|
|
|
case 0:
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_write(fd, data.data, data.size, &nw)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
if (nw != (ssize_t)data.size) {
|
|
|
|
ret = EIO;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DB_KEYEMPTY:
|
|
|
|
if (F_ISSET(dbp, DB_RE_FIXEDLEN)) {
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_write(fd, pad, rp->re_len, &nw)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
1997-09-05 01:43:20 +00:00
|
|
|
if (nw != (ssize_t)rp->re_len) {
|
1997-08-27 20:26:10 +00:00
|
|
|
ret = EIO;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DB_NOTFOUND:
|
|
|
|
ret = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (!F_ISSET(dbp, DB_RE_FIXEDLEN)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_write(fd, &delim, 1, &nw)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
if (nw != 1) {
|
|
|
|
ret = EIO;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
err:
|
|
|
|
done: /* Close the file descriptor. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((t_ret = __os_close(fd)) != 0 || ret == 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
ret = t_ret;
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
F_CLR(rp, RECNO_MODIFIED);
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_fmap --
|
|
|
|
* Get fixed length records from a file.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_fmap(dbc, top)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t top;
|
|
|
|
{
|
1999-06-13 13:36:34 +00:00
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
DBT data;
|
|
|
|
RECNO *rp;
|
|
|
|
db_recno_t recno;
|
|
|
|
u_int32_t len;
|
|
|
|
u_int8_t *sp, *ep, *p;
|
|
|
|
int ret;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_nrecs(dbc, &recno)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
|
|
|
rp = ((BTREE *)(dbp->internal))->recno;
|
|
|
|
|
|
|
|
if (dbc->rdata.ulen < rp->re_len) {
|
|
|
|
if ((ret = __os_realloc(&dbc->rdata.data, rp->re_len)) != 0) {
|
|
|
|
dbc->rdata.ulen = 0;
|
|
|
|
dbc->rdata.data = NULL;
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
dbc->rdata.ulen = rp->re_len;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
memset(&data, 0, sizeof(data));
|
1999-06-13 13:36:34 +00:00
|
|
|
data.data = dbc->rdata.data;
|
1997-08-27 20:26:10 +00:00
|
|
|
data.size = rp->re_len;
|
|
|
|
|
|
|
|
sp = (u_int8_t *)rp->re_cmap;
|
|
|
|
ep = (u_int8_t *)rp->re_emap;
|
1998-06-09 15:16:55 +00:00
|
|
|
while (recno < top) {
|
1997-08-27 20:26:10 +00:00
|
|
|
if (sp >= ep) {
|
|
|
|
F_SET(rp, RECNO_EOF);
|
|
|
|
return (DB_NOTFOUND);
|
|
|
|
}
|
|
|
|
len = rp->re_len;
|
1999-06-13 13:36:34 +00:00
|
|
|
for (p = dbc->rdata.data;
|
1998-06-09 15:16:55 +00:00
|
|
|
sp < ep && len > 0; *p++ = *sp++, --len)
|
|
|
|
;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Another process may have read this record from the input
|
|
|
|
* file and stored it into the database already, in which
|
|
|
|
* case we don't need to repeat that operation. We detect
|
|
|
|
* this by checking if the last record we've read is greater
|
|
|
|
* or equal to the number of records in the database.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
|
|
|
* XXX
|
|
|
|
* We should just do a seek, since the records are fixed
|
|
|
|
* length.
|
|
|
|
*/
|
|
|
|
if (rp->re_last >= recno) {
|
|
|
|
if (len != 0)
|
|
|
|
memset(p, rp->re_pad, len);
|
|
|
|
|
|
|
|
++recno;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __ram_add(dbc, &recno, &data, 0, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
++rp->re_last;
|
|
|
|
}
|
|
|
|
rp->re_cmap = sp;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_vmap --
|
|
|
|
* Get variable length records from a file.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_vmap(dbc, top)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t top;
|
|
|
|
{
|
|
|
|
DBT data;
|
|
|
|
RECNO *rp;
|
|
|
|
db_recno_t recno;
|
|
|
|
u_int8_t *sp, *ep;
|
|
|
|
int delim, ret;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
rp = ((BTREE *)(dbc->dbp->internal))->recno;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_nrecs(dbc, &recno)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
|
|
|
|
memset(&data, 0, sizeof(data));
|
|
|
|
|
|
|
|
delim = rp->re_delim;
|
|
|
|
|
|
|
|
sp = (u_int8_t *)rp->re_cmap;
|
|
|
|
ep = (u_int8_t *)rp->re_emap;
|
1998-06-09 15:16:55 +00:00
|
|
|
while (recno < top) {
|
1997-08-27 20:26:10 +00:00
|
|
|
if (sp >= ep) {
|
|
|
|
F_SET(rp, RECNO_EOF);
|
|
|
|
return (DB_NOTFOUND);
|
|
|
|
}
|
1998-06-09 15:16:55 +00:00
|
|
|
for (data.data = sp; sp < ep && *sp != delim; ++sp)
|
|
|
|
;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Another process may have read this record from the input
|
|
|
|
* file and stored it into the database already, in which
|
|
|
|
* case we don't need to repeat that operation. We detect
|
|
|
|
* this by checking if the last record we've read is greater
|
|
|
|
* or equal to the number of records in the database.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
if (rp->re_last >= recno) {
|
|
|
|
data.size = sp - (u_int8_t *)data.data;
|
|
|
|
++recno;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __ram_add(dbc, &recno, &data, 0, 0)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
++rp->re_last;
|
|
|
|
++sp;
|
|
|
|
}
|
|
|
|
rp->re_cmap = sp;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __ram_add --
|
|
|
|
* Add records into the tree.
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-13 13:36:34 +00:00
|
|
|
__ram_add(dbc, recnop, data, flags, bi_flags)
|
|
|
|
DBC *dbc;
|
1997-08-27 20:26:10 +00:00
|
|
|
db_recno_t *recnop;
|
|
|
|
DBT *data;
|
1998-06-09 15:16:55 +00:00
|
|
|
u_int32_t flags, bi_flags;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1998-06-09 15:16:55 +00:00
|
|
|
BKEYDATA *bk;
|
1999-06-13 13:36:34 +00:00
|
|
|
CURSOR *cp;
|
|
|
|
DB *dbp;
|
1997-08-27 20:26:10 +00:00
|
|
|
PAGE *h;
|
|
|
|
db_indx_t indx;
|
1998-06-09 15:16:55 +00:00
|
|
|
int exact, isdeleted, ret, stack;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
dbp = dbc->dbp;
|
|
|
|
cp = dbc->internal;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
retry: /* Find the slot for insertion. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_rsearch(dbc, recnop,
|
|
|
|
S_INSERT | (flags == DB_APPEND ? S_APPEND : 0), 1, &exact)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
1999-06-13 13:36:34 +00:00
|
|
|
h = cp->csp->page;
|
|
|
|
indx = cp->csp->indx;
|
1997-08-27 20:26:10 +00:00
|
|
|
stack = 1;
|
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* If re-numbering records, the on-page deleted flag means this record
|
|
|
|
* was implicitly created. If not re-numbering records, the on-page
|
|
|
|
* deleted flag means this record was implicitly created, or, it was
|
|
|
|
* deleted at some time.
|
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* If DB_NOOVERWRITE is set and the item already exists in the tree,
|
1999-06-13 13:36:34 +00:00
|
|
|
* return an error unless the item was either marked for deletion or
|
|
|
|
* only implicitly created.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
isdeleted = 0;
|
|
|
|
if (exact) {
|
|
|
|
bk = GET_BKEYDATA(h, indx);
|
1999-06-13 13:36:34 +00:00
|
|
|
if (B_DISSET(bk->type))
|
1998-06-09 15:16:55 +00:00
|
|
|
isdeleted = 1;
|
1999-06-13 13:36:34 +00:00
|
|
|
else
|
|
|
|
if (flags == DB_NOOVERWRITE) {
|
1998-06-09 15:16:55 +00:00
|
|
|
ret = DB_KEYEXIST;
|
|
|
|
goto err;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Select the arguments for __bam_iitem() and do the insert. If the
|
|
|
|
* key is an exact match, or we're replacing the data item with a
|
1998-06-09 15:16:55 +00:00
|
|
|
* new data item, replace the current item. If the key isn't an exact
|
|
|
|
* match, we're inserting a new key/data pair, before the search
|
|
|
|
* location.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
switch (ret = __bam_iitem(dbc,
|
1998-06-09 15:16:55 +00:00
|
|
|
&h, &indx, NULL, data, exact ? DB_CURRENT : DB_BEFORE, bi_flags)) {
|
|
|
|
case 0:
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* Don't adjust anything.
|
|
|
|
*
|
|
|
|
* If we inserted a record, no cursors need adjusting because
|
|
|
|
* the only new record it's possible to insert is at the very
|
|
|
|
* end of the tree. The necessary adjustments to the internal
|
|
|
|
* page counts were made by __bam_iitem().
|
|
|
|
*
|
|
|
|
* If we overwrote a record, no cursors need adjusting because
|
|
|
|
* future DBcursor->get calls will simply return the underlying
|
|
|
|
* record (there's no adjustment made for the DB_CURRENT flag
|
|
|
|
* when a cursor get operation immediately follows a cursor
|
|
|
|
* delete operation, and the normal adjustment for the DB_NEXT
|
|
|
|
* flag is still correct).
|
1998-06-09 15:16:55 +00:00
|
|
|
*/
|
|
|
|
break;
|
|
|
|
case DB_NEEDSPLIT:
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Discard the stack of pages and split the page. */
|
|
|
|
(void)__bam_stkrel(dbc, 0);
|
1997-08-27 20:26:10 +00:00
|
|
|
stack = 0;
|
1998-06-09 15:16:55 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __bam_split(dbc, recnop)) != 0)
|
|
|
|
goto err;
|
1998-06-09 15:16:55 +00:00
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
goto retry;
|
1998-06-09 15:16:55 +00:00
|
|
|
/* NOTREACHED */
|
|
|
|
default:
|
1999-06-13 13:36:34 +00:00
|
|
|
goto err;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
err: if (stack)
|
1999-06-13 13:36:34 +00:00
|
|
|
__bam_stkrel(dbc, 0);
|
1998-06-09 15:16:55 +00:00
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|