ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++">

db_value_set


#include <db.h>

int db_value_set(int value, int which);

Description

The db_value_set function enables applications to specify the behavior of underlying Berkeley DB library functionality. The which argument specifies the information being set by the argument value.

The following values of which are supported:

DB_MUTEXLOCKS
Setting value to a zero value causes Berkeley DB to grant all requested mutual exclusion mutexes without testing for their availability. This flag should never be used for any other purpose than debugging.

DB_REGION_ANON
Setting value to a non-zero value specifies that shared memory regions are to be created in anonymous memory, and not backed by a regular file. DB_REGION_NAME differs from DB_REGION_ANON in that the former will fail if the shared memory regions cannot be named, that is, if multiple processes cannot use them. See DB_FUNC_MAP for more information.

DB_REGION_INIT
In some applications, the expense of page-faulting the shared memory regions can affect performance, e.g., when the page-fault occurs while holding a lock, other lock requests can convoy and overall throughput may decrease. Setting value to a non-zero value specifies that one byte be written to each 4K page of the shared memory region when the region is initialized.

In addition, as a byte is written to each page, the underlying virtual memory and file systems are forced to instantiate both the necessary memory and the necessary disk space. This is useful in order to avoid out-of-disk space failures later on.

DB_REGION_NAME
Setting value to a non-zero value specifies that shared memory regions are to be created in anonymous memory, and not backed by a regular file. DB_REGION_NAME differs from DB_REGION_ANON in that the former will fail if the shared memory regions cannot be named, that is, if multiple processes cannot use them. See DB_FUNC_MAP for more information.

DB_TSL_SPINS
Specify the number of times mutexes should spin without blocking.

This value defaults to 1 on uniprocessor systems and to 50 times the number of processors on multiprocessor systems.]

The db_value_set function returns the value of errno on failure, and 0 on success.

Errors

If a fatal error occurs in Berkeley DB, the db_value_set function may fail and return DB_RUNRECOVERY, at which point all subsequent database calls will also return DB_RUNRECOVERY.

EINVAL
An invalid flag value or parameter was specified.

See Also

db_jump_set