diff options
author | bugaevskiy <bugaevskiy@yandex-team.ru> | 2022-02-10 16:46:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:17 +0300 |
commit | a6e0145a095c7bb3770d6e07aee301de5c73f96e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/jemalloc/src/witness.c | |
parent | c7f68570483e493f4ddaf946de7b3a420ee621b0 (diff) | |
download | ydb-a6e0145a095c7bb3770d6e07aee301de5c73f96e.tar.gz |
Restoring authorship annotation for <bugaevskiy@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/jemalloc/src/witness.c')
-rw-r--r-- | contrib/libs/jemalloc/src/witness.c | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/contrib/libs/jemalloc/src/witness.c b/contrib/libs/jemalloc/src/witness.c index 80722002c0..f42b72ad1a 100644 --- a/contrib/libs/jemalloc/src/witness.c +++ b/contrib/libs/jemalloc/src/witness.c @@ -1,100 +1,100 @@ -#define JEMALLOC_WITNESS_C_ -#include "jemalloc/internal/jemalloc_preamble.h" -#include "jemalloc/internal/jemalloc_internal_includes.h" - -#include "jemalloc/internal/assert.h" -#include "jemalloc/internal/malloc_io.h" - -void -witness_init(witness_t *witness, const char *name, witness_rank_t rank, - witness_comp_t *comp, void *opaque) { - witness->name = name; - witness->rank = rank; - witness->comp = comp; - witness->opaque = opaque; -} - -static void -witness_lock_error_impl(const witness_list_t *witnesses, - const witness_t *witness) { - witness_t *w; - - malloc_printf("<jemalloc>: Lock rank order reversal:"); - ql_foreach(w, witnesses, link) { - malloc_printf(" %s(%u)", w->name, w->rank); - } - malloc_printf(" %s(%u)\n", witness->name, witness->rank); - abort(); -} -witness_lock_error_t *JET_MUTABLE witness_lock_error = witness_lock_error_impl; - -static void -witness_owner_error_impl(const witness_t *witness) { - malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name, - witness->rank); - abort(); -} -witness_owner_error_t *JET_MUTABLE witness_owner_error = - witness_owner_error_impl; - -static void -witness_not_owner_error_impl(const witness_t *witness) { - malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name, - witness->rank); - abort(); -} -witness_not_owner_error_t *JET_MUTABLE witness_not_owner_error = - witness_not_owner_error_impl; - -static void -witness_depth_error_impl(const witness_list_t *witnesses, - witness_rank_t rank_inclusive, unsigned depth) { - witness_t *w; - - malloc_printf("<jemalloc>: Should own %u lock%s of rank >= %u:", depth, - (depth != 1) ? "s" : "", rank_inclusive); - ql_foreach(w, witnesses, link) { - malloc_printf(" %s(%u)", w->name, w->rank); - } - malloc_printf("\n"); - abort(); -} -witness_depth_error_t *JET_MUTABLE witness_depth_error = - witness_depth_error_impl; - -void -witnesses_cleanup(witness_tsd_t *witness_tsd) { - witness_assert_lockless(witness_tsd_tsdn(witness_tsd)); - - /* Do nothing. */ -} - -void -witness_prefork(witness_tsd_t *witness_tsd) { - if (!config_debug) { - return; - } - witness_tsd->forking = true; -} - -void -witness_postfork_parent(witness_tsd_t *witness_tsd) { - if (!config_debug) { - return; - } - witness_tsd->forking = false; -} - -void -witness_postfork_child(witness_tsd_t *witness_tsd) { - if (!config_debug) { - return; - } -#ifndef JEMALLOC_MUTEX_INIT_CB - witness_list_t *witnesses; - - witnesses = &witness_tsd->witnesses; - ql_new(witnesses); -#endif - witness_tsd->forking = false; -} +#define JEMALLOC_WITNESS_C_ +#include "jemalloc/internal/jemalloc_preamble.h" +#include "jemalloc/internal/jemalloc_internal_includes.h" + +#include "jemalloc/internal/assert.h" +#include "jemalloc/internal/malloc_io.h" + +void +witness_init(witness_t *witness, const char *name, witness_rank_t rank, + witness_comp_t *comp, void *opaque) { + witness->name = name; + witness->rank = rank; + witness->comp = comp; + witness->opaque = opaque; +} + +static void +witness_lock_error_impl(const witness_list_t *witnesses, + const witness_t *witness) { + witness_t *w; + + malloc_printf("<jemalloc>: Lock rank order reversal:"); + ql_foreach(w, witnesses, link) { + malloc_printf(" %s(%u)", w->name, w->rank); + } + malloc_printf(" %s(%u)\n", witness->name, witness->rank); + abort(); +} +witness_lock_error_t *JET_MUTABLE witness_lock_error = witness_lock_error_impl; + +static void +witness_owner_error_impl(const witness_t *witness) { + malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name, + witness->rank); + abort(); +} +witness_owner_error_t *JET_MUTABLE witness_owner_error = + witness_owner_error_impl; + +static void +witness_not_owner_error_impl(const witness_t *witness) { + malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name, + witness->rank); + abort(); +} +witness_not_owner_error_t *JET_MUTABLE witness_not_owner_error = + witness_not_owner_error_impl; + +static void +witness_depth_error_impl(const witness_list_t *witnesses, + witness_rank_t rank_inclusive, unsigned depth) { + witness_t *w; + + malloc_printf("<jemalloc>: Should own %u lock%s of rank >= %u:", depth, + (depth != 1) ? "s" : "", rank_inclusive); + ql_foreach(w, witnesses, link) { + malloc_printf(" %s(%u)", w->name, w->rank); + } + malloc_printf("\n"); + abort(); +} +witness_depth_error_t *JET_MUTABLE witness_depth_error = + witness_depth_error_impl; + +void +witnesses_cleanup(witness_tsd_t *witness_tsd) { + witness_assert_lockless(witness_tsd_tsdn(witness_tsd)); + + /* Do nothing. */ +} + +void +witness_prefork(witness_tsd_t *witness_tsd) { + if (!config_debug) { + return; + } + witness_tsd->forking = true; +} + +void +witness_postfork_parent(witness_tsd_t *witness_tsd) { + if (!config_debug) { + return; + } + witness_tsd->forking = false; +} + +void +witness_postfork_child(witness_tsd_t *witness_tsd) { + if (!config_debug) { + return; + } +#ifndef JEMALLOC_MUTEX_INIT_CB + witness_list_t *witnesses; + + witnesses = &witness_tsd->witnesses; + ql_new(witnesses); +#endif + witness_tsd->forking = false; +} |