mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 07:10:06 +00:00
44330b6d32
The TUNABLE_SET_VALUE and family of macros (and my later attempt to add a TUNABLE_GET) never quite went together very well because the overall interface was not clearly defined. This patch is an attempt to do just that. This patch consolidates the API to two simple sets of macros, TUNABLE_GET* and TUNABLE_SET*. If TUNABLE_NAMESPACE is defined, TUNABLE_GET takes just the tunable name, type and a (optionally NULL) callback function to get the value of the tunable. The callback function, if non-NULL, is called if the tunable was externally set (i.e. via GLIBC_TUNABLES or any future mechanism). For example: val = TUNABLE_GET (check, int32_t, check_callback) returns the value of the glibc.malloc.check tunable (assuming TUNABLE_NAMESPACE is set to malloc) as an int32_t into VAL after calling check_callback. Likewise, TUNABLE_SET can be used to set the value of the tunable, although this is currently possible only in the dynamic linker before it relocates itself. For example: TUNABLE_SET (check, int32_t, 2) will set glibc.malloc.check to 2. Of course, this is not possible since we set (or read) glibc.malloc.check long after it is relocated. To access or set a tunable outside of TUNABLE_NAMESPACE, use the TUNABLE_GET_FULL and TUNABLE_SET_FULL macros, which have the following prototype: TUNABLE_GET_FULL (glibc, tune, hwcap_mask, uint64_t, NULL) TUNABLE_SET_FULL (glibc, tune, hwcap_mask, uint64_t, 0xffff) In future the tunable list may get split into mutable and immutable tunables where mutable tunables can be modified by the library and userspace after relocation as well and TUNABLE_SET will be more useful than it currently is. However whenever we actually do that split, we will have to ensure that the mutable tunables are protected with locks. * elf/Versions (__tunable_set_val): Rename to __tunable_get_val. * elf/dl-tunables.c: Likewise. (do_tunable_update_val): New function. (__tunable_set_val): New function. (__tunable_get_val): Call CB only if the tunable was externally initialized. (tunables_strtoul): Replace strval with initialized. * elf/dl-tunables.h (strval): Replace with a bool initialized. (TUNABLE_ENUM_NAME, TUNABLE_ENUM_NAME1): Adjust names to prevent collision. (__tunable_set_val): New function. (TUNABLE_GET, TUNABLE_GET_FULL): New macros. (TUNABLE_SET, TUNABLE_SET_FULL): Likewise. (TUNABLE_SET_VAL): Remove. (TUNABLE_SET_VAL_WITH_CALLBACK): Likewise. * README.tunables: Document the new macros. * malloc/arena.c (ptmalloc_init): Adjust.
78 lines
1.8 KiB
Plaintext
78 lines
1.8 KiB
Plaintext
libc {
|
|
GLIBC_2.0 {
|
|
%ifdef EXPORT_UNWIND_FIND_FDE
|
|
__deregister_frame_info; __register_frame_info;
|
|
%endif
|
|
}
|
|
GLIBC_2.1 {
|
|
# functions used in other libraries
|
|
_dl_mcount_wrapper; _dl_mcount_wrapper_check;
|
|
}
|
|
GLIBC_2.2.4 {
|
|
dl_iterate_phdr;
|
|
}
|
|
%ifdef EXPORT_UNWIND_FIND_FDE
|
|
# Needed for SHLIB_COMPAT calls using this version.
|
|
GLIBC_2.2.5 {
|
|
}
|
|
GCC_3.0 {
|
|
__deregister_frame_info_bases; __register_frame_info_bases;
|
|
__register_frame_info_table_bases; _Unwind_Find_FDE;
|
|
}
|
|
%endif
|
|
GLIBC_PRIVATE {
|
|
# functions used in other libraries
|
|
_dl_addr;
|
|
_dl_open_hook;
|
|
_dl_sym; _dl_vsym;
|
|
__libc_dlclose; __libc_dlopen_mode; __libc_dlsym;
|
|
|
|
# Internal error handling support. Interposes the functions in ld.so.
|
|
_dl_signal_error; _dl_catch_error;
|
|
}
|
|
}
|
|
|
|
ld {
|
|
GLIBC_2.0 {
|
|
# Functions which are interposed from libc.so.
|
|
calloc; free; malloc; realloc;
|
|
|
|
_r_debug;
|
|
}
|
|
GLIBC_2.1 {
|
|
# functions used in other libraries
|
|
_dl_mcount;
|
|
# historically used by Garbage Collectors
|
|
__libc_stack_end;
|
|
}
|
|
GLIBC_2.3 {
|
|
# runtime interface to TLS
|
|
__tls_get_addr;
|
|
}
|
|
GLIBC_2.4 {
|
|
# stack canary
|
|
__stack_chk_guard;
|
|
}
|
|
GLIBC_PRIVATE {
|
|
# Those are in the dynamic linker, but used by libc.so.
|
|
__libc_enable_secure;
|
|
_dl_allocate_tls; _dl_allocate_tls_init;
|
|
_dl_argv; _dl_find_dso_for_object; _dl_get_tls_static_info;
|
|
_dl_deallocate_tls; _dl_make_stack_executable; _dl_out_of_memory;
|
|
_dl_rtld_di_serinfo; _dl_starting_up;
|
|
_rtld_global; _rtld_global_ro;
|
|
|
|
# Only here for gdb while a better method is developed.
|
|
_dl_debug_state;
|
|
|
|
# Pointer protection.
|
|
__pointer_chk_guard;
|
|
|
|
# Internal error handling support. Interposed by libc.so.
|
|
_dl_signal_error; _dl_catch_error;
|
|
|
|
# Set value of a tunable.
|
|
__tunable_get_val;
|
|
}
|
|
}
|