}
-// Open the various tables we'll be using. Any table which
-// does not exist should be created. Note that we don't need a
-// critical section here, because there aren't any active threads
-// manipulating the database yet.
+// Open the various tables we'll be using. Any table which does not exist should be created. Note that we don't need a
+// critical section here, because there aren't any active threads manipulating the database yet.
void bdb_open_databases(void) {
int ret;
int i;
}
for (i = 0; i < MAXCDB; ++i) {
- syslog(LOG_INFO, "bdb: mounting database %02x", i);
ret = db_create(&bdb_table[i], bdb_env, 0); // Create a database handle
if (ret) {
syslog(LOG_ERR, "bdb: db_create: %s", db_strerror(ret));
// close the tables
syslog(LOG_INFO, "bdb: closing databases");
for (i = 0; i < MAXCDB; ++i) {
- syslog(LOG_INFO, "bdb: closing database %02x", i);
ret = bdb_table[i]->close(bdb_table[i], 0);
if (ret) {
syslog(LOG_ERR, "bdb: db_close: %s", db_strerror(ret));
destLen = (uLongf) zheader.uncompressed_len;
uncompressed_data = malloc(zheader.uncompressed_len);
- if (uncompress((Bytef *) uncompressed_data,
- (uLongf *) &destLen, (const Bytef *) compressed_data, (uLong) sourceLen) != Z_OK) {
+ if (uncompress((Bytef *) uncompressed_data, (uLongf *) &destLen, (const Bytef *) compressed_data, (uLong) sourceLen) != Z_OK) {
syslog(LOG_ERR, "bdb: uncompress() error");
bdb_abort();
}
}
}
+
// Calling this function activates the Berkeley DB back end.
void bdb_init_backend(void) {
cdb_tick = bdb_tick;
// Some functions in this backend need to store some per-thread data.
- // We crerate the key here, during module initialization.
+ // We create the key here, during module initialization.
if (pthread_key_create(&bdb_thread_key, NULL) != 0) {
syslog(LOG_ERR, "pthread_key_create() : %m");
exit(CTDLEXIT_THREAD);