Add cwd detection, use mmap() and fstat() to get fd content