Problems with getcwd syscall on OSX
问题 Does anyone have an idea how to get the current working directory in OSX with NASM? The syscall getcwd isn't available on osx and dtruss pwd return lots of stat sys calls. However in the manual I can't find which structure variable of stat returns the current working directory. Thanks. 回答1: That's a bit late answer, but nonetheless this can be achieved using 2 syscalls. open_nocancel 0x2000018e (or open 0x2000005) opening a file descriptor for current dir fcntl_nocancel 0x20000196 (or fcntl