【问题标题】:is there such thing as a getcwd() syscall on macosmacos 上是否有 getcwd() 系统调用之类的东西
【发布时间】:2020-08-23 05:09:05
【问题描述】:

我想知道macos 上是否有getcwd 系统调用。除了https://www.informatik.htw-dresden.de/~beck/ASM/syscall_list.html 之外,我似乎在getcwd 的代码上找不到任何线索。但是,它提供的代码不起作用。我尝试在 /usr/lib/system/libsystem_c.dylib 上使用objdump -d,根据 nm,它有一个 _getcwd 函数。但是,objdump 只是简单地引发了一个错误,说它无法反汇编文件。谁能告诉我系统调用代码,如果存在的话?

【问题讨论】:

标签: macos system-calls getcwd


【解决方案1】:

不,macOS 上没有 getcwd 系统调用。 getcwd() 库函数的来源是 here。请特别注意 __getcwd() 内部函数的注释:“如果 __getcwd() 成为系统调用,我们可以删除此解决方法。”

Unix 系统调用表是here。 Mach 系统调用表(使用单独的域/命名空间)是 here

【讨论】:

    猜你喜欢
    • 2010-10-26
    • 2017-04-19
    • 2015-12-19
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多