37 #if defined(LIBC_SCCS) && !defined(lint) 38 static char sccsid[] =
"@(#)bt_open.c 8.10 (Berkeley) 8/17/94";
49 #include <sys/param.h> 61 #include "../include/db.h" 71 static int tmp __P((
void));
139 if (b.compare ==
NULL) {
141 if (b.prefix ==
NULL)
146 b.
lorder = machine_lorder;
151 b.
lorder = machine_lorder;
164 memset(t, 0,
sizeof(
BTREE));
168 t->bt_cmp = b.compare;
169 t->bt_pfx = b.prefix;
193 switch (flags & O_ACCMODE) {
204 if ((t->
bt_fd = open(fname, flags, mode)) < 0)
208 if ((flags & O_ACCMODE) != O_RDWR)
215 if (fcntl(t->
bt_fd, F_SETFD, 1) == -1)
218 if (fstat(t->
bt_fd, &sb))
239 M_32_SWAP(m.version);
248 m.psize & (
sizeof(
indx_t) - 1))
262 #ifdef _STATBUF_ST_BLKSIZE 263 b.
psize = sb.st_blksize;
329 einval:
errno = EINVAL;
339 (void)close(t->
bt_fd);
395 static const char fmt[] =
"%s/bt.XXXXXX";
398 envtmp = getenv(
"TMPDIR");
401 n = strlen (envtmp) +
sizeof fmt;
403 path = __builtin_alloca(n);
407 (void)snprintf(path, n, fmt, envtmp ? envtmp :
"/tmp");
409 (void)sigfillset(&
set);
410 (void)sigprocmask(SIG_BLOCK, &
set, &oset);
411 if ((fd = mkstemp(path)) != -1)
413 (void)sigprocmask(SIG_SETMASK, &oset,
NULL);
static int nroot(BTREE *t)
int mpool_put(MPOOL *mp, void *page, u_int flags)
int __bt_put(DB *dbp, DBT *key, const DBT *data, u_int flags) const
meta
below block is needed for mssql
void * mpool_get(MPOOL *mp, pgno_t pgno, u_int flags)
void __bt_pgout(void *t, pgno_t pg, void *pp)
void mpool_filter(MPOOL *mp, void *pgin, void *pgout, void *pgcookie)
void __bt_pgin(void *t, pgno_t pg, void *pp)
DB * __bt_open(char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) const
int __bt_defcmp(DBT *a, DBT *b) const
#define NBLEAFDBT(ksize, dsize)
enum _btree::@518 bt_order
static int byteorder __P((void))
int __bt_delete(DB *dbp, const DBT *key, u_int flags) const
int __bt_sync(DB *dbp, u_int flags) const
int __bt_get(DB *dbp, const DBT *key, DBT *data, u_int flags) const
void * mpool_new(MPOOL *mp, pgno_t *pgnoaddr)
int __bt_seq(DB *dbp, DBT *key, DBT *data, u_int flags) const
MPOOL * mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache)
size_t __bt_defpfx(DBT *a, DBT *b) const
int __bt_fd(DB *dbp) const