Make trace fd thread local and have thread specific files
When tracing android APKs, there are multiple threads running that use the driver. This creates per thread files, preventing the multiple threads from clobbering the trace file.
An android APK can be traced by uploading the libwrap.so
file to /system/lib64/
(I found it needs to be in the system folder to prevent android related permission issues). You can then get an app to do LD_PRELOAD
by running in an adb shell:
setprop wrap.<app name> "LD_PRELOAD=/system/lib64/libwrap.so"
This change also moves the trace file from /sdcard/
to /sdcard/Download/
for similar android permission related issues.