84d9c625bf
- Fix for possible unset uid/gid in toproto - Fix for default mtree style - Update libelf - Importing libexecinfo - Resynchronize GCC, mpc, gmp, mpfr - build.sh: Replace params with show-params. This has been done as the make target has been renamed in the same way, while a new target named params has been added. This new target generates a file containing all the parameters, instead of printing it on the console. - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org) get getservbyport() out of the inner loop Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
176 lines
3.9 KiB
C
176 lines
3.9 KiB
C
/* $NetBSD: vi_db.h,v 1.3 2013/11/29 22:56:19 christos Exp $ */
|
|
|
|
#include <db.h>
|
|
|
|
#ifndef DB_BUFFER_SMALL
|
|
#define DB_BUFFER_SMALL ENOMEM
|
|
#endif
|
|
|
|
#ifdef USE_BUNDLED_DB
|
|
|
|
typedef void DB_ENV;
|
|
|
|
typedef recno_t db_recno_t;
|
|
#define DB_MAX_RECORDS MAX_REC_NUMBER
|
|
|
|
#define db_env_close(env,flags)
|
|
#define db_env_create(env,flags) \
|
|
(((void)env), 1)
|
|
#define db_env_remove(env,path,flags) \
|
|
1
|
|
#define db_open(db,file,type,flags,mode) \
|
|
(db)->open(db, file, NULL, type, flags, mode)
|
|
#define db_get_low(db,key,data,flags) \
|
|
(db)->get(db, key, data, flags)
|
|
#define db_close(db) \
|
|
(db)->close(db)
|
|
|
|
#else
|
|
|
|
#if USE_DB1 || (DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1)
|
|
#define db_env_open(env,path,flags,mode) \
|
|
(env)->open(env, path, flags, mode)
|
|
#define db_env_remove(env,path,flags) \
|
|
(env)->remove(env, path, flags)
|
|
#else
|
|
#define db_env_open(env,path,flags,mode) \
|
|
(env)->open(env, path, NULL, flags, mode)
|
|
#define db_env_remove(env,path,flags) \
|
|
(env)->remove(env, path, NULL, flags)
|
|
#endif
|
|
|
|
#define db_env_close(env,flags) \
|
|
(env)->close(env, flags)
|
|
|
|
#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
|
|
#define db_open(db,file,type,flags,mode) \
|
|
(db)->open(db, NULL, file, NULL, type, flags, mode)
|
|
#else
|
|
#define db_open(db,file,type,flags,mode) \
|
|
(db)->open(db, file, NULL, type, flags, mode)
|
|
#endif
|
|
#define db_get_low(db,key,data,flags) \
|
|
(db)->get(db, NULL, key, data, flags)
|
|
#define db_close(db) \
|
|
(db)->close(db, DB_NOSYNC)
|
|
|
|
#endif
|
|
|
|
#ifdef USE_DYNAMIC_LOADING
|
|
#define db_create nvi_db_create
|
|
#define db_env_create nvi_db_env_create
|
|
#define db_strerror nvi_db_strerror
|
|
|
|
extern int (*nvi_db_create) __P((DB **, DB_ENV *, u_int32_t));
|
|
extern int (*nvi_db_env_create) __P((DB_ENV **, u_int32_t));
|
|
extern char *(*nvi_db_strerror) __P((int));
|
|
#endif
|
|
|
|
#ifdef USE_DB1
|
|
|
|
#define DB_AFTER 1
|
|
#define DB_APPEND 2
|
|
#define DB_BEFORE 3
|
|
#define DB_FIRST 7
|
|
#define DB_LAST 15
|
|
#define DB_SET 25
|
|
|
|
#define DB_NOTFOUND (-30989)
|
|
|
|
/* DBT emulation */
|
|
typedef DBT DBT_v1;
|
|
#undef DBT
|
|
#define DBT DBT_new
|
|
|
|
typedef struct {
|
|
void *data;
|
|
size_t size;
|
|
|
|
u_int32_t ulen;
|
|
|
|
#define DB_DBT_USERMEM 0x040
|
|
u_int32_t flags;
|
|
} DBT;
|
|
|
|
/* DB_ENV emulation */
|
|
struct __db_env_new;
|
|
typedef struct __db_env_new DB_ENV;
|
|
|
|
struct __db_env_new {
|
|
int (*close)(DB_ENV *, u_int32_t);
|
|
int (*open)(DB_ENV *, char *, u_int32_t, int);
|
|
#define DB_INIT_MPOOL 0x004000
|
|
#define DB_PRIVATE 0x200000
|
|
int (*remove)(DB_ENV *, char *, u_int32_t);
|
|
|
|
char *base_path;
|
|
int mode;
|
|
};
|
|
|
|
/* DBC emulation */
|
|
|
|
struct __dbc_new;
|
|
typedef struct __dbc_new DBC;
|
|
|
|
typedef recno_t db_recno_t;
|
|
#define DB_MAX_RECORDS MAX_REC_NUMBER
|
|
|
|
#define DB_UNKNOWN (-1)
|
|
|
|
/* DB emulation */
|
|
typedef DB DB_old;
|
|
#undef DB
|
|
#define DB DB_new
|
|
typedef struct __db_new DB;
|
|
|
|
#undef DB_TXN
|
|
typedef void DB_TXN;
|
|
|
|
#undef DB_LSN
|
|
typedef struct {
|
|
int dummy;
|
|
} DB_LSN;
|
|
|
|
struct __db_new {
|
|
DB_old *actual_db;
|
|
|
|
int type;
|
|
|
|
int (*close)(DB *, u_int32_t);
|
|
#define DB_NOSYNC 26 /* close() */
|
|
|
|
int (*open)(DB *, const char *, const char *, DBTYPE, u_int32_t, int);
|
|
#define DB_CREATE 0x000001 /* Create file as necessary. */
|
|
#define DB_TRUNCATE 0x004000 /* Discard existing DB (O_TRUNC) */
|
|
|
|
int (*sync)(DB *, u_int32_t);
|
|
int (*get)(DB *, DB_TXN *, DBT *, DBT *, u_int32_t);
|
|
int (*put)(DB *, DB_TXN *, DBT *, DBT *, u_int32_t);
|
|
int (*del)(DB *, DB_TXN *, DBT *, u_int32_t);
|
|
|
|
int (*cursor)(DB *, DB_TXN *, DBC **, u_int32_t);
|
|
|
|
int (*set_flags)(DB *, u_int32_t);
|
|
#define DB_RENUMBER 0x0008 /* Recno: renumber on insert/delete. */
|
|
#define DB_SNAPSHOT 0x0020 /* Recno: snapshot the input. */
|
|
|
|
int (*set_pagesize)(DB *, u_int32_t);
|
|
|
|
int (*set_re_delim)(DB *, int);
|
|
int (*set_re_source)(DB *, const char *);
|
|
|
|
RECNOINFO _recno_info;
|
|
u_int32_t _pagesize;
|
|
u_int32_t _flags;
|
|
};
|
|
|
|
struct __dbc_new {
|
|
DB *db;
|
|
db_recno_t pos;
|
|
DBT_v1 pos_key;
|
|
int (*c_close)(DBC *);
|
|
int (*c_get)(DBC *, DBT *, DBT *, u_int32_t);
|
|
int (*c_put)(DBC *, DBT *, DBT *, u_int32_t);
|
|
};
|
|
|
|
#endif /* USE_DB1 */
|