DB->set_paniccall

APIRef

#include <db.h>

int DB->set_paniccall(DB *db, void (*paniccall)(DB_ENV *, int errval));

Description

Errors can occur in the Berkeley DB library where the only solution is to shut down the application and run recovery (for example, if Berkeley DB is unable to allocate heap memory). In these cases, the value DB_RUNRECOVERY is returned by Berkeley DB.

In these cases, it is also often simpler to shut down the application when such errors occur rather than to try to gracefully return up the stack. The DB_ENV->set_paniccall and DB->set_paniccall functions are used to specify functions to be called when DB_RUNRECOVERY is about to be returned from a Berkeley DB interface. When called, the dbenv argument will be a reference to the current environment, and the errval argument is the error value that would have been returned to the calling function.

For DB handles opened inside of Berkeley DB environments, calling the DB->set_paniccall function affects the entire environment and is equivalent to calling the DB_ENV->set_paniccall function.

The DB->set_paniccall interface may be used to configure Berkeley DB at any time during the life of the application.

The DB->set_paniccall function returns a non-zero error value on failure and 0 on success.

See Also

db_create, DB->associate, DB->close, DB->cursor, DB->del, DB->err, DB->errx DB->fd, DB->get, DB->pget, DB->get_byteswapped, DB->get_type, DB->join, DB->key_range, DB->open, DB->put, DB->remove, DB->rename, DB->set_alloc, DB->set_append_recno, DB->set_bt_compare, DB->set_bt_minkey, DB->set_bt_prefix, DB->set_cachesize, DB->set_dup_compare, DB->set_errcall, DB->set_errfile, DB->set_errpfx, DB->set_feedback, DB->set_flags, DB->set_h_ffactor, DB->set_h_hash, DB->set_h_nelem, DB->set_lorder, DB->set_pagesize, DB->set_paniccall, DB->set_q_extentsize, DB->set_re_delim, DB->set_re_len, DB->set_re_pad, DB->set_re_source, DB->stat, DB->sync, DB->truncate, DB->upgrade, and DB->verify.

APIRef

Copyright Sleepycat Software