diff options
Diffstat (limited to 'db/common/db_err.c')
-rw-r--r-- | db/common/db_err.c | 516 |
1 files changed, 363 insertions, 153 deletions
diff --git a/db/common/db_err.c b/db/common/db_err.c index 6e49e7941..0c11148b9 100644 --- a/db/common/db_err.c +++ b/db/common/db_err.c @@ -1,27 +1,20 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1996-2004 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1996-2006 + * Oracle Corporation. All rights reserved. * - * $Id: db_err.c,v 11.123 2004/09/22 03:07:50 bostic Exp $ + * $Id: db_err.c,v 12.44 2006/09/13 14:53:34 mjc Exp $ */ #include "db_config.h" -#ifndef NO_SYSTEM_INCLUDES -#include <sys/types.h> - -#include <stdlib.h> -#include <string.h> -#endif - #include "db_int.h" #include "dbinc/db_page.h" #include "dbinc/db_am.h" -#include "dbinc/db_shash.h" #include "dbinc/lock.h" #include "dbinc/log.h" +#include "dbinc/mp.h" #include "dbinc/txn.h" static void __db_msgcall __P((const DB_ENV *, const char *, va_list)); @@ -71,7 +64,7 @@ __db_ferr(dbenv, name, iscombo) const char *name; int iscombo; { - __db_err(dbenv, "illegal flag %sspecified to %s", + __db_errx(dbenv, "illegal flag %sspecified to %s", iscombo ? "combination " : "", name); return (EINVAL); } @@ -87,8 +80,8 @@ __db_fnl(dbenv, name) const DB_ENV *dbenv; const char *name; { - __db_err(dbenv, - "%s: the DB_DIRTY_READ, DB_DEGREE_2 and DB_RMW flags require locking", + __db_errx(dbenv, + "%s: DB_READ_COMMITTED, DB_READ_UNCOMMITTED and DB_RMW require locking", name); return (EINVAL); } @@ -110,7 +103,7 @@ __db_pgerr(dbp, pgno, errval) * Death, taxes, and lost data. * Guess which has occurred. */ - __db_err(dbp->dbenv, + __db_errx(dbp->dbenv, "unable to create/retrieve page %lu", (u_long)pgno); return (__db_panic(dbp->dbenv, errval)); } @@ -126,7 +119,7 @@ __db_pgfmt(dbenv, pgno) DB_ENV *dbenv; db_pgno_t pgno; { - __db_err(dbenv, "page %lu: illegal page type or format", (u_long)pgno); + __db_errx(dbenv, "page %lu: illegal page type or format", (u_long)pgno); return (__db_panic(dbenv, EINVAL)); } @@ -136,22 +129,18 @@ __db_pgfmt(dbenv, pgno) * Error when an assertion fails. Only checked if #DIAGNOSTIC defined. * * PUBLIC: #ifdef DIAGNOSTIC - * PUBLIC: void __db_assert __P((const char *, const char *, int)); + * PUBLIC: void __db_assert __P((DB_ENV *, const char *, const char *, int)); * PUBLIC: #endif */ void -__db_assert(failedexpr, file, line) - const char *failedexpr, *file; +__db_assert(dbenv, e, file, line) + DB_ENV *dbenv; + const char *e, *file; int line; { - (void)fprintf(stderr, - "__db_assert: \"%s\" failed: file \"%s\", line %d\n", - failedexpr, file, line); - (void)fflush(stderr); + __db_errx(dbenv, "assert failure: %s/%d: \"%s\"", file, line, e); - /* We want a stack trace of how this could possibly happen. */ abort(); - /* NOTREACHED */ } #endif @@ -166,12 +155,17 @@ int __db_panic_msg(dbenv) DB_ENV *dbenv; { - __db_err(dbenv, "PANIC: fatal region error detected; run recovery"); + int ret; - if (dbenv->db_paniccall != NULL) - dbenv->db_paniccall(dbenv, DB_RUNRECOVERY); + ret = DB_RUNRECOVERY; - return (DB_RUNRECOVERY); + __db_errx(dbenv, "PANIC: fatal region error detected; run recovery"); + + if (dbenv->db_paniccall != NULL) /* Deprecated */ + dbenv->db_paniccall(dbenv, ret); + DB_EVENT(dbenv, DB_EVENT_PANIC, &ret); + + return (ret); } /* @@ -186,12 +180,13 @@ __db_panic(dbenv, errval) int errval; { if (dbenv != NULL) { - PANIC_SET(dbenv, 1); + __db_panic_set(dbenv, 1); - __db_err(dbenv, "PANIC: %s", db_strerror(errval)); + __db_err(dbenv, errval, "PANIC"); - if (dbenv->db_paniccall != NULL) + if (dbenv->db_paniccall != NULL) /* Deprecated */ dbenv->db_paniccall(dbenv, errval); + DB_EVENT(dbenv, DB_EVENT_PANIC, &errval); } #if defined(DIAGNOSTIC) && !defined(CONFIG_TEST) @@ -203,6 +198,7 @@ __db_panic(dbenv, errval) * under certain conditions. */ abort(); + /* NOTREACHED */ #endif /* @@ -214,6 +210,22 @@ __db_panic(dbenv, errval) } /* + * __db_panic_set -- + * Set/clear unrecoverable error. + * + * PUBLIC: void __db_panic_set __P((DB_ENV *, int)); + */ +void +__db_panic_set(dbenv, on) + DB_ENV *dbenv; + int on; +{ + if (dbenv != NULL && dbenv->reginfo != NULL) + ((REGENV *) + ((REGINFO *)dbenv->reginfo)->primary)->panic = on ? 1 : 0; +} + +/* * db_strerror -- * ANSI C strerror(3) for DB. * @@ -230,7 +242,7 @@ db_strerror(error) if (error > 0) { if ((p = strerror(error)) != NULL) return (p); - goto unknown_err; + return (__db_unknown_error(error)); } /* @@ -275,17 +287,22 @@ db_strerror(error) return ("DB_REP_HANDLE_DEAD: Handle is no longer valid"); case DB_REP_HOLDELECTION: return ("DB_REP_HOLDELECTION: Need to hold an election"); + case DB_REP_IGNORE: + return ("DB_REP_IGNORE: Replication record ignored"); case DB_REP_ISPERM: return ("DB_REP_ISPERM: Permanent record written"); + case DB_REP_JOIN_FAILURE: + return + ("DB_REP_JOIN_FAILURE: Unable to join replication group"); + case DB_REP_LOCKOUT: + return + ("DB_REP_LOCKOUT: Waiting for replication recovery to complete"); case DB_REP_NEWMASTER: return ("DB_REP_NEWMASTER: A new master has declared itself"); case DB_REP_NEWSITE: return ("DB_REP_NEWSITE: A new site has entered the system"); case DB_REP_NOTPERM: return ("DB_REP_NOTPERM: Permanent log record not written"); - case DB_REP_STARTUPDONE: - return - ("DB_REP_STARTUPDONE: Client completed startup synchronization."); case DB_REP_UNAVAIL: return ("DB_REP_UNAVAIL: Unable to elect a master"); case DB_RUNRECOVERY: @@ -302,39 +319,99 @@ db_strerror(error) break; } -unknown_err: { - /* - * !!! - * Room for a 64-bit number + slop. This buffer is only used - * if we're given an unknown error, which should never happen. - * Note, however, we're no longer thread-safe if it does. - */ - static char ebuf[40]; + return (__db_unknown_error(error)); +} - (void)snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", error); - return (ebuf); - } +/* + * __db_unknown_error -- + * Format an unknown error value into a static buffer. + * + * PUBLIC: char *__db_unknown_error __P((int)); + */ +char * +__db_unknown_error(error) + int error; +{ + /* + * !!! + * Room for a 64-bit number + slop. This buffer is only used + * if we're given an unknown error number, which should never + * happen. + * + * We're no longer thread-safe if it does happen, but the worst + * result is a corrupted error string because there will always + * be a trailing nul byte since the error buffer is nul filled + * and longer than any error message. + */ + static char ebuf[40]; + + (void)snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", error); + return (ebuf); +} + +/* + * __db_syserr -- + * Standard DB system-specific error routine. The same as __db_err except + * we use a system-specific function to translate errors to strings. + * + * PUBLIC: void __db_syserr __P((const DB_ENV *, int, const char *, ...)) + * PUBLIC: __attribute__ ((__format__ (__printf__, 3, 4))); + */ +void +#ifdef STDC_HEADERS +__db_syserr(const DB_ENV *dbenv, int error, const char *fmt, ...) +#else +__db_syserr(dbenv, error fmt, va_alist) + const DB_ENV *dbenv; + int error; + const char *fmt; + va_dcl +#endif +{ + DB_REAL_ERR(dbenv, error, DB_ERROR_SYSTEM, 0, fmt); } /* * __db_err -- - * Standard DB error routine. The same as errx, except we don't write + * Standard DB error routine. The same as DB->err, except we don't write * to stderr if no output mechanism was specified. * - * PUBLIC: void __db_err __P((const DB_ENV *, const char *, ...)) + * PUBLIC: void __db_err __P((const DB_ENV *, int, const char *, ...)) + * PUBLIC: __attribute__ ((__format__ (__printf__, 3, 4))); + */ +void +#ifdef STDC_HEADERS +__db_err(const DB_ENV *dbenv, int error, const char *fmt, ...) +#else +__db_err(dbenv, error fmt, va_alist) + const DB_ENV *dbenv; + int error; + const char *fmt; + va_dcl +#endif +{ + DB_REAL_ERR(dbenv, error, DB_ERROR_SET, 0, fmt); +} + +/* + * __db_errx -- + * Standard DB error routine. The same as DB->errx, except we don't write + * to stderr if no output mechanism was specified. + * + * PUBLIC: void __db_errx __P((const DB_ENV *, const char *, ...)) * PUBLIC: __attribute__ ((__format__ (__printf__, 2, 3))); */ void #ifdef STDC_HEADERS -__db_err(const DB_ENV *dbenv, const char *fmt, ...) +__db_errx(const DB_ENV *dbenv, const char *fmt, ...) #else -__db_err(dbenv, fmt, va_alist) +__db_errx(dbenv, fmt, va_alist) const DB_ENV *dbenv; const char *fmt; va_dcl #endif { - DB_REAL_ERR(dbenv, 0, 0, 0, fmt); + DB_REAL_ERR(dbenv, 0, DB_ERROR_NOT_SET, 0, fmt); } /* @@ -342,25 +419,28 @@ __db_err(dbenv, fmt, va_alist) * Do the error message work for callback functions. * * PUBLIC: void __db_errcall - * PUBLIC: __P((const DB_ENV *, int, int, const char *, va_list)); + * PUBLIC: __P((const DB_ENV *, int, db_error_set_t, const char *, va_list)); */ void __db_errcall(dbenv, error, error_set, fmt, ap) const DB_ENV *dbenv; - int error, error_set; + int error; + db_error_set_t error_set; const char *fmt; va_list ap; { char *p; char buf[2048]; /* !!!: END OF THE STACK DON'T TRUST SPRINTF. */ + char sysbuf[1024]; /* !!!: END OF THE STACK DON'T TRUST SPRINTF. */ p = buf; if (fmt != NULL) p += vsnprintf(buf, sizeof(buf), fmt, ap); - if (error_set) + if (error_set != DB_ERROR_NOT_SET) p += snprintf(p, sizeof(buf) - (size_t)(p - buf), ": %s", - db_strerror(error)); + error_set == DB_ERROR_SET ? db_strerror(error) : + __os_strerror(error, sysbuf, sizeof(sysbuf))); dbenv->db_errcall(dbenv, dbenv->db_errpfx, buf); } @@ -370,16 +450,18 @@ __db_errcall(dbenv, error, error_set, fmt, ap) * Do the error message work for FILE *s. * * PUBLIC: void __db_errfile - * PUBLIC: __P((const DB_ENV *, int, int, const char *, va_list)); + * PUBLIC: __P((const DB_ENV *, int, db_error_set_t, const char *, va_list)); */ void __db_errfile(dbenv, error, error_set, fmt, ap) const DB_ENV *dbenv; - int error, error_set; + int error; + db_error_set_t error_set; const char *fmt; va_list ap; { FILE *fp; + char sysbuf[1024]; /* !!!: END OF THE STACK DON'T TRUST SPRINTF. */ fp = dbenv == NULL || dbenv->db_errfile == NULL ? stderr : dbenv->db_errfile; @@ -388,11 +470,13 @@ __db_errfile(dbenv, error, error_set, fmt, ap) (void)fprintf(fp, "%s: ", dbenv->db_errpfx); if (fmt != NULL) { (void)vfprintf(fp, fmt, ap); - if (error_set) + if (error_set != DB_ERROR_NOT_SET) (void)fprintf(fp, ": "); } - if (error_set) - (void)fprintf(fp, "%s", db_strerror(error)); + if (error_set != DB_ERROR_NOT_SET) + (void)fprintf(fp, "%s", + error_set == DB_ERROR_SET ? db_strerror(error) : + __os_strerror(error, sysbuf, sizeof(sysbuf))); (void)fprintf(fp, "\n"); (void)fflush(fp); } @@ -503,89 +587,63 @@ __db_msgfile(dbenv, fmt, ap) } /* - * __db_logmsg -- - * Write information into the DB log. + * __db_unknown_flag -- report internal error * - * PUBLIC: void __db_logmsg __P((const DB_ENV *, - * PUBLIC: DB_TXN *, const char *, u_int32_t, const char *, ...)) - * PUBLIC: __attribute__ ((__format__ (__printf__, 5, 6))); + * PUBLIC: int __db_unknown_flag __P((DB_ENV *, char *, u_int32_t)); */ -void -#ifdef STDC_HEADERS -__db_logmsg(const DB_ENV *dbenv, - DB_TXN *txnid, const char *opname, u_int32_t flags, const char *fmt, ...) -#else -__db_logmsg(dbenv, txnid, opname, flags, fmt, va_alist) - const DB_ENV *dbenv; - DB_TXN *txnid; - const char *opname, *fmt; - u_int32_t flags; - va_dcl -#endif +int +__db_unknown_flag(dbenv, routine, flag) + DB_ENV *dbenv; + char *routine; + u_int32_t flag; { - DBT opdbt, msgdbt; - DB_LSN lsn; - va_list ap; - char __logbuf[2048]; /* !!!: END OF THE STACK DON'T TRUST SPRINTF. */ - - if (!LOGGING_ON(dbenv)) - return; + __db_errx(dbenv, "%s: Unknown flag: %#x", routine, (u_int)flag); -#ifdef STDC_HEADERS - va_start(ap, fmt); -#else - va_start(ap); +#ifdef DIAGNOSTIC + abort(); + /* NOTREACHED */ #endif - memset(&opdbt, 0, sizeof(opdbt)); - opdbt.data = (void *)opname; - opdbt.size = (u_int32_t)(strlen(opname) + 1); - - memset(&msgdbt, 0, sizeof(msgdbt)); - msgdbt.data = __logbuf; - msgdbt.size = (u_int32_t)vsnprintf(__logbuf, sizeof(__logbuf), fmt, ap); - - va_end(ap); - - /* - * XXX - * Explicitly discard the const. Otherwise, we have to const DB_ENV - * references throughout the logging subsystem. - */ - (void)__db_debug_log( - (DB_ENV *)dbenv, txnid, &lsn, flags, &opdbt, -1, &msgdbt, NULL, 0); + return (EINVAL); } /* - * __db_unknown_flag -- report internal error + * __db_unknown_type -- report internal database type error * - * PUBLIC: int __db_unknown_flag __P((DB_ENV *, char *, u_int32_t)); + * PUBLIC: int __db_unknown_type __P((DB_ENV *, char *, DBTYPE)); */ int -__db_unknown_flag(dbenv, routine, flag) +__db_unknown_type(dbenv, routine, type) DB_ENV *dbenv; char *routine; - u_int32_t flag; + DBTYPE type; { - __db_err(dbenv, "%s: Unknown flag: %#x", routine, (u_int)flag); - DB_ASSERT(0); + __db_errx(dbenv, + "%s: Unexpected database type: %s", + routine, __db_dbtype_to_string(type)); + +#ifdef DIAGNOSTIC + abort(); + /* NOTREACHED */ +#endif return (EINVAL); } /* - * __db_unknown_type -- report internal error + * __db_unknown_path -- report unexpected database code path error. * - * PUBLIC: int __db_unknown_type __P((DB_ENV *, char *, DBTYPE)); + * PUBLIC: int __db_unknown_path __P((DB_ENV *, char *)); */ int -__db_unknown_type(dbenv, routine, type) +__db_unknown_path(dbenv, routine) DB_ENV *dbenv; char *routine; - DBTYPE type; { - __db_err(dbenv, - "%s: Unexpected DB type: %s", routine, __db_dbtype_to_string(type)); + __db_errx(dbenv, "%s: Unexpected code path error", routine); - DB_ASSERT(0); +#ifdef DIAGNOSTIC + abort(); + /* NOTREACHED */ +#endif return (EINVAL); } @@ -620,46 +678,49 @@ __db_check_txn(dbp, txn, assoc_lid, read_op) /* * Check for common transaction errors: - * Failure to pass a transaction handle to a DB operation - * Failure to configure the DB handle in a proper environment - * Operation on a handle whose open commit hasn't completed. - * - * Read operations don't require a txn even if we've used one before - * with this handle, although if they do have a txn, we'd better be - * prepared for it. + * an operation on a handle whose open commit hasn't completed. + * a transaction handle in a non-transactional environment + * a transaction handle for a non-transactional database */ - if (txn == NULL) { + if (txn == NULL || F_ISSET(txn, TXN_PRIVATE)) { + if (dbp->cur_lid >= TXN_MINIMUM) + goto open_err; + if (!read_op && F_ISSET(dbp, DB_AM_TXN)) { - __db_err(dbenv, - "DB handle previously used in transaction, missing transaction handle"); + __db_errx(dbenv, + "Transaction not specified for a transactional database"); return (EINVAL); } - - if (dbp->cur_lid >= TXN_MINIMUM) - goto open_err; + } else if (F_ISSET(txn, TXN_CDSGROUP)) { + if (!CDB_LOCKING(dbenv)) { + __db_errx(dbenv, + "CDS groups can only be used in a CDS environment"); + return (EINVAL); + } + /* + * CDS group handles can be passed to any method, since they + * only determine locker IDs. + */ + return (0); } else { - if (F_ISSET(txn, TXN_DEADLOCK)) { - __db_err(dbenv, - "Previous deadlock return not resolved"); + if (!TXN_ON(dbenv)) + return (__db_not_txn_env(dbenv)); + + if (!F_ISSET(dbp, DB_AM_TXN)) { + __db_errx(dbenv, + "Transaction specified for a non-transactional database"); return (EINVAL); } - if (dbp->cur_lid >= TXN_MINIMUM && - dbp->cur_lid != txn->txnid) { + + if (F_ISSET(txn, TXN_DEADLOCK)) + return (__db_txn_deadlock_err(dbenv)); + if (dbp->cur_lid >= TXN_MINIMUM && dbp->cur_lid != txn->txnid) { if ((ret = __lock_locker_is_parent(dbenv, dbp->cur_lid, txn->txnid, &isp)) != 0) return (ret); if (!isp) goto open_err; } - - if (!TXN_ON(dbenv)) - return (__db_not_txn_env(dbenv)); - - if (!F_ISSET(dbp, DB_AM_TXN)) { - __db_err(dbenv, - "Transaction specified for a DB handle opened outside a transaction"); - return (EINVAL); - } } /* @@ -679,19 +740,42 @@ __db_check_txn(dbp, txn, assoc_lid, read_op) */ if (!read_op && dbp->associate_lid != DB_LOCK_INVALIDID && txn != NULL && dbp->associate_lid != assoc_lid) { - __db_err(dbenv, + __db_errx(dbenv, "Operation forbidden while secondary index is being created"); return (EINVAL); } + /* + * Check the txn and dbp are from the same env. + */ + if (txn != NULL && dbenv != txn->mgrp->dbenv) { + __db_errx(dbenv, + "Transaction and database from different environments"); + return (EINVAL); + } + return (0); open_err: - __db_err(dbenv, + __db_errx(dbenv, "Transaction that opened the DB handle is still active"); return (EINVAL); } /* + * __db_txn_deadlock_err -- + * Transaction has allready been deadlocked. + * + * PUBLIC: int __db_txn_deadlock_err __P((DB_ENV *)); + */ +int +__db_txn_deadlock_err(dbenv) + DB_ENV *dbenv; +{ + __db_errx(dbenv, "Previous deadlock return not resolved"); + return (EINVAL); +} + +/* * __db_not_txn_env -- * DB handle must be in an environment that supports transactions. * @@ -701,7 +785,7 @@ int __db_not_txn_env(dbenv) DB_ENV *dbenv; { - __db_err(dbenv, "DB environment not configured for transactions"); + __db_errx(dbenv, "DB environment not configured for transactions"); return (EINVAL); } @@ -716,8 +800,9 @@ __db_rec_toobig(dbenv, data_len, fixed_rec_len) DB_ENV *dbenv; u_int32_t data_len, fixed_rec_len; { - __db_err(dbenv, "%s: length of %lu larger than database's value of %lu", - "Record length error", (u_long)data_len, (u_long)fixed_rec_len); + __db_errx(dbenv, + "%lu larger than database's maximum record length %lu", + (u_long)data_len, (u_long)fixed_rec_len); return (EINVAL); } @@ -732,12 +817,87 @@ __db_rec_repl(dbenv, data_size, data_dlen) DB_ENV *dbenv; u_int32_t data_size, data_dlen; { - __db_err(dbenv, + __db_errx(dbenv, "%s: replacement length %lu differs from replaced length %lu", "Record length error", (u_long)data_size, (u_long)data_dlen); return (EINVAL); } +#if defined(DIAGNOSTIC) || defined(DEBUG_ROP) || defined(DEBUG_WOP) +/* + * __dbc_logging -- + * In DIAGNOSTIC mode, check for bad replication combinations. + * + * PUBLIC: int __dbc_logging __P((DBC *)); + */ +int +__dbc_logging(dbc) + DBC *dbc; +{ + DB_ENV *dbenv; + DB_REP *db_rep; + int ret; + + dbenv = dbc->dbp->dbenv; + db_rep = dbenv->rep_handle; + + ret = LOGGING_ON(dbenv) && + !F_ISSET(dbc, DBC_RECOVER) && !IS_REP_CLIENT(dbenv); + + /* + * If we're not using replication or running recovery, return. + */ + if (db_rep == NULL || F_ISSET(dbc, DBC_RECOVER)) + return (ret); + +#ifndef DEBUG_ROP + /* + * Only check when DEBUG_ROP is not configured. People often do + * non-transactional reads, and debug_rop is going to write + * a log record. + */ + { + REP *rep; + + rep = db_rep->region; + + /* + * If we're a client and not running recovery or internally, error. + */ + if (IS_REP_CLIENT(dbenv) && + !F_ISSET(dbc->dbp, DB_AM_CL_WRITER) && + !F_ISSET(dbc->dbp, DB_AM_NOT_DURABLE)) { + __db_errx(dbenv, "Dbc_logging: Client update"); + goto err; + } + +#ifndef DEBUG_WOP + /* + * If DEBUG_WOP is enabled, then we'll generate debugging log records + * that are non-transactional. This is OK. + */ + if (IS_REP_MASTER(dbenv) && + dbc->txn == NULL && !F_ISSET(dbc->dbp, DB_AM_NOT_DURABLE)) { + __db_errx(dbenv, "Dbc_logging: Master non-txn update"); + goto err; + } +#endif + + if (0) { +err: __db_errx(dbenv, "Rep: flags 0x%lx msg_th %lu, lockout_th %d", + (u_long)rep->flags, (u_long)rep->msg_th, rep->lockout_th); + __db_errx(dbenv, "Rep: handle %lu, opcnt %lu, in_rec %d", + (u_long)rep->handle_cnt, (u_long)rep->op_cnt, + rep->in_recovery); + abort(); + /* NOTREACHED */ + } + } +#endif + return (ret); +} +#endif + /* * __db_check_lsn -- * Display the log sequence error message. @@ -749,9 +909,59 @@ __db_check_lsn(dbenv, lsn, prev) DB_ENV *dbenv; DB_LSN *lsn, *prev; { - __db_err(dbenv, + __db_errx(dbenv, "Log sequence error: page LSN %lu %lu; previous LSN %lu %lu", (u_long)(lsn)->file, (u_long)(lsn)->offset, (u_long)(prev)->file, (u_long)(prev)->offset); return (EINVAL); } + +/* + * __db_rdonly -- + * Common readonly message. + * PUBLIC: int __db_rdonly __P((const DB_ENV *, const char *)); + */ +int +__db_rdonly(dbenv, name) + const DB_ENV *dbenv; + const char *name; +{ + __db_errx(dbenv, "%s: attempt to modify a read-only database", name); + return (EACCES); +} + +/* + * __db_space_err -- + * Common out of space message. + * PUBLIC: int __db_space_err __P((const DB *)); + */ +int +__db_space_err(dbp) + const DB *dbp; +{ + __db_errx(dbp->dbenv, + "%s: file limited to %lu pages", + dbp->fname, (u_long)dbp->mpf->mfp->maxpgno); + return (ENOSPC); +} + +/* + * __db_failed -- + * Common failed thread message. + * + * PUBLIC: int __db_failed __P((const DB_ENV *, + * PUBLIC: const char *, pid_t, db_threadid_t)); + */ +int +__db_failed(dbenv, msg, pid, tid) + const DB_ENV *dbenv; + const char *msg; + pid_t pid; + db_threadid_t tid; +{ + char buf[DB_THREADID_STRLEN]; + + __db_errx(dbenv, "Thread/process %s failed: %s", + dbenv->thread_id_string((DB_ENV*)dbenv, pid, tid, buf), msg); + return (DB_RUNRECOVERY); +} |