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

NAME


umem_setmtbf - set umem failure threshold

SYNOPSIS


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

void
umem_setmtbf(uint_t thresh);

DESCRIPTION


The umem_setmtbf() 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 0 disables error injection. To cause every allocation to
fail, pass the value 1. 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.

MT-LEVEL
Unsafe

INTERFACE STABILITY


Uncommitted

SEE ALSO


libumem(3LIB), umem_debug(3MALLOC)

illumos February 23, 2020 illumos