Asterisk - The Open Source Telephony Project  18.5.0
Macros | Functions
utils/db1-ast/db/db.c File Reference
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include "../include/db.h"
Include dependency graph for utils/db1-ast/db/db.c:

Go to the source code of this file.

Macros

#define DB_FLAGS   (DB_LOCK | DB_SHMEM | DB_TXN)
 
#define USE_OPEN_FLAGS
 

Functions

void __dbpanic (DB *dbp)
 
static int __dberr __P ((void))
 
DBdbopen (char *fname, int flags, int mode, DBTYPE type, const void *openinfo) const
 

Macro Definition Documentation

◆ DB_FLAGS

#define DB_FLAGS   (DB_LOCK | DB_SHMEM | DB_TXN)

Referenced by dbopen().

◆ USE_OPEN_FLAGS

#define USE_OPEN_FLAGS
Value:
(O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY | \
O_RDWR | O_SHLOCK | O_TRUNC)
#define O_SHLOCK
#define O_EXLOCK

Referenced by dbopen().

Function Documentation

◆ __dbpanic()

void __dbpanic ( DB dbp)

Definition at line 89 of file utils/db1-ast/db/db.c.

References __P().

Referenced by __bt_split().

91 {
92  /* The only thing that can succeed is a close. */
93  dbp->del = (int (*)__P((const struct __db *,
94  const DBT *, u_int))) __dberr;
95  dbp->get = (int (*)__P((const struct __db *,
96  const DBT *, DBT *, u_int))) __dberr;
97  dbp->put = (int (*)__P((const struct __db *,
98  DBT *, const DBT *, u_int))) __dberr;
99  dbp->seq = (int (*)__P((const struct __db *,
100  DBT *, DBT *, u_int))) __dberr;
101  dbp->sync = (int (*)__P((const struct __db *, u_int))) __dberr;
102  dbp->fd = (int (*)__P((const struct __db *))) __dberr;
103 }
Definition: db.h:85
const int fd
Definition: cli.h:159
static int __dberr __P((void))
static volatile unsigned int seq
Definition: app_sms.c:120
Definition: db.h:129

◆ __P()

static int __dberr __P ( (void)  )
static

Definition at line 77 of file utils/db1-ast/db/db.c.

References RET_ERROR.

Referenced by __dbpanic().

78 {
79  return (RET_ERROR);
80 }
#define RET_ERROR
Definition: db.h:51

◆ dbopen()

DB* dbopen ( char *  fname,
int  flags,
int  mode,
DBTYPE  type,
const void *  openinfo 
) const

Definition at line 48 of file utils/db1-ast/db/db.c.

References __bt_open(), __hash_open(), __rec_open(), DB_BTREE, DB_FLAGS, DB_HASH, DB_RECNO, errno, NULL, type, and USE_OPEN_FLAGS.

Referenced by convert_bdb_to_sqlite3(), create_bdb_astdb(), and mssql_connect().

53 {
54 
55 #define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
56 #define USE_OPEN_FLAGS \
57  (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY | \
58  O_RDWR | O_SHLOCK | O_TRUNC)
59 
60  if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
61  switch (type) {
62  case DB_BTREE:
63  return (__bt_open(fname, flags & USE_OPEN_FLAGS,
64  mode, openinfo, flags & DB_FLAGS));
65  case DB_HASH:
66  return (__hash_open(fname, flags & USE_OPEN_FLAGS,
67  mode, openinfo, flags & DB_FLAGS));
68  case DB_RECNO:
69  return (__rec_open(fname, flags & USE_OPEN_FLAGS,
70  mode, openinfo, flags & DB_FLAGS));
71  }
72  errno = EINVAL;
73  return (NULL);
74 }
static const char type[]
Definition: chan_ooh323.c:109
#define USE_OPEN_FLAGS
DB * __hash_open(char *file, int flags, int mode, const HASHINFO *info, int dflags) const
Definition: hash.c:96
#define NULL
Definition: resample.c:96
Definition: db.h:103
DB * __bt_open(char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) const
Definition: bt_open.c:90
int errno
#define DB_FLAGS
Definition: db.h:103
DB * __rec_open(char *fname, int flags, int mode, const RECNOINFO *openinfo, int dflags) const
Definition: rec_open.c:56
Definition: db.h:103