perf thread_map: Use readdir() instead of deprecated readdir_r()