Asterisk - The Open Source Telephony Project  GIT-master-4a4f1a5
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"

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)

◆ 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

Function Documentation

◆ __dbpanic()

void __dbpanic ( DB dbp)

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

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 }
static volatile unsigned int seq
Definition: app_sms.c:120
static DB * dbp
Definition: hsearch.c:49
Definition: db.h:85
Definition: db.h:129
static int __dberr __P((void))

References __P(), and dbp.

Referenced by __bt_split().

◆ __P()

static int __dberr __P ( (void)  )
static

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

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

References RET_ERROR.

Referenced by __dbpanic().

◆ 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.

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 }
DB * __bt_open(char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) const
Definition: bt_open.c:90
static const char type[]
Definition: chan_ooh323.c:109
@ DB_BTREE
Definition: db.h:103
@ DB_RECNO
Definition: db.h:103
@ DB_HASH
Definition: db.h:103
DB * __hash_open(char *file, int flags, int mode, const HASHINFO *info, int dflags) const
Definition: hash.c:96
int errno
DB * __rec_open(char *fname, int flags, int mode, const RECNOINFO *openinfo, int dflags) const
Definition: rec_open.c:56
#define NULL
Definition: resample.c:96
#define DB_FLAGS
#define USE_OPEN_FLAGS

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().