iOS 上可以进行系统调用吗?
是否可以进行系统调用,例如执行ls -la
,并在您的应用程序中使用结果?
Is it possible to make a system call, such as executing ls -la
, and use the result in your app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,当有人说系统调用时,他们的意思是通过定义的入口点之一调用内核。虽然它在 iPhone 上在技术上是可行的,但您总是最好通过 libSystem 垫片,因为调用接口可能不稳定(例如在 Mac OS X 上)。我怀疑苹果会喜欢你这样做,但我怀疑没有人真正考虑过这一点,而且他们不太可能注意到。
我不认为这就是你的意思。我想你想使用 ISO/IEC 9899:1990 (C90) C 库函数“系统”。答案是否定的,你不能。
Usually when someone says system call they mean calling into the kernel through one of the defined entry points. While its technically possible on iPhone, you are always better of going through the libSystem shims because the call interface is probably not stable (it isn't on Mac OS X for instance). I doubt Apple would like it if you did that, but I suspect no one as really thought about it much and they are unlikely to notice.
I don't think that is what you mean though. I think you want to use ISO/IEC 9899:1990 (C90) C libraray function "system". The answer to that is no, you can't.
遗憾的是 iOS 下的 syscall.h 是一个私有 api。虽然您可以在私人应用程序中使用它,但遗憾的是,Apple 不允许您使用 syscall() API 进行 App Store 提交。
Sadly syscall.h under iOS is a private api. While you can use it in private applications Apple will not allow you to use the syscall() API for App Store submissions unfortunately.