UMEM_SETMTBF(3MALLOC) Memory Allocation Library Functions UMEM_SETMTBF(3MALLOC)

umem_setmtbfset umem failure threshold

Object-Caching Memory Allocation Library (libumem, -lumem
#include <umem.h>

void
umem_setmtbf(uint_t thresh);

The () function can be used to modify the run-time behavior of the libumem(3LIB) library to set a threshold to cause injected memory allocation failures.

By default, no failures are injected. When a non-zero value is passed in thresh then error injection is enabled, if the umem debugging features described in umem_debug(3MALLOC) are enabled through the UMEM_DEBUG environment variable. If a process has not enabled the debugging functionality of libumem(3LIB) then no errors will be injected, no matter what thresh is set to.

Passing the value disables error injection. To cause every allocation to fail, pass the value . The larger the value passed, the more time that will pass between error injections. Currently, an error is injected if the current time in nanoseconds since boot modulus the mtbf is zero. Concretely:

if (gethrtime() % thresh) == 0) {
	<inject error>
}

This mechanism is not guaranteed over time; however, the meanings of a threshold of zero, one, and the general tendency of larger numbers to indicate less errors is.

libumem(3LIB), umem_debug(3MALLOC)

February 23, 2020 OmniOS