I am wondering if there is a getcwd
system call on macos. I can't seem to find any leads on the code for getcwd
apart from https://www.informatik.htw-dresden.de/~beck/ASM/syscall_list.html. However, the code it gives does not function. I have tried using objdump -d
on /usr/lib/system/libsystem_c.dylib, which according to nm, has a _getcwd function. However, objdump simply raised an error saying that it could not disassemble the file. Could anyone tell me the system call code, if it exists?
No, there's no getcwd
syscall on macOS. The source for the getcwd()
library function is here. Note, in particular, the comment for the __getcwd()
internal function: "If __getcwd() ever becomes a syscall, we can remove this workaround."
The Unix syscall table is here. The Mach syscall table (using a separate domain/namespace) is here.