37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] =
"@(#)bt_open.c 8.10 (Berkeley) 8/17/94";
61#include "../include/db.h"
128 b.psize & (
sizeof(
indx_t) - 1)))
133 if (
b.minkeypage < 2)
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;
283 if (
b.cachesize &&
b.cachesize & (
b.psize - 1))
284 b.cachesize += (~b.cachesize & (
b.psize - 1)) + 1;
329einval:
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);
int __bt_sync(DB *dbp, u_int flags) const
void __bt_pgin(void *t, pgno_t pg, void *pp)
void __bt_pgout(void *t, pgno_t pg, void *pp)
int __bt_delete(DB *dbp, const DBT *key, u_int flags) const
int __bt_get(DB *dbp, const DBT *key, DBT *data, u_int flags) const
static int byteorder __P((void))
static int nroot(BTREE *t)
int __bt_fd(DB *dbp) const
DB * __bt_open(char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) const
int __bt_put(DB *dbp, DBT *key, const DBT *data, u_int flags) const
int __bt_seq(DB *dbp, DBT *key, DBT *data, u_int flags) const
size_t __bt_defpfx(DBT *a, DBT *b) const
int __bt_defcmp(DBT *a, DBT *b) const
#define NBLEAFDBT(ksize, dsize)
static int set(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
void * mpool_get(MPOOL *mp, pgno_t pgno, u_int flags)
void * mpool_new(MPOOL *mp, pgno_t *pgnoaddr)
int mpool_put(MPOOL *mp, void *page, u_int flags)
void mpool_filter(MPOOL *mp, void *pgin, void *pgout, void *pgcookie)
MPOOL * mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache)
meta
below block is needed for mssql
enum _btree::@506 bt_order