Disable dlsym hooking by default and fix LD_PRELOAD propagation to new processes

This allows `mangohud steam` to work
pull/131/head
Sporif 4 years ago
parent d1e90b5bec
commit 61ef9244e9

@ -8,3 +8,4 @@ option('with_xnvctrl', type : 'feature', value : 'enabled', description: 'Enable
option('with_x11', type : 'feature', value : 'enabled') option('with_x11', type : 'feature', value : 'enabled')
option('with_wayland', type : 'feature', value : 'disabled') option('with_wayland', type : 'feature', value : 'disabled')
option('with_dbus', type : 'feature', value : 'enabled') option('with_dbus', type : 'feature', value : 'enabled')
option('with_dlsym', type : 'feature', value : 'disabled')

@ -63,7 +63,9 @@ opengl_files = files(
'gl/inject_egl.cpp', 'gl/inject_egl.cpp',
) )
pre_args += '-DHOOK_DLSYM' if get_option('with_dlsym').enabled()
pre_args += '-DHOOK_DLSYM'
endif
if get_option('with_xnvctrl').enabled() if get_option('with_xnvctrl').enabled()

@ -817,7 +817,10 @@ void init_gpu_stats(uint32_t& vendorID, overlay_params& params)
} }
void init_system_info(){ void init_system_info(){
unsetenv("LD_PRELOAD"); const char* ld_preload = getenv("LD_PRELOAD");
if (ld_preload)
unsetenv("LD_PRELOAD");
ram = exec("cat /proc/meminfo | grep 'MemTotal' | awk '{print $2}'"); ram = exec("cat /proc/meminfo | grep 'MemTotal' | awk '{print $2}'");
trim(ram); trim(ram);
cpu = exec("cat /proc/cpuinfo | grep 'model name' | tail -n1 | sed 's/^.*: //' | sed 's/([^)]*)/()/g' | tr -d '(/)'"); cpu = exec("cat /proc/cpuinfo | grep 'model name' | tail -n1 | sed 's/^.*: //' | sed 's/([^)]*)/()/g' | tr -d '(/)'");
@ -833,6 +836,8 @@ void init_system_info(){
trim(driver); trim(driver);
//driver = itox(device_data->properties.driverVersion); //driver = itox(device_data->properties.driverVersion);
if (ld_preload)
setenv("LD_PRELOAD", ld_preload, 1);
#ifndef NDEBUG #ifndef NDEBUG
std::cout << "Ram:" << ram << "\n" std::cout << "Ram:" << ram << "\n"
<< "Cpu:" << cpu << "\n" << "Cpu:" << cpu << "\n"

Loading…
Cancel
Save