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?
Asked
Active
Viewed 67 times
1
![](../../users/profiles/11940339.webp)
a_random_programmer
- 98
- 9
-
The link you gave is Linux system calls, so it's not surprising that it doesn't work. – Nate Eldredge May 07 '20 at 19:02
-
The only tables i could find were linux – a_random_programmer May 07 '20 at 19:16
-
Check https://stackoverflow.com/a/58181308/5329717 – Kamil.S May 28 '20 at 07:57
1 Answers
1
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.
![](../../users/profiles/1312143.webp)
Ken Thomases
- 83,395
- 7
- 101
- 140