简体   繁体   中英

is there such thing as a getcwd() syscall on macos

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM