ircd: Properly scope various visibility/linkages.

This commit is contained in:
Jason Volk 2022-06-13 15:08:16 -07:00
parent 16cae91875
commit df3304005a
7 changed files with 20 additions and 18 deletions

View File

@ -21,17 +21,17 @@ extern "C" void (*__free_hook)(void *, const void *);
namespace ircd::allocator
{
void *(*their_malloc_hook)(size_t, const void *);
static void *(*their_malloc_hook)(size_t, const void *);
[[gnu::weak]] void *malloc_hook(size_t, const void *);
static void install_malloc_hook();
static void uninstall_malloc_hook();
void *(*their_realloc_hook)(void *, size_t, const void *);
static void *(*their_realloc_hook)(void *, size_t, const void *);
[[gnu::weak]] void *realloc_hook(void *, size_t, const void *);
static void install_realloc_hook();
static void uninstall_realloc_hook();
void (*their_free_hook)(void *, const void *);
static void (*their_free_hook)(void *, const void *);
[[gnu::weak]] void free_hook(void *, const void *);
static void install_free_hook();
static void uninstall_free_hook();

View File

@ -13,8 +13,7 @@ namespace ircd::b58
[[gnu::visibility("internal")]]
extern const string_view dict;
[[gnu::visibility("internal")]]
thread_local char conv_tmp_buf[64_KiB];
static thread_local char conv_tmp_buf[64_KiB];
}
decltype(ircd::b58::dict)

View File

@ -57,7 +57,7 @@ ircd_backtrace_allow_libc_fix()
namespace ircd
{
thread_local std::array<const void *, 512> backtrace_buffer;
static thread_local std::array<const void *, 512> backtrace_buffer;
}
ircd::backtrace::backtrace()

View File

@ -1633,7 +1633,7 @@ ircd::ctx::debug_stats(const pool &pool)
namespace ircd::ctx::prof
{
thread_local ticker _total; // Totals kept for all contexts.
static thread_local ticker _total; ///< Totals kept for all contexts.
static void check_stack();
static void check_slice();

View File

@ -10,15 +10,19 @@
#include <cxxabi.h>
thread_local char
outbuf[8192];
namespace ircd
{
static thread_local char
demangle_outbuf[8192],
demangle_symbuf[8192];
}
std::string
ircd::demangle(const char *const &symbol)
{
const string_view demangled
{
demangle(outbuf, symbol)
demangle(demangle_outbuf, symbol)
};
return std::string(demangled);
@ -29,7 +33,7 @@ ircd::demangle(const string_view &symbol)
{
const string_view demangled
{
demangle(outbuf, symbol)
demangle(demangle_outbuf, symbol)
};
return std::string(demangled);
@ -40,10 +44,9 @@ ircd::demangle(const mutable_buffer &out,
const string_view &symbol_)
{
assert(size(symbol_) < 4096);
thread_local char symbuf[8192];
const string_view symbol
{
symbuf, strlcpy(symbuf, symbol_)
demangle_symbuf, strlcpy(demangle_symbuf, symbol_)
};
return demangle(out, symbol.data());

View File

@ -42,8 +42,8 @@ ircd::fs::PATH_MAX_LEN
// Convenience scratch buffers for path making.
namespace ircd::fs
{
thread_local char _name_scratch[2][NAME_MAX_LEN];
thread_local char _path_scratch[2][PATH_MAX_LEN];
static thread_local char _name_scratch[2][NAME_MAX_LEN];
static thread_local char _path_scratch[2][PATH_MAX_LEN];
}
// External mutable_buffer to the scratch
@ -440,8 +440,8 @@ ircd::fs::pathconf(const string_view &path,
namespace ircd::fs
{
static const size_t _PATH_CSTR_BUFS {4};
thread_local char _path_cstr[_PATH_CSTR_BUFS][PATH_MAX_LEN];
thread_local size_t _path_cstr_pos;
static thread_local char _path_cstr[_PATH_CSTR_BUFS][PATH_MAX_LEN];
static thread_local size_t _path_cstr_pos;
}
const char *

View File

@ -99,7 +99,7 @@ static_assert
namespace ircd::http2
{
thread_local char error_fmt_buf[512];
static thread_local char error_fmt_buf[512];
}
ircd::http2::error::error()