bt_open.c revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "%Z%%M% %I% %E% SMI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright (c) 1990, 1993, 1994
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The Regents of the University of California. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This code is derived from software contributed to Berkeley by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Mike Olson.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Redistribution and use in source and binary forms, with or without
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * modification, are permitted provided that the following conditions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1. Redistributions of source code must retain the above copyright
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * notice, this list of conditions and the following disclaimer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2. Redistributions in binary form must reproduce the above copyright
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * notice, this list of conditions and the following disclaimer in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * documentation and/or other materials provided with the distribution.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3. All advertising materials mentioning features or use of this software
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * must display the following acknowledgement:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This product includes software developed by the University of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * California, Berkeley and its contributors.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4. Neither the name of the University nor the names of its contributors
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * may be used to endorse or promote products derived from this software
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * without specific prior written permission.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SUCH DAMAGE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char sccsid[] = "@(#)bt_open.c 8.11 (Berkeley) 11/2/95";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* LIBC_SCCS and not lint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Implementation of btree access method for 4.4BSD.
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "db-int.h"
#include "btree.h"
#ifdef DEBUG
DB *
const char *fname;
BTMETA m;
BTREE *t;
BTREEINFO b;
int machine_lorder;
t = NULL;
if (openinfo) {
b = *openinfo;
goto einval;
if (b.psize &&
goto einval;
if (b.minkeypage) {
goto einval;
if (b.lorder == 0)
b.cachesize = 0;
b.flags = 0;
b.psize = 0;
goto einval;
goto err;
goto err;
if (fname) {
case O_RDONLY:
case O_RDWR:
case O_WRONLY:
goto einval;
goto err;
goto einval;
goto err;
goto err;
goto err;
goto err;
goto eftype;
goto eftype;
goto eftype;
goto eftype;
if (b.psize == 0) {
t->bt_nrecs = 0;
t->bt_ovflsize =
if ((t->bt_mp =
goto err;
goto err;
return (dbp);
goto err;
goto err;
err: if (t) {
if (t->bt_dbp)
free(t);
return (NULL);
nroot(t)
BTREE *t;
return (RET_SUCCESS);
return (RET_ERROR);
errno = 0;
return (RET_ERROR);
return (RET_ERROR);
return (RET_ERROR);
return (RET_SUCCESS);
tmp()
#ifdef SIG_BLOCK
int oset;
int fd;
char *envtmp;
#ifdef SIG_BLOCK
#ifdef SIG_BLOCK
#ifdef __CYGWIN32__
return(fd);
u_int32_t x;
u_char *p;
p = (u_char *)&x;
return (DB_BIG_ENDIAN);
return (DB_LITTLE_ENDIAN);
BTREE *t;
return (t->bt_fd);