diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-02 18:30:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-02 18:30:13 +0000 |
commit | 6f2a8167292f11227d4540f90e933bc29265921c (patch) | |
tree | c56f1e844545f5451945a9bc4b7d4f576910768d /db2 | |
parent | 793bd4d9ebc5198ac292437227bec133fc6f4dfc (diff) | |
download | glibc-6f2a8167292f11227d4540f90e933bc29265921c.tar.gz glibc-6f2a8167292f11227d4540f90e933bc29265921c.tar.xz glibc-6f2a8167292f11227d4540f90e933bc29265921c.zip |
Update.
* signal/Versions [GLIBC_2.1.3] (libc): Export __sigsuspend. * sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c (__mmap64): Fix typos (__ASSUME_TRUNCATE64_SYSCALL -> __ASSUME_MMAP2_SYSCALL). Reported by Philip Blundell <Philip.Blundell@pobox.com>.
Diffstat (limited to 'db2')
-rw-r--r-- | db2/btree/btree.src | 156 | ||||
-rw-r--r-- | db2/db/db.src | 152 | ||||
-rw-r--r-- | db2/dbm/dbm.c | 503 |
3 files changed, 0 insertions, 811 deletions
diff --git a/db2/btree/btree.src b/db2/btree/btree.src deleted file mode 100644 index 928dce2196..0000000000 --- a/db2/btree/btree.src +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)btree.src 10.8 (Sleepycat) 4/10/98 - */ - -PREFIX bam - -/* - * BTREE-pg_alloc: used to record allocating a new page. - * - * meta_lsn: the meta-data page's original lsn. - * page_lsn: the allocated page's original lsn. - * pgno: the page allocated. - * next: the next page on the free list. - */ -BEGIN pg_alloc -ARG fileid u_int32_t lu -POINTER meta_lsn DB_LSN * lu -POINTER page_lsn DB_LSN * lu -ARG pgno db_pgno_t lu -ARG ptype u_int32_t lu -ARG next db_pgno_t lu -END - -/* - * BTREE-pg_free: used to record freeing a page. - * - * pgno: the page being freed. - * meta_lsn: the meta-data page's original lsn. - * header: the header from the free'd page. - * next: the previous next pointer on the metadata page. - */ -BEGIN pg_free -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER meta_lsn DB_LSN * lu -DBT header DBT s -ARG next db_pgno_t lu -END - -/* - * BTREE-split: used to log a page split. - * - * left: the page number for the low-order contents. - * llsn: the left page's original LSN. - * right: the page number for the high-order contents. - * rlsn: the right page's original LSN. - * indx: the number of entries that went to the left page. - * npgno: the next page number - * nlsn: the next page's original LSN (or 0 if no next page). - * pg: the split page's contents before the split. - */ -BEGIN split -ARG fileid u_int32_t lu -ARG left db_pgno_t lu -POINTER llsn DB_LSN * lu -ARG right db_pgno_t lu -POINTER rlsn DB_LSN * lu -ARG indx u_int32_t lu -ARG npgno db_pgno_t lu -POINTER nlsn DB_LSN * lu -DBT pg DBT s -END - -/* - * BTREE-rsplit: used to log a reverse-split - * - * pgno: the page number of the page copied over the root. - * pgdbt: the page being copied on the root page. - * nrec: the tree's record count. - * rootent: last entry on the root page. - * rootlsn: the root page's original lsn. - */ -BEGIN rsplit -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -DBT pgdbt DBT s -ARG nrec db_pgno_t lu -DBT rootent DBT s -POINTER rootlsn DB_LSN * lu -END - -/* - * BTREE-adj: used to log the adjustment of an index. - * - * pgno: the page modified. - * lsn: the page's original lsn. - * indx: the index adjusted. - * indx_copy: the index to copy if inserting. - * is_insert: 0 if a delete, 1 if an insert. - */ -BEGIN adj -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG indx u_int32_t lu -ARG indx_copy u_int32_t lu -ARG is_insert u_int32_t lu -END - -/* - * BTREE-cadjust: used to adjust the count change in an internal page. - * - * pgno: the page modified. - * lsn: the page's original lsn. - * indx: the index to be adjusted. - * adjust: the signed adjustment. - * total: if the total tree entries count should be adjusted - */ -BEGIN cadjust -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG indx u_int32_t lu -ARG adjust int32_t ld -ARG total int32_t ld -END - -/* - * BTREE-cdel: used to log the intent-to-delete of a cursor record. - * - * pgno: the page modified. - * lsn: the page's original lsn. - * indx: the index to be deleted. - */ -BEGIN cdel -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG indx u_int32_t lu -END - -/* - * BTREE-repl: used to log the replacement of an item. - * - * pgno: the page modified. - * lsn: the page's original lsn. - * orig: the original data. - * new: the replacement data. - * duplicate: the prefix of the replacement that matches the original. - */ -BEGIN repl -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG indx u_int32_t lu -ARG isdeleted u_int32_t lu -DBT orig DBT s -DBT repl DBT s -ARG prefix u_int32_t lu -ARG suffix u_int32_t lu -END diff --git a/db2/db/db.src b/db2/db/db.src deleted file mode 100644 index 26557e10ac..0000000000 --- a/db2/db/db.src +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db.src 10.8 (Sleepycat) 9/20/98 - */ - -PREFIX db - -/* - * addrem -- Add or remove an entry from a duplicate page. - * - * opcode: identifies if this is an add or delete. - * fileid: file identifier of the file being modified. - * pgno: duplicate page number. - * indx: location at which to insert or delete. - * nbytes: number of bytes added/removed to/from the page. - * hdr: header for the data item. - * dbt: data that is deleted or is to be added. - * pagelsn: former lsn of the page. - * - * If the hdr was NULL then, the dbt is a regular B_KEYDATA. - * If the dbt was NULL then the hdr is a complete item to be - * pasted on the page. - */ -BEGIN addrem -ARG opcode u_int32_t lu -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -ARG indx u_int32_t lu -ARG nbytes size_t lu -DBT hdr DBT s -DBT dbt DBT s -POINTER pagelsn DB_LSN * lu -END - -/* - * split -- Handles the split of a duplicate page. - * - * opcode: defines whether we are splitting from or splitting onto - * fileid: file identifier of the file being modified. - * pgno: page number being split. - * pageimage: entire page contents. - * pagelsn: former lsn of the page. - */ -BEGIN split -ARG opcode u_int32_t lu -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -DBT pageimage DBT s -POINTER pagelsn DB_LSN * lu -END - -/* - * big -- Handles addition and deletion of big key/data items. - * - * opcode: identifies get/put. - * fileid: file identifier of the file being modified. - * pgno: page onto which data is being added/removed. - * prev_pgno: the page before the one we are logging. - * next_pgno: the page after the one we are logging. - * dbt: data being written onto the page. - * pagelsn: former lsn of the orig_page. - * prevlsn: former lsn of the prev_pgno. - * nextlsn: former lsn of the next_pgno. This is not currently used, but - * may be used later if we actually do overwrites of big key/ - * data items in place. - */ -BEGIN big -ARG opcode u_int32_t lu -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -ARG prev_pgno db_pgno_t lu -ARG next_pgno db_pgno_t lu -DBT dbt DBT s -POINTER pagelsn DB_LSN * lu -POINTER prevlsn DB_LSN * lu -POINTER nextlsn DB_LSN * lu -END - -/* - * ovref -- Handles increment/decrement of overflow page reference count. - * - * fileid: identifies the file being modified. - * pgno: page number whose ref count is being incremented/decremented. - * adjust: the adjustment being made. - * lsn: the page's original lsn. - */ -BEGIN ovref -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -ARG adjust int32_t ld -POINTER lsn DB_LSN * lu -END - -/* - * relink -- Handles relinking around a page. - * - * opcode: indicates if this is an addpage or delete page - * pgno: the page being changed. - * lsn the page's original lsn. - * prev: the previous page. - * lsn_prev: the previous page's original lsn. - * next: the next page. - * lsn_next: the previous page's original lsn. - */ -BEGIN relink -ARG opcode u_int32_t lu -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG prev db_pgno_t lu -POINTER lsn_prev DB_LSN * lu -ARG next db_pgno_t lu -POINTER lsn_next DB_LSN * lu -END - -/* - * Addpage -- Handles adding a new duplicate page onto the end of - * an existing duplicate page. - * fileid: identifies the file being changed. - * pgno: page number to which a new page is being added. - * lsn: lsn of pgno - * nextpgno: new page number being added. - * nextlsn: lsn of nextpgno; - */ -BEGIN addpage -ARG fileid u_int32_t lu -ARG pgno db_pgno_t lu -POINTER lsn DB_LSN * lu -ARG nextpgno db_pgno_t lu -POINTER nextlsn DB_LSN * lu -END - -/* - * Debug -- log an operation upon entering an access method. - * op: Operation (cursor, c_close, c_get, c_put, c_del, - * get, put, delete). - * fileid: identifies the file being acted upon. - * key: key paramater - * data: data parameter - * flags: flags parameter - */ -BEGIN debug -DBT op DBT s -ARG fileid u_int32_t lu -DBT key DBT s -DBT data DBT s -ARG arg_flags u_int32_t lu -END diff --git a/db2/dbm/dbm.c b/db2/dbm/dbm.c deleted file mode 100644 index 5bcb53f023..0000000000 --- a/db2/dbm/dbm.c +++ /dev/null @@ -1,503 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993 - * Margo Seltzer. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Margo Seltzer. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" - -#ifndef lint -static const char sccsid[] = "@(#)dbm.c 10.23 (Sleepycat) 11/22/98"; -#endif /* not lint */ - -#ifndef NO_SYSTEM_INCLUDES -#include <sys/types.h> - -#include <errno.h> -#include <fcntl.h> -#include <string.h> -#endif - -#define DB_DBM_HSEARCH 1 -#include "db_int.h" - -#include "db_page.h" -#include "hash.h" - -/* - * - * This package provides dbm and ndbm compatible interfaces to DB. - * - * The DBM routines, which call the NDBM routines. - */ -static DBM *__cur_db; - -static void __db_no_open __P((void)); - -int -__db_dbm_init(file) - char *file; -{ - if (__cur_db != NULL) - (void)dbm_close(__cur_db); - if ((__cur_db = - dbm_open(file, O_CREAT | O_RDWR, __db_omode("rw----"))) != NULL) - return (0); - if ((__cur_db = dbm_open(file, O_RDONLY, 0)) != NULL) - return (0); - return (-1); -} -weak_alias (__db_dbm_init, dbminit) - -int -__db_dbm_close() -{ - if (__cur_db != NULL) { - dbm_close(__cur_db); - __cur_db = NULL; - } - return (0); -} - -datum -__db_dbm_fetch(key) - datum key; -{ - datum item; - - if (__cur_db == NULL) { - __db_no_open(); - item.dptr = 0; - return (item); - } - return (dbm_fetch(__cur_db, key)); -} -weak_alias (__db_dbm_fetch, fetch) - -datum -__db_dbm_firstkey() -{ - datum item; - - if (__cur_db == NULL) { - __db_no_open(); - item.dptr = 0; - return (item); - } - return (dbm_firstkey(__cur_db)); -} -#undef firstkey -weak_alias (__db_dbm_firstkey, firstkey) - -datum -__db_dbm_nextkey(key) - datum key; -{ - datum item; - - COMPQUIET(key.dsize, 0); - - if (__cur_db == NULL) { - __db_no_open(); - item.dptr = 0; - return (item); - } - return (dbm_nextkey(__cur_db)); -} -weak_alias (__db_dbm_nextkey, nextkey) - -int -__db_dbm_delete(key) - datum key; -{ - if (__cur_db == NULL) { - __db_no_open(); - return (-1); - } - return (dbm_delete(__cur_db, key)); -} -weak_alias (__db_dbm_delete, delete) - -int -__db_dbm_store(key, dat) - datum key, dat; -{ - if (__cur_db == NULL) { - __db_no_open(); - return (-1); - } - return (dbm_store(__cur_db, key, dat, DBM_REPLACE)); -} -weak_alias (__db_dbm_store, store) - -static void -__db_no_open() -{ - (void)fprintf(stderr, "dbm: no open database.\n"); -} - -/* - * This package provides dbm and ndbm compatible interfaces to DB. - * - * The NDBM routines, which call the DB routines. - */ -/* - * Returns: - * *DBM on success - * NULL on failure - */ -DBM * -__db_ndbm_open(file, oflags, mode) - const char *file; - int oflags, mode; -{ - DB *dbp; - DBC *dbc; - DB_INFO dbinfo; - int sv_errno; - char path[MAXPATHLEN]; - - memset(&dbinfo, 0, sizeof(dbinfo)); - dbinfo.db_pagesize = 4096; - dbinfo.h_ffactor = 40; - dbinfo.h_nelem = 1; - - /* - * XXX - * Don't use sprintf(3)/snprintf(3) -- the former is dangerous, and - * the latter isn't standard, and we're manipulating strings handed - * us by the application. - */ - if (strlen(file) + strlen(DBM_SUFFIX) + 1 > sizeof(path)) { - errno = ENAMETOOLONG; - return (NULL); - } - (void)strcpy(path, file); - (void)strcat(path, DBM_SUFFIX); - if ((errno = db_open(path, - DB_HASH, __db_oflags(oflags), mode, NULL, &dbinfo, &dbp)) != 0) - return (NULL); - - if ((errno = dbp->cursor(dbp, NULL, &dbc, 0)) != 0) { - sv_errno = errno; - (void)dbp->close(dbp, 0); - errno = sv_errno; - return (NULL); - } - - return ((DBM *)dbc); -} -weak_alias (__db_ndbm_open, dbm_open) - -/* - * Returns: - * Nothing. - */ -void -__db_ndbm_close(dbm) - DBM *dbm; -{ - DBC *dbc; - - dbc = (DBC *)dbm; - - (void)dbc->dbp->close(dbc->dbp, 0); -} -weak_alias (__db_ndbm_close, dbm_close) - -/* - * Returns: - * DATUM on success - * NULL on failure - */ -datum -__db_ndbm_fetch(dbm, key) - DBM *dbm; - datum key; -{ - DBC *dbc; - DBT _key, _data; - datum data; - int ret; - - dbc = (DBC *)dbm; - - memset(&_key, 0, sizeof(DBT)); - memset(&_data, 0, sizeof(DBT)); - _key.size = key.dsize; - _key.data = key.dptr; - - /* - * Note that we can't simply use the dbc we have to do a c_get/SET, - * because that cursor is the one used for sequential iteration and - * it has to remain stable in the face of intervening gets and puts. - */ - if ((ret = dbc->dbp->get(dbc->dbp, NULL, &_key, &_data, 0)) == 0) { - data.dptr = _data.data; - data.dsize = _data.size; - } else { - data.dptr = NULL; - data.dsize = 0; - if (ret == DB_NOTFOUND) - errno = ENOENT; - else { - errno = ret; - F_SET(dbc->dbp, DB_DBM_ERROR); - } - } - return (data); -} -weak_alias (__db_ndbm_fetch, dbm_fetch) - -/* - * Returns: - * DATUM on success - * NULL on failure - */ -datum -__db_ndbm_firstkey(dbm) - DBM *dbm; -{ - DBC *dbc; - DBT _key, _data; - datum key; - int ret; - - dbc = (DBC *)dbm; - - memset(&_key, 0, sizeof(DBT)); - memset(&_data, 0, sizeof(DBT)); - - if ((ret = dbc->c_get(dbc, &_key, &_data, DB_FIRST)) == 0) { - key.dptr = _key.data; - key.dsize = _key.size; - } else { - key.dptr = NULL; - key.dsize = 0; - if (ret == DB_NOTFOUND) - errno = ENOENT; - else { - errno = ret; - F_SET(dbc->dbp, DB_DBM_ERROR); - } - } - return (key); -} -weak_alias (__db_ndbm_firstkey, dbm_firstkey) - -/* - * Returns: - * DATUM on success - * NULL on failure - */ -datum -__db_ndbm_nextkey(dbm) - DBM *dbm; -{ - DBC *dbc; - DBT _key, _data; - datum key; - int ret; - - dbc = (DBC *)dbm; - - memset(&_key, 0, sizeof(DBT)); - memset(&_data, 0, sizeof(DBT)); - - if ((ret = dbc->c_get(dbc, &_key, &_data, DB_NEXT)) == 0) { - key.dptr = _key.data; - key.dsize = _key.size; - } else { - key.dptr = NULL; - key.dsize = 0; - if (ret == DB_NOTFOUND) - errno = ENOENT; - else { - errno = ret; - F_SET(dbc->dbp, DB_DBM_ERROR); - } - } - return (key); -} -weak_alias (__db_ndbm_nextkey, dbm_nextkey) - -/* - * Returns: - * 0 on success - * <0 failure - */ -int -__db_ndbm_delete(dbm, key) - DBM *dbm; - datum key; -{ - DBC *dbc; - DBT _key; - int ret; - - dbc = (DBC *)dbm; - - memset(&_key, 0, sizeof(DBT)); - _key.data = key.dptr; - _key.size = key.dsize; - - if ((ret = dbc->dbp->del(dbc->dbp, NULL, &_key, 0)) == 0) - return (0); - - if (ret == DB_NOTFOUND) - errno = ENOENT; - else { - errno = ret; - F_SET(dbc->dbp, DB_DBM_ERROR); - } - return (-1); -} -weak_alias (__db_ndbm_delete, dbm_delete) - -/* - * Returns: - * 0 on success - * <0 failure - * 1 if DBM_INSERT and entry exists - */ -int -__db_ndbm_store(dbm, key, data, flags) - DBM *dbm; - datum key, data; - int flags; -{ - DBC *dbc; - DBT _key, _data; - int ret; - - dbc = (DBC *)dbm; - - memset(&_key, 0, sizeof(DBT)); - _key.data = key.dptr; - _key.size = key.dsize; - - memset(&_data, 0, sizeof(DBT)); - _data.data = data.dptr; - _data.size = data.dsize; - - if ((ret = dbc->dbp->put(dbc->dbp, NULL, - &_key, &_data, flags == DBM_INSERT ? DB_NOOVERWRITE : 0)) == 0) - return (0); - - if (ret == DB_KEYEXIST) - return (1); - - errno = ret; - F_SET(dbc->dbp, DB_DBM_ERROR); - return (-1); -} -weak_alias (__db_ndbm_store, dbm_store) - -int -__db_ndbm_error(dbm) - DBM *dbm; -{ - DBC *dbc; - - dbc = (DBC *)dbm; - - return (F_ISSET(dbc->dbp, DB_DBM_ERROR)); -} -weak_alias (__db_ndbm_error, dbm_error) - -int -__db_ndbm_clearerr(dbm) - DBM *dbm; -{ - DBC *dbc; - - dbc = (DBC *)dbm; - - F_CLR(dbc->dbp, DB_DBM_ERROR); - return (0); -} -weak_alias (__db_ndbm_clearerr, dbm_clearerr) - -/* - * Returns: - * 1 if read-only - * 0 if not read-only - */ -int -__db_ndbm_rdonly(dbm) - DBM *dbm; -{ - DBC *dbc; - - dbc = (DBC *)dbm; - - return (F_ISSET(dbc->dbp, DB_AM_RDONLY) ? 1 : 0); -} - -/* - * XXX - * We only have a single file descriptor that we can return, not two. Return - * the same one for both files. Hopefully, the user is using it for locking - * and picked one to use at random. - */ -int -__db_ndbm_dirfno(dbm) - DBM *dbm; -{ - return (dbm_pagfno(dbm)); -} -weak_alias (__db_ndbm_dirfno, dbm_dirfno) - -int -__db_ndbm_pagfno(dbm) - DBM *dbm; -{ - DBC *dbc; - int fd; - - dbc = (DBC *)dbm; - - (void)dbc->dbp->fd(dbc->dbp, &fd); - return (fd); -} -weak_alias (__db_ndbm_pagfno, dbm_pagfno) |